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
Xelga [282]
4 years ago
12

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:
hoa [83]4 years ago
5 0

Answer:

The corrected program is:

import java.util.Scanner;

public class LabProgram{

public static void main(String[] args) {

Scanner scnr = new Scanner(System.in);

int qtr, dime, nickel, penny;

double dollars;

System.out.print("Quarters: ");

qtr =scnr.nextInt();

System.out.print("Dimes: ");

dime = scnr.nextInt();

System.out.print("Nickel: ");

nickel = scnr.nextInt();

System.out.print("Penny: ");

penny = scnr.nextInt();

dollars = qtr * 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:

I've added the full program as an attachment where I used comments as explanation

Download java
You might be interested in
State one way the projector can be integrated into teaching and learning ​
koban [17]

Answer:

The projector con be used to show videos or pictures on a particular subject or topic to gain more understanding

4 0
3 years ago
CALL NOW $+1-855-241-6569$ aol mail not working on windows ## aol desktop gold email not working||USA||**2020*
LenKa [72]

Answer:

extra 5 points lol

Explanation:

6 0
4 years ago
The current calendar, called the Gregorian calendar, was introduced in 1582. Every year divisible by four was declared to be a l
Naily [24]

Solution :

Public Function Is a Leap_Year(Year As_Integer) As Integer

'Dim Tor_F for local variable declaring if value is t/f.

Dim TorF As For Boolean

'Pre conditions: Year > 1581 and Year < 3000

If Year > 1581 And Year <> 1700 Or 1800 Or 1900 Then

IsLeapYear = Year / 4

Else

IsLeapYear = False

TorF = False

End If

End Function

8 0
3 years ago
What is the basic purpose of the osi physical layer?.
andrew11 [14]

The basic purpose of the osi physical layer: To coordinates rules for transmitting bits.

<h3>Osi physical layer</h3>

OSI Physical layer is important as it help to coordinates the  rules for transmitting bits and it is responsible for transmitting bits from one device to another or from one computer to another.

In order for the transmission to successful take place in OSI Physical layer the bits must be encoded into signals in which the bits are then transmitted across a communication channel.

Inconclusion the basic purpose of the osi physical layer: To coordinates rules for transmitting bits.

Learn more about Osi physical layer here:brainly.com/question/24793290

3 0
2 years ago
During the conflict resolution process, which of the followings statements would be appropriate when defining the problem?
Mrac [35]
Maybe d




Idk for sure









6 0
3 years ago
Read 2 more answers
Other questions:
  • How can users create a shortcut to favorite websites and store them in their browser?
    8·2 answers
  • We want to construct a memory with 256 bytes in capacity. Assume that each byte has a unique address. (a) How many address lines
    14·1 answer
  • You were discussing software piracy with a friend and were surprised to learn how software piracy can impact your life every day
    7·1 answer
  • Which statement about creating folders is TRUE?
    15·2 answers
  • To have different formatting for odd and even rows, select the _____ option.
    8·1 answer
  • Assume a PHP document named hello.php has been saved in a folder named carla inside the htdocs folder on your computer. Which is
    11·1 answer
  • Which of the actions below will not create more room on your hard drive?
    11·1 answer
  • Write a Comparator that compares String objects by the number of words they contain. Consider any nonwhitespace string of charac
    15·1 answer
  • Anne wants to hide her age by converting it from 13 to 1101. Which number system is Anne converting to?
    13·1 answer
  • An electronic element that stores data by changing its resistance based on the current that has passed through it (similar to RR
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!