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. Engineers should not consult with experts if they do not know much about a problem.
Ganezh [65]
1. false
2. d
3. b
4. a
5. b
6.c
7. b
8.a
9. d
10. b
11. d
12.a 
13. c
14. c
15. a
5 0
3 years ago
For what reason can security risks never be fully eliminated?​
raketka [301]

Answer:

A vulnerability level of ZERO can never be obtained since all countermeasures have vulnerabilities themselves. For this reason, vulnerability can never be zero, and thus risk can never be totally eliminated.

Explanation:

also we need to be protected from scams and stuff

7 0
3 years ago
What technology is being used when you are sent an email saying you can track your package?
LuckyWell [14K]

The technology is being used when you are sent an email saying you can track your package is known to be a scan code.

<h3>What are code-scanning technology?</h3>

This is known to be called a barcode reader or simply say a barcode scanner.

It is seen as a kind of an optical scanner that tends to read printed barcodes, as well as be able to decode the data that are found in the barcode and transmit the data to a computer.

Hence, The technology is being used when you are sent an email saying you can track your package is known to be a scan code.

Learn more about scan code from

brainly.com/question/24937533

#SPJ1

4 0
2 years ago
Bruce needs to have a drive to rerecord data on the used DVD
Dahasolnce [82]

Answer:

DVD- RW

Explanation:

4 0
3 years ago
Which is the output of the formula =XOR(120&lt;102;83=83;51&lt;24)??
Greeley [361]
The output of the formula will be TRUE because '83 = 83' is the only true expression of that three expressions present in the formula.
The output of the XOR function will be TRUE in case only one logical expression is true and FALSE otherwise.
7 0
3 years ago
Read 2 more answers
Other questions:
  • What is a block cipher algorithm that operates on 64-bit blocks and can have a key length from 32 to 448 bits?
    8·1 answer
  • When creating a professional presentation, how many typefaces are recommended at the most?
    5·1 answer
  • wHAT ARE THE 5 LAYERS in the internet protocol stack andwhat are the principal responsibilities of eack of theselayers.?
    12·1 answer
  • Many people object to increased cybersecurity because _____.
    12·2 answers
  • What to buy instead of the hp chromebook 13
    15·1 answer
  • Plz answer me will mark as brainliest picture included ​
    15·1 answer
  • If you want to transfer information transform STM to LTM, it is essential that you make the information ______________________.
    9·1 answer
  • What should you do first when designing a program?
    5·2 answers
  • Who plays Pokemon Go if you do put your code in your answer so I can friend you.<br><br><br> o_o
    5·2 answers
  • What are the main security weaknesses of coaxial cable, twisted pair cable, and fiber optic cable? How might the router itself b
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!