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
Peyton is having trouble searching for information on butter lettuce. Every time he searches for it, he gets some results for bu
Svetllana [295]

Explanation:

don't search butter lettuce it's a veggie so you say butter lettuce vegetable

7 0
3 years ago
Read 2 more answers
Which type of software coordinates the hardware and software of a computer to work efficiently and productively?
Mariana [72]
A. the operating system handles the I/O devices with the cpu, :)
7 0
4 years ago
Read 2 more answers
Date Underline the correct answer from the options. 1. How many basic input devices does a desktop computer have? .. a)2 b)3 c)
taurus [48]

Answer:

1. 3

2. D (Input Device)

3. B (File)

4. C (Microphone

7 0
2 years ago
What is the result of expression 15 > 10 > 5 in C? What is the result of the same expression in Java?
Inessa05 [86]

Answer:

java: error

C: false

Explanation:

In Java the compiler understand that you are trying to compare an integer (15) with a boolean (10 > 5) this generate the next error:

error: bad operand types for binary operator  

In C the compiler convert (15 > 10 > 5) in (15>10) > (10>5) which is equal to TRUE > TRUE, the compiler can also read it as 1 > 1 (since 1 is TRUE and 0 is FALSE).  like 1>1 is false then C program return false.

5 0
3 years ago
Create a Python program that:
Charra [1.4K]

Answer:

```

file = open("trips.txt","r")

file = file.split("\n")

trip_date = []

fuel_used = []

miles_traveled = []

for i in file:

   trip_date.append(i.split(", ")[0])

for i in file:

   fuel_used.append(i.split(", ")[1])

for i in file:

   miles_traveled.append(i.split(", ")[2])

```

This should put the data in their own lists (i didn't test it) but im not going to solve everything for you. The rest is for you to tinker with. You shouldn't throw your question at us and expect an answer. This is the most that I will give you.

Explanation:

4 0
3 years ago
Other questions:
  • The compare_strings function is supposed to compare just the alphanumeric content of two strings, ignoring upper vs lower case a
    15·1 answer
  • ASCII can be translated into over a million characters, making it a global code. True or false?
    7·2 answers
  • Which best describes the difference between stocks and bonds ?
    8·2 answers
  • A proactive computer professional will _____. have a neutral outlook toward technology underestimate the impact of technology an
    13·2 answers
  • Consider the following two implementations of the same algorithm, each written in a different language.
    11·1 answer
  • Adding _______ around calculations indicates which calculations should be performed first before following the typical order of
    6·2 answers
  • The device used to connect a network to the internet is called a
    7·1 answer
  • Every modern nation has a Central Bank. Which of the following is the Central Bank for these United States?
    14·2 answers
  • 1. The Bank manager is imposing a 10% interest rate on the new salary loan to every account in the BPI Family Bank. (ANSWER SHOU
    15·1 answer
  • What is density?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!