Question
Suppose You Have A Number Of Coins In Your Pocket: Pennies, Nickels, Dimes, And Quarters. In This Lab Assignment, You Will Write A Program To
Suppose you have a number of coins in your pocket: pennies, nickels, dimes, and quarters. In this lab assignment, you will write a program to determine the total value of those coins.
The finished program should look like the following (the underlined numbers in bold are examples of inputs typed by the user your program will not underline the user's inputs or show them in bold):
Enter number of quarters: 7
Enter number of dimes : 6
Enter number of nickels : 4
Enter number of pennies : 5
With 7 quarter(s), 6 dime(s), 4 nickel(s) and 5 penn(y/ies),
you have $2.60 in change.
Start by creating an analysis for the program that includes an IPO chart and list of relevant formulas. Also complete and include a table of test data like the following, adding two more examples:
quarters | dimes | nickels | pennies | total |
4 | 3 | 7 | 2 | |
3 | 7 | 1 | 4 | |
1 | 4 | 3 | 1 | |
Once you have completed your analysis and created your test data, write a C++ program that determines the total amount of the coins input by the user.
Your program must separate input, processing, and output into at least three independent modules that are called in sequence by the main module.
Match the format of the sample run shown above as closely as possible. Your input module should prompt the user as in the first four lines of the sample, then your output module should display the results as in the last two lines.
Source Code Style
Source code should be presented neatly, with appropriate indenting and white space, and without long lines that would wrap awkwardly when printed. Indent using spaces, rather than tab characters.
If you have a line of code that exceeds eighty (80) characters, break the line at an appropriate location and then indent to show that the remainder of the line is a continuation of the previous line. The instructor will print your code to a file so that comments can be written on it as needed; the width of this printer is slightly more than eighty characters.
Points may be deducted for source code that is messy or otherwise difficult to read.
Submission Guidelines
All materials must be typed. Submit your analysis and table of test data as a PDF file, along with a copy of your program source code file, using the Submit Assignment button in Canvas by 11:59pm on the due date.
Remember to submit all files at the same time, or it may not be apparent that you've submitted all parts of the assignment. (If you make a mistake, or realize before the assignment is due that you need to make a correction, be sure to resubmit all files.)
Scoring Guide
Here's what your instructor will be looking for when grading your assignment:
- The IPO chart is complete and accurate.
- The IPO chart follows the style introduced in the lecture notes for Week #3.
- All the major variables are listed, one per row.
- All variables have been given valid names and meaningful data types.
- Data type names are listed as Integer, Float, Character, String, or Boolean only; rather than using language-specific type names.
- The Float type is not used for variables whose values will only be whole numbers; the Integer type is not used for variables whose values may reasonably have a fractional part.
- All variables are correctly identified as input, processing, and/or output.
- For each variable identified as processing in the IPO chart, there is a formula showing how its value is computed or otherwise obtained.
- A single case style is used for all variable names (e.g., lowercase with underscores or camel casing).
- The selected case style is used consistently for variable names in the IPO chart, formulas, and source code.
- The same variable names listed in the IPO chart are used in the formulas and source code.
- Data types used for variables in the source code correspond to those listed in the IPO chart.
- Correct totals are listed for the three given rows.
- Two additional rows of meaningful test data are provided; cases that would result in meaningless results are avoided, such as negative inputs.
- The header is complete, containing information as in the examples given in the lecture notes.
- Each module (other than main) is documented with a description of its role or purpose.
- If variable names are not self-documenting (i.e., cryptic or having potentially ambiguous abbreviated names), then comments are used to provide descriptions of each variable's role or purpose when they are declared.
- Additional comments are included as needed to help explain any unusual portions of the code (i.e., things about the underlying algorithm itself or individual steps that might not be understood by a reader even one who is familiar with C++).
- The program includes an independent input, processing, and output module.
- These modules are called in an appropriate sequence by the main module.
- Each module performs tasks in keeping with the IPO chart (e.g., values for variables flagged as input are obtained by the input module).
- Proper parameter syntax is used; in C/C++, the ampersand (&) only appears on out parameters.
Submissions whose programs do not compile without errors, do not use a modular style (i.e., all of the program code appears in the main module), or contain any of the items listed below, will receive a grade of zero:
- Global variables
- Selection statements, repetition statements, return statements (excepting the optional return 0; at the end of main), arrays, structs, or classes.
- The line using namespace std;
- Inclusion of libraries that are specific to a particular operating system, or use of their commands
- Calls to the system function
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started