Design an Account class used to represent an individual’s declining balance gift card.  It contains a string for the account number, and a float value for the balance.  It should include the following 7 functions: a 2-argument constructor (it accepts an account number and initial balance). a set function, one for each attribute (2 total functions, setAccount and setBalance.  Each assigns an argument value to the named member variable. a get function for each attribute (2 total functions, getAccount, and getBalance). Each returns the value stored in the named member variable. a function to display the account’s information to the screen.  The account number and balance value should be labelled. a function withdraw that takes a float argument and subtracts it from the balance.   Write the class declaration.  Member variables should NOT be accessible outside the class!  Member functions should be accessible outside the class! Write the member function definitions for only the following functions: setBalance getBalance withdraw Do NOT inline the member function definitions! Note: A driver (main function) is NOT required.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter11: Introduction To Classes
Section: Chapter Questions
Problem 3PP: (Program) a. Complete the following class by including functions corresponding to the two prototypes...
icon
Related questions
Question

Design an Account class used to represent an individual’s declining balance gift card.  It contains a string for the account number, and a float value for the balance.  It should include the following 7 functions:

  • a 2-argument constructor (it accepts an account number and initial balance).
  • set function, one for each attribute (2 total functions, setAccount and setBalance.  Each assigns an argument value to the named member variable.
  • get function for each attribute (2 total functions, getAccount, and getBalance). Each returns the value stored in the named member variable.
  • a function to display the account’s information to the screen.  The account number and balance value should be labelled.
  • a function withdraw that takes a float argument and subtracts it from the balance.

 

  1. Write the class declaration.  Member variables should NOT be accessible outside the class!  Member functions should be accessible outside the class!
  2. Write the member function definitions for only the following functions:
    • setBalance
    • getBalance
    • withdraw

Do NOT inline the member function definitions!

Note: A driver (main function) is NOT required.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning