Question

The objective of this project is to provide experience working with user interface menus and programmed...

The objective of this project is to provide experience working with user interface menus and

programmed decision making.

Modify the C++ source you created in Project # 2 to incorporate the following requirements:

1. Present a menu to the user which includes:

a. Enter checking account transaction

b. Enter savings account transaction

c. Quit

2. If the user selects a., request the checking account balance, the checking account

transaction date, the checking account description, and the checking account

amount from the user, and store these values in the variables you previously

created. Then print to the standard output the checking account transaction report

you previously created.

3. If the user selects b., request the savings account balance, the savings account

transaction date, the savings account description, and the savings account amount

from the user, and store these values in the variables you previously created. Then

print to the standard output the savings account transaction report you previously

created.

4. If the user selects c., simply exit the program without doing any further inputs/or

outputs.

Ensure your program is adequately commented. At the beginning of your program use a

multiline comment and provide your name, date, and a brief description of the

program. Use appropriate comments for your variable declarations. Use appropriate

comments for your user input. Use appropriate comments for your output. And use

appropriated comments for the menu logic.

Compile and run your program to ensure there are no errors and it meets the requirements

of this project.

Here is the C++ source I created in Project # 2

/*

A program that calculates the total bank balance from a checking and savings account.

*/

#include <iostream>

#include <string>

#include <iomanip>

using namespace std;

int main()

{

float checkingAccount; //Float variable holding the balance of checking account

string checkingTransactionDate;

string checkingTransactionDescription;

float checkingTransactionAmount; //Float variable for checking account transaction

float savingsAccount; //Float variable holding the balance of savings account

string savingsTransactionDate;

string savingsTransactionDescription;

float savingsTransactionAmount; //Float variable for savings account transaction

cout << "Please enter the checking account balance:"; //display promt

cin >> checkingAccount; //read input

cin.ignore(); //used for string input

cout << "Please enter the checking account transaction date:"; //display promt

getline(cin, checkingTransactionDate); //read string input

cout << "Please enter the checking account transaction description:"; //display promt

getline(cin, checkingTransactionDescription); //read string input

cout << "Please enter the checking account transaction amount:"; //display promt

cin >> checkingTransactionAmount; //read input

cout << "\n";

cout << "Please enter the savings account balance:"; //display promt

cin >> savingsAccount; //read input

cin.ignore(); //used for string input

cout << "Please enter the savings account transaction date:"; //display promt

getline(cin, savingsTransactionDate); //read string input

cout << "Please enter the savings account transaction description:"; //display promt

getline(cin, savingsTransactionDescription); //read string input

cout << "Please enter the savings account transaction amount:"; //display promt

cin >> savingsTransactionAmount; //read input

cout.precision(2); //format numbers to two decimals

cout << "\n";

cout << left << setw(80) << "================================================================================ \n";

cout << setw(80) << " CHECKING ACCOUNT \n";

cout << right << setw(80) << "\n";

cout << right << setw(72) << "OPENING BALANCE: $" << fixed << right << checkingAccount;

cout << setw(80) << "\n";

checkingAccount -= checkingTransactionAmount;

cout << left << setw(13) << "\nDATE" << setw(42) << "DESCRIPTION" << right << setw(10) << "AMOUNT" << setw(17) << "BALANCE\n";

cout << left << setw(12) << "==========" << left << setw(43) << "=========================================" << left << setw(11) << "=========" << left << setw(15) << "==============\n";

cout << left << setw(12) << checkingTransactionDate << left << setw(40) << checkingTransactionDescription << fixed << right << setw(5) << "-$" << checkingTransactionAmount << fixed << right << setw(10) << "$" << checkingAccount << "\n";

//display output for checking account in table format

cout << "\n";

cout << "\n";

cout << left << setw(80) << "================================================================================ \n";

cout << setw(80) << " SAVINGS ACCOUNT \n";

cout << right << setw(80) << "\n";

cout << right << setw(72) << "OPENING BALANCE: $" << fixed << right << savingsAccount;

cout << setw(80) << "\n";

savingsAccount -= savingsTransactionAmount;

cout << left << setw(13) << "\nDATE" << setw(42) << "DESCRIPTION" << right << setw(10) << "AMOUNT" << setw(17) << "BALANCE\n";

cout << left << setw(12) << "==========" << left << setw(43) << "=========================================" << left << setw(11) << "=========" << left << setw(15) << "==============\n";

cout << left << setw(12) << savingsTransactionDate << left << setw(40) << savingsTransactionDescription << fixed << right << setw(5) << "-$" << savingsTransactionAmount << fixed << right << setw(10) << "$" << savingsAccount << "\n";

//display output for savings account in table format

system("pause");

return 0;

}

0 0
Add a comment Improve this question Transcribed image text
Answer #1

/*Comments: I just added menu to your code. Please comment for any doubt or help*/

