Question

On Dev C++ Write a C++ program that read customer name and saving account balance. Then...

On Dev C++ Write a C++ program that read customer name and saving account balance. Then it display the following messages to the user: "Press #1 to make a deposit." "Press #2 to make withdraw." If the user presses "1", then read the amount of the deposit, apply it to the balance and display the new account balance. If the user presses "2", then read the amount to withdraw, apply it to the balance and display the new account balance. (Money amounts should be displayed as floating-points with 2 decimal precision).

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

#include<iostream>
using namespace std;
int main()
{
float mb; // main balance
float wa; // withdraw amount
float da; // deposit amount
int ch; // to aceept choice 1 for amount deposit and 2 for amount with draw

mb=0; // initaila balance is zero
while(1)
{
cout << endl;
cout << "================================" << endl;
cout << " Press #1 to make a Deposit " << endl;
cout << " Press #2 to make Withdraw " << endl;   
cout << " Press #3 to exit " << endl;
cout << "================================" << endl;
cout << "Enter choice : " ;
cin >> ch;
if( ch==3) break;
switch(ch)
{
case 1: cout << "Enter amount to deposit : ";
cin >> da;
mb = mb + da;
break;
case 2:
cout << "Enter amount to withdraw : ";
cin >> wa;
mb = mb - wa;
break;
default: cout << "please enter valid choice : " << endl;
}
cout << "New account balance : " << mb << endl;
}
return 0;
}

Add a comment
Know the answer?
Add Answer to:
On Dev C++ Write a C++ program that read customer name and saving account balance. Then...
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
  • C++ Read and do as instructed on please (C++Program *** use only condition statements, loops, functions,...

    C++ Read and do as instructed on please (C++Program *** use only condition statements, loops, functions, files, and arrays. Do NOT use material such as classes. Make sure to add comments** You are to write an ATM Program. The ATM should allow the user to do the following: 1. Create account 2. Log in 3. Exit When they press 1, they are asked for first name (capital first letter). Then it should ask for password. The computer should give the...

  • Please mad in dev c++ software That is example. But it is wrong Write a simple...

    Please mad in dev c++ software That is example. But it is wrong Write a simple checkbook balancing program Input will contain either the word "withdraw" or "deposit". The next line will contain the amount of the check or deposit. After reading each pair of lines, the program should compute and print the new balance. You can declare the variable to hold the running balance to be type float, and you can use the function atof (also in the standard...

  • Lance 1. Write a C++ program that manages a user's bank account. The program must but...

    Lance 1. Write a C++ program that manages a user's bank account. The program must but not limited to: (a) Display a menu for the user once the program runs. The menu display should be done through a user defined function with no parameters. The display should look like the below snapshot. (3 marks) ***********Welcome to the Bank Account Manager program helps you make cash withdrawals and deposits (b) Ask the user for his/her full name. (1.5 marks) (c) Ask...

  • In C++ Write a program that contains a BankAccount class. The BankAccount class should store the...

    In C++ Write a program that contains a BankAccount class. The BankAccount class should store the following attributes: account name account balance Make sure you use the correct access modifiers for the variables. Write get/set methods for all attributes. Write a constructor that takes two parameters. Write a default constructor. Write a method called Deposit(double) that adds the passed in amount to the balance. Write a method called Withdraw(double) that subtracts the passed in amount from the balance. Do not...

  • Write a program that uses a structure to store the following data about a customer account: Name Address City, sta...

    Write a program that uses a structure to store the following data about a customer account: Name Address City, state, and ZIP Telephone number Account Balance Date of last payment The program should use an vector of at least 20 structures. It should let the user enter data into the vector, change the contents of any element, and display all the data stored in the array. The program should have a menu-driven user interface. Input Validation: When the data for...

  • This assignment must be completed on your own with your team mates. Don't give your code...

    This assignment must be completed on your own with your team mates. Don't give your code to others or use other students' code. This is considered academic m will result 0 marks) Write a java program that mange JUC Bank accounts services. The program should have the following: The total number of accounts (n) will be specified by the user at the beginning of the program. Depending upon the entered number, create three Arrays as following o o o Array...

  • answer in c++ code. use comments when writing the code to know what's your thinking. there is three pictures with information Write a C++ console program that defines and utilizes a cl...

    answer in c++ code. use comments when writing the code to know what's your thinking. there is three pictures with information Write a C++ console program that defines and utilizes a class named ATM. This program will demonstrate a composition relationship among classes because an ATM can contain many Accounts. You will need to reuse/modify the Account class you created in Assignment 10. The default constructor for the ATM class should initialize a private vector of 10 accounts, each with...

  • c++ please    Define the class bankAccount to implement the basic properties of a bank account....

    c++ please    Define the class bankAccount to implement the basic properties of a bank account. An object of this class should store the following data: Account holder’s name (string), account number (int), account type (string, checking/saving), balance (double), and interest rate (double). (Store interest rate as a decimal number.) Add appropriate member func- tions to manipulate an object. Use a static member in the class to automatically assign account numbers. Also declare an array of 10 compo- nents of...

  • Textual menus work by showing text items where each item is numbered. The menu would have...

    Textual menus work by showing text items where each item is numbered. The menu would have items 1 to n. The user makes a choice, then that causes a function to run, given the user made a valid choice. If the choice is invalid an error message is shown. Whatever choices was made, after the action of that choice happens, the menu repeats, unless the menu option is to quit. Such kind of menus are displayed from the code under...

  • On Dev C++, write a C++ program that prompts the user with the following option: 1)...

    On Dev C++, write a C++ program that prompts the user with the following option: 1) to enter a student information such as First Name, Last Name, SS# formatted as ###-##-####, userID and Password and store them into a struct data type. 2) to display the student information as shown in the example below: Name: Mary Last Name: Parker SS#: 000-00-1398 userID: mParker Password: ******** 3) Exit the program.

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