Create a program that calculates change after a purchase

Assignment Help Basic Computer Science
Reference no: EM13711992

Create a program that calculates change after a purchase. This will be a sequential algorithm, which is one of the simplest programming patterns. Your solution requires no branching or looping. Simply write a series of statements that will execute in order.

The program should ask for a purchase price and the amount of cash tendered. It should then determine how many of the following denomininations should be returned:
penny
$0.01
nickel
$0.05
dime
$0.10
quarter
$0.25
dollar
$1.00
five
$5.00
ten
$10.00
twenty
$20.00


Sample Run

Price of the item:
21.37
Cash tendered:
50.00
Change: 28.63
Change Left: 2863
twenties: 1
tens: 0
fives: 1
ones: 3
quarters: 2
dimes: 1
nickles: 0
pennies: 3
Notes

This program is easier if you consider the following ideas:
You'll have to figure out how much of each amount is required
You'll need to know what's left after you've accounted for each denomination
Look up the modulus operator
Modulus works better with integers
It may be better to work in pennies rather than dollars

Reference no: EM13711992

Questions Cloud

Differences between lans and wireless lans : Wireless networks have become a pervasive part of society today. Let's focus our discussion on Wi-Fi also known as the IEEE 802.11 standards group. The latest member of the 802.11 family is 802.11n. What are some immediately noticeable differe..
Draw a hierarchy chart and plan the logic : Draw a hierarchy chart and plan the logic for a program for the sales manager of The Potato Furniture Company.The manager needs a program to dertemine the profit on any item sold,input includes the wholesale price and retail price for an item ..
An ideal embedded operating system : In an ideal embedded operating system, would all non-kernel threads always execute at lower priority than interrupts? Why?
Discuss how automated cybersecurity tools : 1. Prevent, Detect, and Respond to Cyber Attacks Discuss how automated cybersecurity tools can support operations personnel as they attempt to prevent, detect, and respond to cyber-attacks against a company's networks and information systems.
Create a program that calculates change after a purchase : Create a program that calculates change after a purchase. This will be a sequential algorithm, which is one of the simplest programming patterns. Your solution requires no branching or looping. Simply write a series of statements that will exec..
Database and data warehousing design : Assignment consists of two (2) sections: a design document and a revised project plan. You must submit both sections as separate files for the completion of this assignment. Label each file name according to the section of the assignment it is ..
The officer who tagged and bagged evidence : "You receive a computer system from the officer who tagged and bagged evidence at a crime scene in suspects home. you examine the compuer and discover that it uses a SCSI drive on a windows system .
Propose remedies the law provides for the violations : Propose remedies the law provides for the violations. Write a summary of your findings. Prior summarizing, list your major findings from the discussion and this assignment in a bullet-point list. Collate all your findings in the summary keeping ..
The fundamentals of data warehousing architecture : Using academic databases such as the ACM database, IEEE database, INFORMS database, Elsevier database, or Google Scholar, locate relevant, current, and academic sources covering data warehouses and data mining. Topics can include the fundamenta..

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Write program that asks user how many students to process

Write a program that asks the user how many students to process (must be at least 1, but no more than 20) and then reads in the scores for three items, an exam average score (double number), lab average score (double number) and homework average s..

  How to motivate the employees to accept the change

You began a group project where you had to rebuild/expand your company's information and communications technology infrastructure and information system.

  Statements about current computer hardware is true

A hard disk is a type of volatile memory - Most of Intel's processors can still execute programs that were written for the 80386. When that processor was introduced in 1991, there were 275,000 transistors on the chip.

  Write program that prompts user to pick either seat or price

Write a program that prompts users to pick either a seat or a price. Mark sold seats by changing the price to 0. When a user specifies a seat, make sure it is available.

  Write a program that reads a sentace and counts the number

write a program that reads a sentace and counts the number of alpha characters using the tolower or toupper function along with the isalpha function. Then count vowels using a switch statement. Then i have to give the total number of keystrokes.

  Design an application to take and process a pizza order

Design an application to take and process a pizza order. The user should be able to make pizza order choices from listboxes, and the application should display the order price.

  Write a program in matlab and vb to ask

Write a program in Matlab and VB to ask the user the maximum error emax (e.g., 0.1, 0.01, 0.05, etc.), keep adding terms in S, until the following condition is satisfied: emax > |S - Sk| Print the minimum number of k to satisfy the above condition..

  Show layout of specified cache for cpu address memory

Show the layout of the specified cache for a CPU that can address 8M x 16 of memory. Give the layout of the bits per location and the total number of locations.

  How to display all integer values in decimal

For this first part of the project, yourMIPSsimprogram will accept a binary input fileinputfilenameand givenoperationdiswill output tooutputfilenamethe MIPS disassembly of the input file.

  You are a bank manager and you are helping

You are a bank manager and you are helping a new bank teller understand the kind of accounts the bank offers. If a customer comes in asking to open a new savings account, the teller needs to ask what kind of account-passbook savings or certificate..

  Transform g to an equivalent g'' that has no

Let G be a context free grammar with productions S->ABAC , A->aA|? , B->bB|? , C->d Transform G to an equivalent G' that has no ? productions and no unit productions

  Explain what side effect is the expression contains

Give an example in C++ of an expression whose value depends upon the evaluation order. Show the orders that produce different values and the values they produce. Explain what side effect is the expression contains.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd