→This assignment is due by Thursday, February 19, 2026, 11:59 PM.←
→ As with all assignments, this must be an individual effort and cannot be pair programmed. Any debugging assistance must follow the course collaboration policy and be cited in the comment header block for the assignment.←
Jump To: · Rubric · Submission ·
In this assignment, we will combine everything we've learned so far with a focus on conditionals, loops, and functions that accept pointer parameters.
Overview
For this assignment, your job is to create the logic of an Automated Teller Machine. The user will be presented with a menu of options. When the user selects an option, the corresponding function will need to be called.
It may be tempting to store currency as a single floating point value. However, due to precision errors with floats we can sometimes lose money as the errors compound. Instead, it is not uncommon to store dollars and cents separately as two separate integers. This will be the approach that we take.
The Specifics
The following functions must be implemented. Here, the input corresponds to the expected parameters and the output corresponds to the expected return value.
-
- Function Name:
boot_machine - Input: None
- Output: None
- Description: Contains the logic to display the menu to the user, prompts user for selection, validate user's selection, and calls the corresponding action.
- Function Name:
-
- Function Name:
display_options - Input: None
- Output: None
- Description: Prints the menu to the user. The menu should contain four options: (1) Print balance (2) Deposit (3) Withdrawal (4) Quit.
- Function Name:
-
- Function Name:
input_choice - Input: None
- Output: Integer representing user's choice
- Description: Prompts the user to input a value corresponding to the menu selections and returns the user's choice. The user will enter a single input, ensure they provide a valid input.
- Function Name:
-
- Function Name:
show_me_the_money - Input:
- An
intpointer corresponding to the user's current dollar amount - An
intpointer corresponding to the user's current cent amount
- An
- Output: None
- Description: Pretty prints the current balance to the screen with a dollar sign and two decimal places along with a friendly message.
- Function Name:
-
- Function Name:
make_a_deposit - Input:
- An
intpointer corresponding to the user's current dollar amount - An
intpointer corresponding to the user's current cent amount
- An
- Output: None
- Description: Prompts the user to enter an amount to deposit. Validates both amounts are positive. If the amounts are positive, then modifies the user's balance appropriately.
- Function Name:
-
- Function Name:
make_a_withdrawal - Input:
- An
intpointer corresponding to the user's current dollar amount - An
intpointer corresponding to the user's current cent amount
- An
- Output:
- Description: Prompts the user to enter an amount to withdraw. Validates both amounts are positive. If the amounts are positive and there is enough money in the account to withdraw, then modifies the user's balance.
- Function Name:
With this structure, our main.cpp file will contain nothing more than:
int main() {
boot_machine();
return 0;
}
boot_machine() function. A sample run of the program is below with user input italicized for emphasis:
Welcome to the Infinite ATM!
Please make a selection:
(1) Print Current Balance
(2) Deposit
(3) Withdraw
(4) Quit
Choice: 1
You currently have $0.00.
Please make a selection:
(1) Print Current Balance
(2) Deposit
(3) Withdraw
(4) Quit
Choice: 2
How many dollars would you like to deposit? 4
How many cents would you like to deposit? 50
Thank you for depositing $4.50!
Please make a selection:
(1) Print Current Balance
(2) Deposit
(3) Withdraw
(4) Quit
Choice: 1
You currently have $4.50.
Please make a selection:
(1) Print Current Balance
(2) Deposit
(3) Withdraw
(4) Quit
Choice: 3
How many dollars do you wish to withdraw? 3
How many cents do you wish to withdraw? 0
Here is your $3.00!
Please make a selection:
(1) Print Current Balance
(2) Deposit
(3) Withdraw
(4) Quit
Choice: 1
You currently have $1.50.
Please make a selection:
(1) Print Current Balance
(2) Deposit
(3) Withdraw
(4) Quit
Choice: 3
How many dollars do you wish to withdraw? 3
How many cents do you wish to withdraw? 0
We are sorry, you have insufficient reserves in your treasure store.
Please make a selection:
(1) Print Current Balance
(2) Deposit
(3) Withdraw
(4) Quit
Choice: 3
How many dollars do you wish to withdraw? -3
How many cents do you wish to withdraw? 0
We are sorry, we are not in the business of giving away money.
Please make a selection:
(1) Print Current Balance
(2) Deposit
(3) Withdraw
(4) Quit
Choice: 3
How many dollars do you wish to withdraw? 1
How many cents do you wish to withdraw? -10
We are sorry, we are not in the business of giving away money.
Please make a selection:
(1) Print Current Balance
(2) Deposit
(3) Withdraw
(4) Quit
Choice: 2
How many dollars do you wish to deposit? -5
How many cents do you wish to deposit? 0
It seems you are trying to make a withdrawal. Perhaps try that instead?
Please make a selection:
(1) Print Current Balance
(2) Deposit
(3) Withdraw
(4) Quit
Choice: 7
It is not clear what you are trying to do.
Please make a selection:
(1) Print Current Balance
(2) Deposit
(3) Withdraw
(4) Quit
Choice: Q
It is not clear what you are trying to do.
Please make a selection:
(1) Print Current Balance
(2) Deposit
(3) Withdraw
(4) Quit
Choice: 2
How many dollars do you wish to deposit? 0
How many cents do you wish to deposit? 75
Thank you for depositing $0.75!
Please make a selection:
(1) Print Current Balance
(2) Deposit
(3) Withdraw
(4) Quit
Choice: 1
You currently have $2.25.
Please make a selection:
(1) Print Current Balance
(2) Deposit
(3) Withdraw
(4) Quit
Choice: 3
How many dollars do you wish to withdraw? 0
How many cents do you wish to withdraw? 221
Here is your $2.21!
Please make a selection:
(1) Print Current Balance
(2) Deposit
(3) Withdraw
(4) Quit
Choice: 1
You currently have $0.04.
Please make a selection:
(1) Print Current Balance
(2) Deposit
(3) Withdraw
(4) Quit
Choice: 2
How many dollars do you wish to deposit? 0
How many cents do you wish to deposit? 175
Thank you for depositing $1.75!
Please make a selection:
(1) Print Current Balance
(2) Deposit
(3) Withdraw
(4) Quit
Choice: 1
You currently have $1.79.
Please make a selection:
(1) Print Current Balance
(2) Deposit
(3) Withdraw
(4) Quit
Choice: 4
Thanks for coming!
You do not need to match the text of the prompts exactly but you must match the functionality presented above.
Functional Requirements
- Do not use global variables! If you are using a global variable in multiple functions, then you should be passing that variable into the function. If you use global variables, you will lose points so get out of the global variable shortcut habit.
- All functions must be placed in a separate file named
atmFunctions.handatmFunctions.cpp. - Do not use the
gotocommand. You will lose points for usinggoto. You must structure your conditionals, loops, and functions properly to receive full credit. - Ensure the cents are always printed with two decimal values.
- Be sure to handle the cents overflow/underflow correctly. Review the example output above for sample.
Grading Rubric
As this is an introductory C++ course that teaches the fundamental concepts of the language and implementation details of each algorithm, the use of the C++ algorithm library, lambda functions, structured bindings, and smart pointers are prohibited. The use of auto is also discouraged to be aware of the explicit type of every variable used throughout your program.
Your submission will be graded according to the following rubric:
| Points | Requirement Description |
| 0.5 | Submitted correctly by Thursday, February 19, 2026, 11:59 PM |
| 0.5 | Project builds without errors nor warnings. |
| 2.0 | Best Practices and Style Guide followed. |
| 0.5 | Program follows specified user I/O flow. |
| 0.5 | Public and private tests successfully passed. |
| 2.0 | Fully meets specifications. |
| 6.00 | Total Points |
Submission
Always, always, ALWAYS update the header comments at the top of your main.cpp file. And if you ever get stuck, remember that there is LOTS of help available.
Zip together your main.cpp, atmFunctions.h, atmFunctions.cpp, Makefile files and name the zip file A2_USERNAME.zip where USERNAME is your user id. Upload this zip file to Canvas under A2.
After submitting to Canvas, download your submission to ensure your submission is correct and complete. Submissions that are empty or contain only the starter code will not be considered.
→This assignment is due by Thursday, February 19, 2026, 11:59 PM.←
→ As with all assignments, this must be an individual effort and cannot be pair programmed. Any debugging assistance must follow the course collaboration policy and be cited in the comment header block for the assignment.←