Question: Create the following in c++. Read carefully and answer fully The Money struct contains two integers. - One represents how many dollars you have -
The Money struct contains two integers. - One represents how many dollars you have - The other represents how many cents you have . The Account struct has three variables -A Money struct that will represent how much money is in the account - One variable to represent the interest rate as a decimal value. - The final variable will contain the name of the account. (Checking, Savings, CD, etc) Negative amounts of Money are stored by making both variables of the Money object negative Use the following function prototypes - Account createAccount (std::string file) e The function shall look for a file matching the name of the parameter that is passed to the function. The file contains the name, interest rate, and starting balance in that order e You may assume that each of the three items are contained on their own line e You may NOT assume that the name of the account contains only a single word e You may also assume that a positive and valid (whole number or no more than two decimal places) amount of money will be contained in the file e An Account object with the e If the file does not exist or otherwise cannot be opened, a default Account with name "Sav- proper values is then returned ings," an interest rate of 1%, and a starting balance of $100.00 is returned - createAccount(std::string nane, double rate, Noney balance) The function will return an account with the values already set based on the parameters passed - Account deposit(Account account, Money deposit) e The function shall not accept negative amounts of money If a negative amount of money is attempted to be deposited, an error message will be displayed, and the original account will be returned e A message shall be printed to the screen that takes the form "$X.XXdeposited into [NAME only if a successful deposit is made. The message appears on its own line NAME] shall be replaced with the name of the account The balance of the account shall be updated accordingly -Money withdraw(Account 8account, Money withdraw) The function shall not accept negative amounts of money If a negative amount of money is attempted to be withdrawn, an error message will be displayed, and a Money object equivalent to $0.00 will be returned e You may allow the account to be overdrawn, but by no more than $S0.00 e Amessage shall be printed to the screen that takes the form "SX.XX withdrawn from [NAME whether or not a successful withdrawl is made. The message appears on its own line NAME] shall be replaced with the name of the account e The balance of the account shall be updated accordingly
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
