Question: C++ Grading rubric: Indent code and insert comments to document your program. [10 pts] Program must be implemented and run as instructed. [80 pts] To

C++

Grading rubric:

Indent code and insert comments to document your program. [10 pts]

Program must be implemented and run as instructed. [80 pts]

To receive the maximum of 80 points, this program must separate the

Account class implementation from the main function file and, in addition, the Account class

must have its interface (Account.h) in a separate file from its implementation.

The code in the following files:

AccountMain.cpp

Account.cpp

Account.h -- provided in the attached file.

Please use these file names exactly. [10 pts]

Summary

The lab requires you to create two files Account.cpp and AccountMain.cpp. You will end up with Account.h, Account.cpp and AccountMain.cpp.

Account Class Definition:

Class Account

Private Data Members:

static int genId

int accountId

double balance

double annualInterestRate

Static data member used to assign value to accountId;

Account ID

Current Balance of the account

Current Annual Interest Rate of the Account (ex. 4.5)

Public Member Functions:

Account()

Account(int id, double bal, double interest)

Constructors:

Default Constructor (no parameters)

Overloaded Constructor: Three-Parameter Constructor

Public Member Functions:

void setAccountId (int x)

void setBalance(double x)

void setInterest(double x)

Setters:

Function sets id to x

Function sets balance to x

Function sets annualInterestRate to x

Public Member Functions:

int getAccountId()

double getBalance()

double getInterest()

static double getGenId()

Getters:

Function returns accountId

Function returns balance

Function returns annualInterestRate

Static Function used to returns genId

Public Member Functions:

double getMonthlyInterestRate()

Function calculates the monthly interest rate and returns the value

double getMonthlyInterest()

Function calculates the amount earned per month from interest and returns the value rounded to 2 decimal places. (Assume interest is not compounding)

Bool withdraw(double amount)

Function only allows withdraw if the current balance is greater than or equal to the withdraw amount. Return true if withdrawal is successful, else return false.

void deposit(double amount)

Function adds the amount passed as a parameter to the current balance.

Write a program that creates an array of 10 Account objects.

When creating each Account object, make sure the object is initialized in both the default and overloaded constructor functions with following guidelines:

Each objects accountId should be the index of its position within the array. Add a static data member to initialize the accountId. (10%)

The balance of each Account object should be created from a random number generator function returning values between 100.00 and 200.00. (5%)

The interest rate of each Account object should be created from a random number generator function returning values between 1.5 and 5.0. This return value should be rounded to one decimal place. (5%)

Main Program and remaining member function defintions: (80%)

The program should then ask the user to select an account number from 0 9 or -1 to exit the program.

If an account number is selected, then the user should be presented with the following options:

Enter 1 to make a deposit

Ask the user for the amount they wish to deposit

Enter 2 to make a withdraw

Ask the user for the amount they wish to withdraw

Return if withdrawal was successful or unsuccessful depending on function return value

Enter 3 to check balance

Display the accounts current balance

Enter 4 to check interest rate

Display the accounts monthly and yearly interest rate

Enter 5 to display account summary

Display account id, balance, monthly interest rate, and monthly interest amount

Enter 99 to exit to the main menu to select another account number.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!