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

Text input : Design a bank account class named Account that has the following pr

ID: 3828526 • Letter: T

Question

Text input :
Design a bank account class named Account that has the following private member variables: account Number of type int ownerName of type string balance of type double and the following public member functions: Account 0 constructor with no arguments, that creates a bank account with a default account Number as 9999, a name of an empty string, and balance value of zero. An Account object is dynamically allocated Account (number name, bal) constructor with three parameters, that creates a bank account with a specified accountNumber, name and balance. An Account object is dynamically allocated withdraw (amount) function to withdraw a specified amount from the account. The function should first check if there is sufficient balance in the account. If the balance is sufficient, withdrawal is processed. Otherwise the withdrawal is not made. deposit (amount) function to deposit a specified amount of money to the account. The function should first check if the deposit amount is positive. If it is positive, deposit is processed. Otherwise the deposit is not made. get Account Number An accessor function that returns the account number. This function is later called by the displayAccount Info function. getName An accessor function that returns the name on the account. get Balance An accessor function that returns the account balance. This function is later called by the displayAccountInfo0 function. Demonstrate the class in a program. 1. Additional Requirements a) What to turn in Your code should be structured into the following files: Account.h which contains the class definition and the function prototypes of all the member functions Account.cpp which contains the function description of all the member functions Main.cpp file which contains the main function.

Explanation / Answer

import java.util.Scanner;

open class BankAccount {

open static void main(String[] args) {

Scanner in = new Scanner(System.in);

int userChoice;

boolean quit = false;

coast adjust = 0f;

do {

System.out.println("1. Store cash");

System.out.println("2. Pull back cash");

System.out.println("3. Check adjust");

System.out.print("Your decision, 0 to stop: ");

userChoice = in.nextInt();

switch (userChoice) {

case 1:

skim sum;

System.out.print("Amount to store: ");

sum = in.nextFloat();

on the off chance that (sum <= 0)

System.out.println("Can't store nonpositive amount.");

else {

adjust += sum;

System.out.println("$" + sum + " has been deposited.");

}

break;

case 2:

System.out.print("Amount to pull back: ");

sum = in.nextFloat();

on the off chance that (sum <= 0 || sum > adjust)

System.out.println("Withdrawal can't be completed.");

else {

adjust - = sum;

System.out.println("$" + sum + " has been withdrawn.");

}

break;

case 3:

System.out.println("Your adjust: $" + adjust);

break;

case 0:

stopped = genuine;

break;

default:

System.out.println("Wrong choice.");

break;

}

System.out.println();

} while (!quit);

System.out.println("Bye!");

}

}

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