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.
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
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.

Trending now
This is a popular solution!
Step by step
Solved in 2 steps









