Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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. (IN C++)

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.

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

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.

Main Program and remaining member function defintions:

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases And Python Programming MySQL MongoDB OOP And Tkinter

Authors: R. PANNEERSELVAM

1st Edition

9357011331, 978-9357011334

More Books

Students also viewed these Databases questions