/*

Name:

Date:

Description: A program that calculates the total bank balance from a checking and savings account.

*/

#include <iostream>

#include <string>

#include <iomanip>

using namespace std;

int main()

{

                float checkingAccount; //Float variable holding the balance of checking account

                string checkingTransactionDate; //for holding checking transaction date

                string checkingTransactionDescription; // for holding checking transaction description

                float checkingTransactionAmount; //Float variable for checking account transaction

               

                float savingsAccount; //Float variable holding the balance of savings account

                string savingsTransactionDate;//for holding savings transaction date

                string savingsTransactionDescription;// for holding savings transaction description

                float savingsTransactionAmount; //Float variable for savings account transaction

                //Displaying menu

                char input; //to store choice from user

                cout<<"============== Menu ==============="<<endl;

                cout<<"a. Enter checking account transaction"<<endl;

                cout<<"b. Enter savings account transaction"<<endl;

                cout<<"c. Quit"<<endl<<endl;

                //get user's choice

                cout<<"Select an option: ";

                cin>>input;

               

                //if choice is a then process checking account

                if(input=='a'){

                                cout << "Please enter the checking account balance: "; //display promt

                                cin >> checkingAccount; //read input

                                cin.ignore(); //used for string input

                                cout << "Please enter the checking account transaction date: "; //display promt

                                getline(cin, checkingTransactionDate); //read string input

                                cout << "Please enter the checking account transaction description: "; //display promt

                                getline(cin, checkingTransactionDescription); //read string input

                                cout << "Please enter the checking account transaction amount: "; //display promt

                                cin >> checkingTransactionAmount; //read input

                                cout << "\n";

                               

                                cout.precision(2); //format numbers to two decimals

               

                               

                                cout << "\n";

                                cout << left << setw(80) << "================================================================================ \n";

                                cout << setw(80) << "                               CHECKING ACCOUNT                                  \n";

                                cout << right << setw(80) << "\n";

                                cout << right << setw(72) << "OPENING BALANCE: $" << fixed << right << checkingAccount;

                                cout << setw(80) << "\n";

                                checkingAccount -= checkingTransactionAmount;

                                cout << left << setw(13) << "\nDATE" << setw(42) << "DESCRIPTION" << right << setw(10) << "AMOUNT" << setw(17) << "BALANCE\n";

                                cout << left << setw(12) << "==========" << left << setw(43) << "=========================================" << left << setw(11) << "=========" << left << setw(15) << "==============\n";

                                cout << left << setw(12) << checkingTransactionDate << left << setw(40) << checkingTransactionDescription << fixed << right << setw(5) << "-$" << checkingTransactionAmount << fixed << right << setw(10) << "$" << checkingAccount << "\n";

                                //display output for checking account in table format

                }

               

                else if(input=='b'){

                                cout << "Please enter the savings account balance: "; //display promt

                                cin >> savingsAccount; //read input

                                cin.ignore(); //used for string input

                                cout << "Please enter the savings account transaction date: "; //display promt

                                getline(cin, savingsTransactionDate); //read string input

                                cout << "Please enter the savings account transaction description: "; //display promt

                                getline(cin, savingsTransactionDescription); //read string input

                                cout << "Please enter the savings account transaction amount: "; //display promt

                                cin >> savingsTransactionAmount; //read input

                                cout << "\n";

                               

                                cout.precision(2); //format numbers to two decimals

                                cout << "\n";

                                cout << left << setw(80) << "================================================================================ \n";

                                cout << setw(80) << "                               SAVINGS ACCOUNT                                  \n";

                                cout << right << setw(80) << "\n";

                                cout << right << setw(72) << "OPENING BALANCE: $" << fixed << right << savingsAccount;

                                cout << setw(80) << "\n";

                                savingsAccount -= savingsTransactionAmount;

                                cout << left << setw(13) << "\nDATE" << setw(42) << "DESCRIPTION" << right << setw(10) << "AMOUNT" << setw(17) << "BALANCE\n";

                                cout << left << setw(12) << "==========" << left << setw(43) << "=========================================" << left << setw(11) << "=========" << left << setw(15) << "==============\n";

                                cout << left << setw(12) << savingsTransactionDate << left << setw(40) << savingsTransactionDescription << fixed << right << setw(5) << "-$" << savingsTransactionAmount << fixed << right << setw(10) << "$" << savingsAccount << "\n";

                                //display output for savings account in table format

                }

               

                system("pause");

                return 0;

}

OUTPUT:

Option a:

sesHenses Enter checking account transaction Enter savings account transaction . quit elect an option: a lease enter the chec

Option b:

sesHenses Enter checking account transaction Enter savings account transaction . quit elect an option: b lease enter the savi

Option c:

sesHenses a. Enter checking account transaction b. Enter savings account transaction . quit Select an option: c ress any key

