
In java
Design a class named Account that contains:
• A private double data field named annualInterestRate that stores the current interest rate.
Assume all accounts have the same interest rate (i.e. static member data).
• A private int data field named nextAccountNb that stores the next account number to be
assigned (default 300). Assume all accounts use this data member to assign the account number while creating an account (i.e. static member data).
• A private int data field named accounNb for the account.
• A private String data field named f_name for first name.
• A private String data field named l_name for last name.
• A private double data field named balance for the account.
• A private Date data field named dateCreated that stores the date when the account was
created. (usejava.util.Dateclass)
• A constructor that creates an account for a given first name, last name, and initial balance. It sets up a new account number, first name, last name, balance, date of account creation, and advances nextAccountNb value by 1.
• Appropriate accessor and mutator methods for accountNb, f_name, l_name, balance, annualInterestRate, and dateCreated.
• A method named getMonthlyInterestRate() that returns the monthly interest rate.
• A method named withdraw that withdraws a specified amount from the account.
• A method named deposit that deposits a specified amount to the account.
You should include appropriate data validation checks, e.g. balance should not be negative, name can include spaces, etc.
Implement the class. Write a test program named SwanaBank that performs the following:
- Displays a welcome message “Welcome to SWANA Bank”
- Sets up an interest rate of 4.5% and displays the interest rate as today’s interest rate.
- Prompts the user for first name, last name. Create an account with an initial balance of
$100.
- Displays the account details including monthly interest on the current balance.
Allows user to deposit and withdraw as many times as they want.
- Finally, ends with a good bye message.
Your test program should access (i.e. get or set method) the static field annualInterestRate before creating accounts, and via an account object. Please refer to the screen shot below for precise details.
Here is a sample screen shot:
Welcome to SWANA Bank Today's Interest Rate is = 4.5%
Enter first name: Malleswara Rao Enter last name: Talla
Your account details are:
Name is: Malleswara Rao Talla
Account Number is 300
Current balance is $100.0
Interest Rate is = 4.5%
Monthly interest for this balance is $0.375
This account was created on Sun Oct 24 10:42:51 EDT 2010
Enter your choice (0: deposit, 1: withdraw, 2: quit): 0 Enter the amount in $300
Enter your choice (0: deposit, 1: withdraw, 2: quit): 0 Enter the amount in $100
Enter your choice (0: deposit, 1: withdraw, 2: quit): 1 Enter the amount in $50
Enter your choice (0: deposit, 1: withdraw, 2: quit): 1 Enter the amount in $25
Enter your choice (0: deposit, 1: withdraw, 2: quit): 2
New balance is $425.0 Good Bye!

Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 2 images

- A(n) is a unique form of class member that enables an object to store and retrieve data.arrow_forwardWhen a class contains a data member that is a pointer to dynamically-allocated storage, which of the following member functions should be implemented? All three of the member functions listed below should be implemented. The copy assignment operator. The copy constructor. The destructor.arrow_forwardplease assist me C++ language you are the owner of a pet store and you want to create a database of the different types of pets you sell you will create a base class called Pet and will include the following member variables: gender size (small, medium, or large) trained (yes or no) age long haired (yes or no) create two constructors default will initialize member variable with blanks or zeros second constructor will assign parameter values to each variable create your mutator functions create your accessor functions and save your Pet.h file create a new header file for dogs: dog.h it will be a derived class of Pet.h it will inherit the public functions of Pet.h it will have its own member variable breed (ie: beagle, collie, etc.) create the .cpp file, pet store create two instances of dog use the default constructor for the first dog use the second constructor for the second dog display both dog's data labeling each line report should look something like this…arrow_forward
- Double Bubble For this exercise you need to create a Bubble class and construct two instances of the Bubble object. You will then take the two Bubble objects and combine them to create a new, larger combined Bubble object. This will be done using functions that take in these Bubble objects as parameters. The Bubble class contains one data member, radius_, and the corresponding accessor and mutator methods for radius_, GetRadius and SetRadius. Create a member function called CalculateVolume that computes for the volume of a bubble (sphere). Use the value 3.1415 for PI. Your main function has some skeleton code that asks the user for the radius of two bubbles. You will use this to create the two Bubble objects. You will create a CombineBubbles function that receives two references (two Bubble objects) and returns a Bubble object. Combining bubbles simply means creating a new Bubble object whose radius is the sum of the two Bubble objects' radii. Take note that the CombineBubbles function…arrow_forwardPersonal Information Class: Design a class called Employee that holds the following data about an employee: name ID number Department Job Title Class. Store your class in a separate file called employee.py. Your class will have an initializer method that will be passed the information entered by the user as arguments. Write appropriate accessor and mutator methods for each data attribute. Write a __str__ method to print the contents of the class (see example of __str__ on p. 523). Main program: Your main program should create three instances of the class. Your program should get the information from the user and pass it as parameters to the initializer method. Using the __str__ method invoked by the print function, the program should display the personal information for the three individuals. Output and Sample Dialog: Enter employee name: Mary Smith Enter employee ID: 123456 Enter department: Accounting Enter position: Accountant Enter employee name: Joe Morales Enter…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





