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
6.4 Predicting Prices of Used Cars. The file ToyotaCorolla.csv contains data on used cars (Toyota Corolla) on sale during late s
Brums [2.3K]

Answer:

Compare the predictions in terms of the predictors that were used, the magnitude of the difference between the two predictions, and the advantages and disadvantages of the two methods.

Our predictions for the two models were very simmilar. A difference of $32.78 (less than 1% of the total price of the car) is statistically insignificant in this case. Our binned model returned a whole number while the full model returned a more “accurate” price, but ultimately it is a wash. Both models had comparable accuracy, but the full regression seemed to be better trained. If we wanted to use the binned model I would suggest creating smaller bin ranges to prevent underfitting the model. However, when considering the the overall accuracy range and the car sale market both models would be

Explanation:

8 0
3 years ago
The following is a sequence of undo-log records written by two transactions T and U: &lt; START T&gt;; ; &lt; START U&gt;; ; ; ;
tatiyna

Answer:

Giving that: The following is a sequence of undo-log records written by 2 transactions T and U:

< START T >;

< T,A,10 >;

< START U >;

< U, B, 20 >;

< T, C, 30 >;

< U, D, 40 >;

< Commit U >;

< T, E, 50 >;

< Commit T >;

1. < START U >

      Recovery action in this case will be undo(-1) and undo(0). All restored to its original Value

     log records < T, A, 10 >,  < T, abort >; as written out

2. < T, E, 50 >

      Recovery action in this case will be undo(8) and redo(0). A and C is restored to its original value, B and D are set to 20 and 40

      log records <T, C, 30 >,  < T, A, 10 >,  < T, abort >  are written out

3. < Commit T >

      Recovery action in this case will be redo(7) and redo(4). A and C are set to 10 and 30, B and D are set to 20 and 40

7 0
3 years ago
Which of the following is the most significant outcome of the formation of the SMPTE?
olga55 [171]

Answer:

The SMPTE created an organized system of film technology, development, and distribution.

Explanation:

The SMPTE opened the door for Union organization within the film industry is true but not the most significant outcome of the formation of the SMPTE. However, the second option is certainly the most significant outcome as SMPTE is the most organized system of film technology, development, and distribution. And the other two options are also correct but the most significant outcome of the formation of the SMPTE is the second option.

7 0
2 years ago
Collins and quillian explained the results of priming experiments by introducing the concept of _____ into their network model.
insens350 [35]
<span>Spreading Activation This is a model of working memory, which can be otherwise called here and now memory in lay man's term, that tries to clarify how the mind forms related thoughts, particularly semantic or verbal ideas. The spreading enactment show is one way intellectual clinicians clarify the preparing impact, which is the noticeable wonder that a man can all the more rapidly review data about a subject once a related idea has been presented. As indicated by this model, semantic long haul memory comprises of a huge, interrelated system of ideas. At the point when a man is given any idea, the ideas most firmly associated with it are initiated in that individual's psyche, getting ready or "preparing" him or her to review data identified with any of them</span>
4 0
3 years ago
What type of software can you run to help fix computer problems?
GarryVolchara [31]

Answer:

IOBit Driver Booster.

Explanation:

3 0
3 years ago
Read 2 more answers
Other questions:
  • Which of the following is the best example of a manager with a delegator leadership style
    10·2 answers
  • ____ steganography places data from the secret file into the host file without displaying the secret data when you view the host
    9·1 answer
  • How to simplify???? 2(-3x^2+6x+1)-2(4x^2-3x+1)<br><br>​
    7·1 answer
  • Network topology is a direct representation of
    9·1 answer
  • To switch from one open document to another, press _____.
    6·1 answer
  • Convert the decimal integer, 353.87510 to each of these forms:
    9·1 answer
  • Algorithm to calculate the area of a square.​
    6·1 answer
  • ¿En qué año se funda lego?
    5·1 answer
  • Submit your business presentation that clearly compares and contrasts three different cell phone service plans. I have TO HAVE I
    14·1 answer
  • What type of platform is SAP?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!