Add a comment
Know the answer?
Add Answer to:
The objective of this project is to provide experience working with user interface menus and programmed...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Introduction Extend the inheritance hierarchy from the previous project by changing the classes to template classes....

    Introduction Extend the inheritance hierarchy from the previous project by changing the classes to template classes. Do not worry about rounding in classes that are instantiated as integer classes, you may just use the default rounding. You will add an additional data member, method, and bank account type that inherits SavingsAc-count ("CD", or certicate of deposit). Deliverables A driver program (driver.cpp) An implementation of Account class (account.h) An implementation of SavingsAccount (savingsaccount.h) An implementation of CheckingAccount (checkingaccount.h) An implementation of...

  • C++ Banks offer various types of accounts, such as savings, checking, certificate of deposits, and money...

    C++ Banks offer various types of accounts, such as savings, checking, certificate of deposits, and money market, to attract customers as well as meet their specific needs. Two of the most commonly used accounts are savings and checking. Each of these accounts has various options. For example, you may have a savings account that requires no minimum balance but has a lower interest rate. Similarly, you may have a checking account that limits the number of checks you may write....

  • The following is a sample inventory in C++, i want to ask the user to input a item number for removing from inventory. //CPP #include <iostream> #include <fstream> #include <cstdlib>...

    The following is a sample inventory in C++, i want to ask the user to input a item number for removing from inventory. //CPP #include <iostream> #include <fstream> #include <cstdlib> #include <iomanip> #define MAX 1000 using namespace std; //Function to Add a new inventory item to the data into the array in memory void addItem(string desc[],string idNum[], float prices[], int qty[],int &num) { cout<<"Enter the names:"; cin>>desc[num]; cout<<"Enter the item number:"; cin>>idNum[num]; cout<<"Enter the price of item:"; cin>>prices[num]; cout<<"Enter the...

  • 1. in this programe i want add some products to be shown after choosing choise (...

    1. in this programe i want add some products to be shown after choosing choise ( show all products ) before i add any products. let say 10 products have added to the program then when the user choose (show all products ) all the 10 products appear and the user going to choose one and that one must has its own name, price,and quantity after that the quantity will be reduce. 2. allow the user to buy products. ===========================================================...

  • I did a program in computer science c++. It worked fine the first and second time...

    I did a program in computer science c++. It worked fine the first and second time when I ran the program, but suddenly it gave me an error. Then, after a few minutes, it started to run again and then the error showed up again. This is due tonight but I do not know what is wrong with it. PLEASE HELP ME! Also, the instruction for the assignment, the code, and the error that occurred in the program are below....

  • MAIN OBJECTIVE       Develop a polymorphic banking program using the Account hierarchy created (below). C++ Capture...

    MAIN OBJECTIVE       Develop a polymorphic banking program using the Account hierarchy created (below). C++ Capture an output. polymorphism. Write an application that creates a vector of Account pointers to two SavingsAccount and two CheckingAccountobjects. For each Account in the vector, allow the user to specify an amount of money to withdraw from the Account using member function debit and an amount of money to deposit into the Account using member function credit. As you process each Account, determine its...

  • C++ Assignment on Search and Sort for Chapter 8 Problem: Modify the student grade problem to...

    C++ Assignment on Search and Sort for Chapter 8 Problem: Modify the student grade problem to include the following: •   Write a Search function to search by student score •   Write a Search function to search by student last name •   Write a Sort function to sort the list by student score •   Write a Sort function to sort the list by student last name •   Write a menu function that lets user to choose any action he/she want to...

  • Java project: A Bank Transaction System For A Regional Bank User Story A regional rural bank...

    Java project: A Bank Transaction System For A Regional Bank User Story A regional rural bank CEO wants to modernize banking experience for his customers by providing a computer solution for them to post the bank transactions in their savings and checking accounts from the comfort of their home. He has a vision of a system, which begins by displaying the starting balances for checking and savings account for a customer. The application first prompts the user to enter the...

  • i have two issues that i need help. 1- that in case three and two only...

    i have two issues that i need help. 1- that in case three and two only one line is being read from the file 2- my case 4 is not working correctly as it should as the output is only " Enter 1 for Trump, 2 for Warren:" #include <iostream> #include <cctype> // For the letter checking functions #include <fstream> // For file input #include <iomanip> // For setw #include <ctime> #include <cstdlib> // For exit and abs #include <errno.h>...

  • IP requirements: Load an exam Take an exam Show exam results Quit Choice 1: No functionality...

    IP requirements: Load an exam Take an exam Show exam results Quit Choice 1: No functionality change. Load the exam based upon the user's prompt for an exam file. Choice 2: The program should display a single question at a time and prompt the user for an answer. Based upon the answer, it should track the score based upon a successful answer. Once a user answers the question, it should also display the correct answer with an appropriate message (e.g.,...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT