1. Q1 - Quiz 6 (Points: 10) Do not make this question complicated; It is a simpl
ID: 3633069 • Letter: 1
Question
1. Q1 - Quiz 6 (Points: 10)Do not make this question complicated; It is a simple exercise on structure before we get to classes and more objects.
Consider a bank certificate of deposit, which is often called CD. A CD is a bank account that does not allow withdrawals for a specified number of months. A CD naturally has three pieces of data associated with it: the account balance, the interest rate for the account, and the term, which is number of months until maturity. The first two items can be represented as values of type double, and the number of months can be represented as a value of type int. Now you are asked to write the definition of a structure called CDAccountV1 that can be used for this kind of account.
Your program is using a void function called getData that has following definition
void getData(CDAccountV1 & the Account)
This is the main program; you need to complete the function getData , and definition of structure CDAccountV1. Complete the program and send me complete source code in One hour.
void main( )
{
CDAccountV1 account;
getData(account);
double rateFraction, interest;
rateFraction = account.interestRate/100.0;
interest = account.balance*(rateFraction*(account.term/12.0));
account.balance = account.balance + interest;
cout<<fixed<<showpoint<<.precision(2);
cout << "When your CD matures in " << account.term << " months, "
<< "it will have a balance of $" << account.balance << endl;
}
Explanation / Answer
#include using namespace std; struct CDAccountV1 { double balance; double interestRate; int term; }; void getData(CDAccountV1& theAccount); int main() { CDAccountV1 account; getData(account); double rateFraction, interest; rateFraction = account.interestRate/100.0; interest = account.balance*(rateFraction*(account.term/12.0)); account.balance = account.balance + interest; cout.setf(ios::fixed); cout.setf(ios::showpoint); cout.precision(2); coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.