Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need be done in C++ You should create the following files: account.h - Stores the Account class declaration. account.cpp - Stores the Account class implementation.

Need be done in C++

You should create the following files:

account.h - Stores the Account class declaration.

account.cpp - Stores the Account class implementation.

program.cpp - Contains the main function.

You will create header files and cpp source files for each class. You will place the class declaration in a header file, and your class method implementations will go in a cpp source file. Your main function will go in yet another cpp source file. All of your cpp source files will #include the header file for your class. Do not #include cpp files from another cpp file. You should add each source file to the project in your development environment.

Create a simple class that represents a bank account. For this task, you will create a program that has a single account. In later tasks, you will add the ability to store multiple accounts.

The account class will have the following data members:

an account ID (integer)

account name (string)

account balance (float)

All of these members should be private or protected. (This is generally true of all class data members.)

The account class will have a constructor that takes no parameters. This constructor will initialize the data members to empty values.

The account class will have a method that prompts the user to enter the name and the initial balance. The ID of the object will be automatically set by your program with the next ID number available. The first ID number is zero, and subsequent accounts will get numerically increasing ID numbers. A static data member is one way to store the next available ID number (this is separate from the ID data member in each object).

The account class will have a method that will display the account information.

Your main function will create an object of the account class, call the object's input method that asks the user to enter the account information, and call the object's output method to show the account information to the user.

Example input and output (input is underlined):

Enter the name: George Enter the balance: input 100 Account ID: 0 Name: George Balance: $100.00

Part 2.

Add a menu to your program to allow the user to manipulate and view the account information. Your menu should have two options: display the account information and quit the program. The code that displays the menu options and reads the user selection should be inside a loop in your main function. This way the user can interact with the program repeatedly until finished.

Example input and output (input is underlined):

Enter the name: input George Enter the balance: input 100 Account Menu: 0. Quit Program 1. Display Account Information Your choice: input 1 Account ID: 0 Name: George Balance: $100.00 Account Menu: 0. Quit Program 1. Display Account Information Your choice: input 0

Part 3.

Add a method to your Account class that will add a deposit to the account balance. This method should accept a float and return nothing.

Add a new menu selection to allow the user to add a deposit to the account.

Example input and output (input is underlined):

Enter the name: input George Enter the balance: input 100 Account Menu: 0. Quit Program 1. Display Account Information 2. Add a deposit to an account Your choice: input 2 Amount to deposit: input 15 Account Menu: 0. Quit Program 1. Display Account Information 2. Add a deposit to an account Your choice: input 1 Account ID: 0 Name: George Balance: $115.00

Part 4.

Add a method to your Account class that will subtract a withdrawal amount from the account balance. This method should accept a float and return nothing.

Example input and output (input is underlined):

Enter the name: input George Enter the balance: input 100

Account Menu: 0. Quit Program 1. Display Account Information 2. Add a deposit to an account 3. Withdraw from an account Your choice: input 3 Amount to withdraw: input 15 Account Menu: 0. Quit Program 1. Display Account Information 2. Add a deposit to an account 3. Withdraw from an account Your choice: input 1 Account ID: 0 Name: George Balance: $85.00

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

Database Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Databases questions

Question

How does your message use nonverbal communication?

Answered: 1 week ago