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
Your team has been asked to design a LAN for a very successful CPA firm with five departments in one building and a total of 560
ziro4ka [17]

Answer:

Please find in attachment.

Explanation:

The details in attachment are self explanatory.

Download docx
5 0
3 years ago
What is the absolute pathname of the YUM configuration file? REMEMBER: An absolute pathname begins with a forward slash
ale4655 [162]

Answer:

/etc/yum.conf

Explanation:

The absolute pathname for YUM is /etc/yum.conf. The configuration file For yum and related utilities can be found there. The file has one compulsory section, and this section can be used to place Yum options with global effect, it could also have one or more sections, that can enable you to set repository-specific options.

4 0
3 years ago
Describe the impact of improvement ls in technology and transportation on american citizens. ​
EastWind [94]

Answer:

How did technology affect the growth of cities and housing within them? ... Advances in technology and greater business efficiency and productivity further expanded the variety of goods and services within their reach. The growing middle class also supported an expansion of higher education.

Explanation:

6 0
2 years ago
Which of the following is an example of a federal tax? A. Social Security tax B. Sales tax C. Property tax D. Transaction tax
Nastasia [14]
Property tax should be the correct answer
6 0
3 years ago
Which type of address is the ip address 232. 111. 255. 250?.
Nitella [24]

Answer:

It is either an internal IP address or it is a private IP address.

Explanation:

6 0
2 years ago
Other questions:
  • The IP address 129.53.82.20 falls under what class of IP addresses??
    5·2 answers
  • An example of how a merge field will appear in a document is ______.
    7·2 answers
  • In an oligopolistic market, consumer choice is?
    12·2 answers
  • Write a program that allows two players to play a game of tic-tac-toe. Use a two dimensional char array with three rows and thre
    7·1 answer
  • What do you need for digital photography? 1. 2. 3.
    13·1 answer
  • Which documents might an employer expect to find in a career portfolio?
    15·2 answers
  • In _____, a program running on a Web server creates a Web page in response to a request for specific information from a Web clie
    7·1 answer
  • The main difference between \f and \r is that \f produces a
    13·1 answer
  • 4.3 Code Practice: Question 1
    12·2 answers
  • Mention any
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!