Answered step by step
Verified Expert Solution
Question
1 Approved Answer
using java Write a class Account to represent a bank account with the following members: Account = {type, accountHolderName, creationDate, balance, category} Note that type
using java
Write a class "Account" to represent a bank account with the following members: Account = {type, accountHolderName, creationDate, balance, category} Note that "type" = checking or saving and "category" = gold or silver Implement the following methods: 1) all constructors, toString method, getters and setters. 2) functions AddMoney, RemoveMoney, CheckBalance, ShowTransactionHistory, showAllAccounts The main function should be something like this: //create an account and set the initial parameters Account my = new Account(); my.SetType("checking"); //account has only two types, checking/saving my.SetAccountHolderName("Tariq"); my.SetCreationDate(8, 10, 2017); //this is the date when account is created my.SetBalance(3000); //this is the opening balance //Only two categories are allowed: Gold/Silver. //note that if account balance is more than 100K, category should be Gold, otherwise Silver. //now, lets call some functions on 'my' object my.AddMoney(4000); my.CheckBalance(); //display a balance of 7000 my.RemoveMoney(1000); my.CheckBalance(); //display a balance of 6000 my.ShowTransactionHistory(); //displays a history of all the above //the above function ShowTransactionHistory() should display the following: //SAR 4000 added on 8/10/2017 //SAR 1000 removed on 8/10/2017 //now lets create another account Account your = new Account(my); your.SetType("saving"); your.SetAccountHolderName("Ahmed"); your.SetCreationDate(8, 10, 2017); my.SetBalance(200000); //now print all the accounts created so far Account.ShowAllAccounts();//displays the following about all the accounts //Total accounts created = 2 //Total Silver members = 1 //Total Gold members = 1
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started