Question

you are designing a matlab script that will function as an automated cash regisiter. the cash...

you are designing a matlab script that will function as an automated cash regisiter. the cash register will recive two inputs,the price of an item in cents, and the amount of cents payed by the customer. the cash register will then dispense change using the highest denominations of currency available ranging from 1 dollar bill to a penny

dollar = 100 cents

quarter =25 cents

dime= 10 cents

nickel=5

penny=1 cent

your program should ensure that the highest available denomiation of currency is first used. if a customer is owed 128 cents in change, you should not dispense 128 pennies.

below is a list showing the current amount of currency stored in the cash register

2 dollars

3 quarters

2 dimes

1 nickel

9 pennies

requirements

1- ask the user to enter the price of the item in cents

2- ask the user to enter the amount of cents given to pay for teh item

3-determine and display the amount of change owed based on the price of the item and the amount of cents given

4-determine and display the correct number of dollars to dispense

5- determine and display the correct number of qaurters to dispense

6-determine and display the correct number of dimes to dispense

7-determine and display the correct number of nick to dispense

8- determine and display the correct number of pennies to dispense

9- after compelting a transaction display the remaining number of dollars,quarters,nickles,dimes and pennies still stored in the cash register

10-if there is not enough availabe currency to dispense proper amount of change then inform the user the transaction is NULL

  

  

Rubric

  

-get user input for price of item in cents and amount of cents oaid for item (20 points)

  

-determine and display the amount of cents owed in change (20 points)

  

-determine and display the correct amount of dollars to return (15 points)

  

-determine and display the correct amount of quarters to return (10 points)

  

-determine and display the correct amount of dimes to return (5 points)

  

-determine and display the correct amount of nickles to return (5 points)

  

-determine and display the correct amount of pennites to return (5 points)

-Display the remaining currency stored in the machines (10 points)

plz do it in mathlab ASAP

0 0
Add a comment Improve this question Transcribed image text
Answer #1

dollars = input("Enter dollars: ")
cents = input("Enter cents: ")
dollars += floor(cents/100 )
cents = mod(cents, 100);
quarter = 0;
dimes = 0;
nickles = 0;
if cents >= 25
quarter = floor(cents/25);
cents = fmod(cents, 25);
fprintf("%d ", quarter);
if(quarter == 1)
fprintf("quarter")
else
fprintf("quarters")
end
end
if cents >= 10
dimes = floor(cents/10);
cents = fmod(cents, 10);
fprintf("\n%d ", dimes);
if(dimes == 1)
fprintf("dime")
else
fprintf("dimes")
end
end
if cents >= 5
nickles = floor(cents/5);
cents = fmod(cents, 5);
fprintf("\n%d ", nickles);
if(nickles == 1)
fprintf("nickel")
else
fprintf("nickels")
end
end
if cents > 0
fprintf("\n%d ", cents);
if(cents == 1)
fprintf("penny")
else
fprintf("pennies")
end
end

Add a comment
Know the answer?
Add Answer to:
you are designing a matlab script that will function as an automated cash regisiter. the cash...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • in c code x Global Soccer 1.docx x Acceleration Due to 6 x M Inbox (5,949)...

    in c code x Global Soccer 1.docx x Acceleration Due to 6 x M Inbox (5,949) - joshfor x M Inbox (4,224) - joshuar X ® AC ads/ACFrOgA6UB 1k4Z1i1xGLNQ1Lntj510 lutEUaA..pdf ECE 175: Computer Programming for Engineering Applications Lab Assignment #2 (Thursday sessions) Relevant Programming Concepts: • Branch Structure • Loop Problem 1 (15 points): Develop a C program that asks a user to enter a total change amount in cents) and outputs the change using the fewest coins. The coin...

  • All items at a "Penny Fair" are priced less than $1.00. Write a program that makes...

    All items at a "Penny Fair" are priced less than $1.00. Write a program that makes change with a minimum number of coins when a customer pays for an item with a one dollar bill. Prompt for the item price in cents, report the change due, and the number of coins of each denomination required. Use only quarters, dimes, nickels, and pennies for change (no 50 cent pieces). See sample output but your program should work for any item price....

  • C++ HW Question Your program will simulate a simple change maker for a vending machine. It...

    C++ HW Question Your program will simulate a simple change maker for a vending machine. It will start with a stock of coins and dollars. It will then repeatedly request the price for an item to be purchased or to quit. If given a price, it will accept nickels, dimes, quarters, one-dollar and five-dollar bills—deposited one at a time—in payment. When the user has deposited enough to cover the cost of the item, the program will calculate the coins to...

  • PLease help!!! how to type them in Python !!!! Python help!! THank you so much Problem...

    PLease help!!! how to type them in Python !!!! Python help!! THank you so much Problem 1: (20 points) Optimal change You will write a program that uses the // and % operators to figure out how to give change for a specified amount using the minimum number of coins (quarters, dimes, nickels, cents). The good news is that our currency is specifically designed to make this problem easy. For a given number of cents, first use as many quarters...

  • In C++ Consider a cash register that uses an automated machine. For the “paper money inserted”,...

    In C++ Consider a cash register that uses an automated machine. For the “paper money inserted”, and the “amount of purchase”, the machine returns “paper money and coins”. Write a program that gets from user the following “paper money inserted” and the “amount of purchase”, and display the output as: Purchase 3.08 Payment 10.00 Change 6.92 Dollars 6 Quarters 3 Dimes 1 Nickels 1 Pennies 2 Hint: - to get “dollars” and “coins” use : static_cast < int > -...

  • Write a C program that calculates exact change. In order to receive full credit, please remember...

    Write a C program that calculates exact change. In order to receive full credit, please remember that only int arithmetic is exact, so you’ll need to break up your double into two ints, the one before the decimal point and the one after the decimal point. Another point worth mentioning is that the % operator gives the remainder. In other words, when working with int values, 9 / 5 = 1 whereas 9 % 5 = 4. Keep this in...

  • Your program must meet the following specifications: 1. At program start, assume a stock of 10 nickels, 10 dimes, 10...

    Your program must meet the following specifications: 1. At program start, assume a stock of 10 nickels, 10 dimes, 10 quarters, and 10 pennies. 2. Repeatedly prompt the user for a price in the form xX.xx, where X denotes a digit, or to enter q' to quit 3. When a price is entered a. If the price entered is negative, print an error message and start over requesting either a new price or to quit (indicated by entering a 'q)...

  • In Python 3, Implement a program that directs a cashier how to give change. The program...

    In Python 3, Implement a program that directs a cashier how to give change. The program has two inputs: the amount due and the amount received from the customer. Display the dollars, quarters, dimes, nickels, and pennies that the customer should receive in return. In order to avoid roundoff errors, the program user should supply both amounts in pennies, for example 526 instead of 5.26. Enter the amount due in pennies: 828 Enter the amount received from the customer in...

  • C++ Write a program that helps a young student learn to make change. Use the random...

    C++ Write a program that helps a young student learn to make change. Use the random number generator to generate change amounts between1¢ and 99¢. Ask the user how many quarters, dimes, nickels and pennies they need to make that amount. Determine whether the coins specified by the user total the specified amount and give them feedback on their answer including whether they used the minimum or optimum number of coins to produce the amount. Sample output of a program...

  • In the U.S coin system, the penny is the basic coin, and it is equal to...

    In the U.S coin system, the penny is the basic coin, and it is equal to cent, a nickel is equivalent to 5 cents, a dime is equivalent to 10 cents, a quarter is equivalent to 25 cents, and half-dollar is equivalent to 50 cents. Design and implement a program that would make use of the functions shown below. Each function has a single int formal parameter Amount. a) HalfDollars (): Compute the maximum number of half-dollars that could be...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT