Oops Ssss
Oops Ssss
Public double area(double base, double height, boolean isTriangle) { Double height = Double.parseDouble(reader.readLine());
} // Circle input
Balance -= amount;
} else {
Class Account { System.out.println(“Error: Insu icient balance or withdrawal would go below minimum balance.”);
} }
Final double MIN_BALANCE = 1000; Public static void main(String[] args) throws IOException {
Public Savings(String acno, String name, double initialBalance) { Bu eredReader br = new Bu eredReader(isr);
Super(acno, name);
This.balance = initialBalance >= MIN_BALANCE ? initialBalance : MIN_BALANCE; // Create an Account and Savings object
System.out.println(“Deposited: “ + amount);
System.out.println(“\nBank Menu:”); }
System.out.println(“1. Deposit”);
System.out.println(“4. Exit”); }
Switch (choice) {
Case 1:
Account.deposit(depositAmount);
Break;
Case 2:
Account.withdraw(withdrawAmount);
Break;
Case 3:
Account.displayBalance();
Break;
Case 4:
System.out.println(“Exiting…”);
Exit = true;
Break;
Default:
Throw new ArithmeticException(“Not eligible: Marks in one or more subjects below 60%”);
Import java.io.*; }
Public static void main(String[] args) throws IOException { Throw new ArithmeticException(“Not eligible: Total percentage below 50%”);
Obj.calculate();
} catch (ArithmeticException e) {
Try {
Class Student { }
} Return “B”;
Return “C”;
Super(regNo, name);
} System.out.println(“Name: “ + name);
System.out.println(“Grade: “ + calculateGrade());
This.eseMarks = eseMarks;
Interface Savings {
// Create an instance of ESE_Marks and display the details Account(String acno, String name, String address, double bal) {
} This.address = address;
If (amount > 0) {
Bal += amount;
System.out.println(“Deposited: “ + amount);
} else {
}
} System.out.print(“Enter Address: “);
If (amount > 0 && (bal – amount) >= MIN_BAL) { Double bal = Double.parseDouble(br.readLine());
Bal -= amount;
} else {
System.out.println(“Cannot withdraw. Balance would fall below minimum.”); Boolean running = true;
} While (running) {
System.out.println(“1. Deposit”);
} Switch (choice) {
} Case 1:
Case 3:
Account.enquiry();
Break;
Case 4:
Running = false;
System.out.println(“Exiting…”);
Break;
Default:
System.out.println(“Invalid choice.”);