Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a class named CheckingAccount with data fields for an account number and

ID: 3637476 • Letter: C

Question

Create a class named CheckingAccount with data fields for an account number and a balance. Include a constructor thaat tkaes arguments for each field. The constructor sets the balance to 0 if it is below the required
$200.00 minimum for an account. Also include a method that displays account details,
including an explanation if the balance was reduced to 0. Write an application named TestAccount in which you instantiate two CheckingAccount objects, prompt the user for vaules
for the account number and balance, and display the vaules of both accounts. Save both the CheckingAccount.java and TestAccount.java files.

I already have most of this problem completed, the issue im having is the "Also include a method that displays account details,
including an explanation if the balance was reduced to 0" without using the String toString() method.

Explanation / Answer

Everything the other guy wrote was good, but you were asked to "include a method that displays account details", toString formats the printout of the object when that object is printed to the screen... that doesnt do it. instead, in the CheckingAccount class, write: public void displayAccountDetails(){ System.out.println("Account Number: " + accountNo + " Balance: $" + balance"); if (reducedToZero) System.out.println("NOTE: The balance was reduced to 0 because it was below the required $200.00 minimum." } Then in the driver class, write: { ... Scanner scanner = new Scanner(System.in); System.out.prinln("What is the account number for the first account?"); int accountNo = scanner.nextInt(); System.out.prinln("What is the balance for the first account?"); double balance = scanner.nextDouble(); CheckingAccount acc1 = new CheckingAccount(accountNo, balance); acc1.displayAccountDetails(); System.out.prinln("What is the account number for the second account?"); accountNo = scanner.nextInt(); System.out.prinln("What is the balance for the secondaccount?"); balance = scanner.nextDouble(); CheckingAccount acc2 = new CheckingAccount(accountNo, balance); acc2.displayAccountDetails(); }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote