1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Gemiola [76]
3 years ago
6

mips Write a program that asks the user for an integer between 0 and 100 that represents a number of cents. Convert that number

of cents to the equivalent number of quarters, dimes, nickels, and pennies. Then output the maximum number of quarters that will fit the amount, then the maximum number of dimes that will fit into what then remains, and so on.
Computers and Technology
1 answer:
Tanzania [10]3 years ago
7 0

Answer:

Explanation:

The following program was written in Java. It creates a representation of every coin and then asks the user for a number of cents. Finally, it goes dividing and calculating the remainder of the cents with every coin and saving those values into the local variables of the coins. Once that is all calculated it prints out the number of each coin that make up the cents.

import java.util.Scanner;

class changeCentsProgram {

         // Initialize Value of Each Coin

   final static int QUARTERS = 25;

   final static int DIMES = 10;

   final static int NICKELS = 5;

   public static void main (String[] args) {

       int cents, numQuarters,numDimes, numNickels, centsLeft;

       // prompt the user for cents

       Scanner in = new Scanner(System.in);

       System.out.println("Enter total number of cents (positive integer): ");

       cents = in.nextInt();

       System.out.println();

       // calculate total amount of quarter, dimes, nickels, and pennies in the change

       centsLeft = cents;

       numQuarters = cents/QUARTERS;

       centsLeft = centsLeft % QUARTERS;

       numDimes = centsLeft/DIMES;

       centsLeft = centsLeft % DIMES;

       numNickels = centsLeft/NICKELS;

       centsLeft = centsLeft % NICKELS;

       // display final amount of each coin.

       System.out.print("For your total cents of " + cents);

       System.out.println(" you have:");

       System.out.println("Quarters: " + numQuarters);

       System.out.println("Dimes: " + numDimes);

       System.out.println("Nickels: " + numNickels);

       System.out.println("Pennies: " + centsLeft);

       System.out.println();

   }

}

You might be interested in
What is a computer ?it types​
Keith_Richards [23]
Um can you be more descriptive
8 0
3 years ago
Read 2 more answers
What your roblox user >:)​
sweet-ann [11.9K]

Answer:

whats yours?

Explanation:

5 0
3 years ago
Read 2 more answers
What is a program file​
Fantom [35]

Answer:

Program Files is the directory name of a standard folder in Microsoft Windows operating systems in which applications that are not part of the operating system are conventionally installed.

Explanation:

7 0
3 years ago
Readable code includes the use of
Kobotan [32]

Answer:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBbBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBbbbbbbbbbbbbbbbbbbbbbbbbBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB

Explanation:

7 0
3 years ago
Read 2 more answers
Anybody plays mine craft
GuDViN [60]
Want to avoid giant mushrooms than stay away from dark oak and mooshroom biomes
5 0
3 years ago
Read 2 more answers
Other questions:
  • Do you like PC? Why? (I need your opinion for research)
    10·2 answers
  • 6. Which of the following is malware? (1 point)
    15·2 answers
  • The ________ phase is a technical blueprint for a whole system which captures all aspects of how the system's components will fu
    9·1 answer
  • How can you tell that you're driving in the right direction?
    14·1 answer
  • How can you continue learning about computer science and improve your coding abilities?
    5·1 answer
  • So, I have an Cru__ on this boy in school and his name is Bray but Yeah.............Can someone help me
    10·2 answers
  • Please help ASAP! will mark brianliest! 30 points!
    14·1 answer
  • The landscape layout is more appropriate for leaflet. <br> TRUE OR FALSE
    6·1 answer
  • In this paper https://arxiv.org/pdf/2008.10150.pdf, I'm having a hard time understanding how the assignment in the picture is de
    10·2 answers
  • The _________________ can be used to repair common causes of unbootable operating systems. It is based on the Windows Preinstall
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!