Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CIS 2 8 0 X Lab assignment 1 Due: Wednesday, January 1 7 1 0 points Implement a class Account. An account has a balance,

CIS 280X
Lab assignment 1
Due: Wednesday, January 17
10 points
Implement a class Account. An account has a balance, functions to add and withdraw money, and a function to query the current balance. Charge a $20 penalty if an attempt is made to withdraw more money than is available in the account.
Test your Account class by using the following main function.
int main()
{
Account my_account(100); // Set up my account with $100
my_account.deposit(50);
my_account.withdraw(175); // Penalty of $20 will apply
my_account.withdraw(25);
cout << "Account balance: "<< my_account.get_balance()<<"
";
my_account.withdraw(my_account.get_balance()); // withdraw all
cout << "Account balance: "<< my_account.get_balance()<<"
";
return 0;
}
Output
Account balance: 120
Account balance: 0

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

Seven NoSQL Databases In A Week Get Up And Running With The Fundamentals And Functionalities Of Seven Of The Most Popular NoSQL Databases

Authors: Aaron Ploetz ,Devram Kandhare ,Sudarshan Kadambi ,Xun Wu

1st Edition

1787288862, 978-1787288867

More Books

Students also viewed these Databases questions

Question

3. What preparations should you make before an interview? (LO 14-3)

Answered: 1 week ago