Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%
Please this due in C++
A sample run is as follows:
Cash Register
Enter the cost of item 1: $12.50
Enter the cost of item 2: $13.25
Enter the cost of item 3: $5.17
The total cost is $30.92
You used 30 dollars, 3 quarters, 1 dimes, 1 nickels and 2 pennies.
Be sure to document your code with the file name, your name and student number. Add
comments throughout the code where necessary.
Question
How would you use the modulus operator % to solve the above problem?
Lab Submission:
Please email your cash Register.c and the answer to the question to:
Transcribed Image Text:A sample run is as follows: Cash Register Enter the cost of item 1: $12.50 Enter the cost of item 2: $13.25 Enter the cost of item 3: $5.17 The total cost is $30.92 You used 30 dollars, 3 quarters, 1 dimes, 1 nickels and 2 pennies. Be sure to document your code with the file name, your name and student number. Add comments throughout the code where necessary. Question How would you use the modulus operator % to solve the above problem? Lab Submission: Please email your cash Register.c and the answer to the question to:
2
This lab simulates a cash register. The user is prompted for the cost of 3 items. The cash
register calculates the total. The cash register then gives a report as to how many
dollars, quarters, dimes, nickels and pennies are required.
80% +
This lab will test your ability to retrieve information, perform calculations, and prepare
a report.
Your program should be called cash Register.c and should run as follows:
Cash Register
Enter the cost of item 1: $<cost_item1>
Enter the cost of item 2: $<cost_item2>
Enter the cost of item 3: $<cost_item3>
The total cost is $<total_cost>
You used <num_dollars> dollars, <num_quarters> quarters, <num_dimes> dimes,
<num_nickels> nickels and <num_cents> pennies.
In the above sample run, <total_cost>=<cost_item1>+<cost_item2>+<cost_item3>
To obtain <num_dollars>, you have to multiply the <total_cost> by 100, cast the result
to an integer, then divide the result by 100.
To obtain <num_quarters>, you have to take the remainder of the above division and
divide it by 25.
To obtain <num_dimes>, you have to take the remainder of the above division and
divide it by 10.
To obtain <num_nickels>, you have to take the remainder of the above division and
divide it by 5.
<num_pennies> is simply the remainder of the above division.
H
JA
ENG
US
Transcribed Image Text:2 This lab simulates a cash register. The user is prompted for the cost of 3 items. The cash register calculates the total. The cash register then gives a report as to how many dollars, quarters, dimes, nickels and pennies are required. 80% + This lab will test your ability to retrieve information, perform calculations, and prepare a report. Your program should be called cash Register.c and should run as follows: Cash Register Enter the cost of item 1: $<cost_item1> Enter the cost of item 2: $<cost_item2> Enter the cost of item 3: $<cost_item3> The total cost is $<total_cost> You used <num_dollars> dollars, <num_quarters> quarters, <num_dimes> dimes, <num_nickels> nickels and <num_cents> pennies. In the above sample run, <total_cost>=<cost_item1>+<cost_item2>+<cost_item3> To obtain <num_dollars>, you have to multiply the <total_cost> by 100, cast the result to an integer, then divide the result by 100. To obtain <num_quarters>, you have to take the remainder of the above division and divide it by 25. To obtain <num_dimes>, you have to take the remainder of the above division and divide it by 10. To obtain <num_nickels>, you have to take the remainder of the above division and divide it by 5. <num_pennies> is simply the remainder of the above division. H JA ENG US
Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
ADT and 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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education