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
lorasvet [3.4K]
3 years ago
10

Given four values representing counts of quarters, dimes, nickels and pennies, output the total amount as dollars and cents. Out

put each floating-point value with two digits after the decimal point, which can be achieved as follows: System.out.printf("Amount: $%.2f\n", dollars); Ex: If the input is: 4 3 2 1 where 4 is the number of quarters, 3 is the number of dimes, 2 is the number of nickels, and 1 is the number of pennies, the output is: Amount: $1.41 For simplicity, assume input is non-negative.
LAB ACTIVITY 2.32.1: LAB: Convert to dollars 0/10 LabProgram.java Load default template. 1 import java.util.Scanner; 2 3 public class LabProgram 4 public static void main(String[] args) { 5 Scanner scnr = new Scanner(System.in); 6 7 /* Type your code here. */|| 8 9) Develop mode Submit mode Run your program as often as you'd like, before submitting for grading. Below, type any needed input values in the first box, then click Run program and observe the program's output in the second box Enter program input (optional) If your code requires input values, provide them here. Run program Input (from above) 1 LabProgram.java (Your program) Output (shown below) Program output displayed here
Computers and Technology
1 answer:
vesna_86 [32]3 years ago
6 0

Answer:

Replace /* Type your code here. */ with the following lines of code

int quarter =scnr.nextInt();

int dime = scnr.nextInt();

int nickel = scnr.nextInt();

int penny = scnr.nextInt();

double dollars = quarter * 0.25 + dime * 0.1 + nickel * 0.05 + penny * 0.01;

System.out.printf("Amount: $%.2f\n", dollars);

System.out.print((dollars * 100)+" cents");

Explanation:

The next four lines declare the given currencies as integer

<em>int quarter =scnr.nextInt();</em>

<em>int dime = scnr.nextInt();</em>

<em>int nickel = scnr.nextInt();</em>

<em>int penny = scnr.nextInt();</em>

This line calculates the amount in dollars

<em>double dollars = quarter * 0.25 + dime * 0.1 + nickel * 0.05 + penny * 0.01;</em>

The next two lines print the amount in dollars and cents respectively

<em>System.out.printf("Amount: $%.2f\n", dollars); </em>

<em>System.out.print((dollars * 100)+" cents");</em>

You might be interested in
1. Which of these is NOT true about Torsion Bars? A. They can be used to adjust Ride Height B. They can be adjusted anytime sinc
Strike441 [17]

My answer is B: They can be adjusted anytime since they don't affect alignment angles.

Option A is correct. Manufactures can change the Torsion bar to adjust the ride height. This is done to compensate the engine weight. Option C is  correct. The torsion’s bar acquires a twisting motion on one end of the suspension, and is firmly fixed to the car’s frame at the other end. Actually, it attaches to the lower control ARM and a cross member key on the chassis frame. Option D is also correct. When a wheel passes over a bump, the Torsion bar acquires a twisting motion on one end of an object whose other end is fixed.


7 0
3 years ago
Which character goes at the end of a line of code that starts with if?
weqwewe [10]

Answer:

Explanation:

tttttttttttt

4 0
3 years ago
List and briefly describe the 3 types of software
erastovalidia [21]
1. A [disk cleanup] utility searches for and removes unnecessary files.
2. [Back-up] - allows users to copy selected files or an entire hard disk to another storage medium.
3. [Firefox] is a web browser- a platform, which is used to browse the information via the internet.
4 0
3 years ago
Read the following code: x = currentWeight print(x - 20) What value will this code calculate?
Serga [27]

D because weight print = x and -20 is the pound loss.

5 0
3 years ago
Which type of software is offered in trial form or for a limited period of time?
kkurt [141]

The type of software which is offered in trial form or for a limited period of time is called shareware.

Software which are offered for free in trial form or for a limited time period are called shareware. They operate on the principle that once the user understands what the software can offer they will pay to use it later.

Most shareware software has built in countdowns which start as soon as you start the trial and at the end of which access is automatically revoked. They require the user to form a simple account. These versions generally provide a very basic selection of functions and are used to rake in more paying users.

Types of shareware include:

  1. Adware: It stands for advertising-supported software where the advertisements generate revenues.
  2. Demoware: This is a trial version of the original software including all features.
  3. Crippleware: This software is free but provides limited features till it is purchased.
  4. Trialware

This provides the user with full feature access for a time limit and then requires purchase.

You can learn more about shareware software at

brainly.com/question/4593389

#SPJ4

3 0
2 years ago
Other questions:
  • ASAP PLZ!!!!!! Type the correct answer in the box. Spell all words correctly What are the steps of moving data into a data wareh
    9·1 answer
  • Just giving this a shot, Which of the following statements about RAM are TRUE? Select all that apply.
    10·1 answer
  • ( answer goes here) are pictures that you can click on to tell your computer what to do.
    10·2 answers
  • A. STOP: What is a technology habit you practice today that you now realize will not help you to be successful? Explain why it’s
    10·2 answers
  • The labor market shows the:
    11·1 answer
  • which of the following sentences uses active voice?(answers to choose from are in the photo)-this is in my computer applications
    14·2 answers
  • Find the area of the regular hexagon below by using the area formula for triangles.
    7·1 answer
  • Write a 10 sentence paragraph about george washington and abraham lincoln and no plagiarism
    8·2 answers
  • PowerPoint Online automatically saves your presentation to what Office Online application? OneDocument OneDrive OneNote OneWay
    13·2 answers
  • Which of the mis systems uses both informal and formal information-gathering procedures?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!