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]
2 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]2 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
According to the video, what is the goal of Film and Video Editors?
Eddi Din [679]

Answer:

To maintain their Skills

Explanation:

The main job of video editor and film editor is to gather the raw material related to some particular topic that is provided by camera person. With the help of skills the video editor convert that raw video into finished product that will be able to broadcast.

That is the reason, he should maintain his skills to preform the video editing task accurately.

6 0
2 years ago
Read 2 more answers
Denise is working as a market analyst in a publishing house. What is her career field?
e-lub [12.9K]
Cynthia career field would be a office job such as assisting a CEO or leader of a company.
8 0
3 years ago
Read 2 more answers
Backing up and synchronization are the same thing. <br><br>A.)True<br>B.) False​
Sholpan [36]

Answer: A.)true

Explanation: This is true for a number of reasons, the first being that synced files

3 0
3 years ago
Software that interprets commands from the keyboard and mouse is also known as the
Stells [14]
A) operating system
It is going to let you "operate" it using the mouse and keyboard
4 0
2 years ago
Read 2 more answers
You want to send an email message to your friend to describe your meeting with Michal. However, you incorrectly type the name as
Gemiola [76]

Answer:

Option B.

Explanation:

The delete key is used to delete the symbol after the insertion point.

Here, Michal is typed as Michael.

So, to delete the letter e from Michael, put the insertion point before e.

If you put insertion point after the letter e or before the letter l, l gets deleted.

In no case, you can put the insertion point after the letter l.

So, option B is correct.

4 0
2 years ago
Other questions:
  • Want is the assignmment
    8·1 answer
  • Everyone’s favorite speedy blue hedgehog recently returned to his 2D origins in a critically acclaimed side-scrolling game. What
    8·2 answers
  • What is the ribbon in the word document
    5·1 answer
  • The concept of "space" on a computer usually refers to the___.​
    7·1 answer
  • is a private connection of LANs and WANs that belongs to an organization, and is designed to be accessible only by the members a
    14·1 answer
  • Which computer was part of the first generation of computers?
    14·2 answers
  • How do I contact an admin
    8·1 answer
  • Complete the steps for adding a recurring event.
    10·1 answer
  • When computer network are joined together they form a bigger network called the​
    5·1 answer
  • Vivek wants to save the data about his grocery store in a single table. Which among the following type of databases is used in t
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!