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
ad-work [718]
4 years ago
9

1. Write a function that will ask the user to enter a value in dollars. The function should calculate and display the equivalent

number of pennies, nickels, dimes, and quarters. Acceptable values are those which when multiplied by 100 will be exactly divisible by 50 (100*value must be exactly divisible by 50). Write a caller main function to call your function.
Computers and Technology
1 answer:
julia-pushkina [17]4 years ago
3 0

Answer:

import java.util.Scanner;

public class Main

{

public static void main(String[] args) {

   

    valueInDollars();

}

   public static void valueInDollars() {

       double currentMoney, quarters, dimes, nickels, pennies;

       Scanner input = new Scanner(System.in);

       

       System.out.print("Enter a value in dollars: ");

       currentMoney = input.nextDouble();

       currentMoney *= 100;

       quarters = (int)currentMoney / 25;

       currentMoney = currentMoney % 25;

       

       dimes = (int)currentMoney / 10;

       currentMoney = currentMoney % 10;

       

       nickels = (int)currentMoney / 5;

       currentMoney = currentMoney % 5;

       

       pennies = currentMoney;

       

       System.out.print("Quarters: " + quarters + "\n" + "Dimes: " + dimes + "\n" + "Nickels: " + nickels + "\n" + "Pennies: " + pennies);

   }

}

Explanation:

<u>Inside the function:</u>

- Declare the variables

- Ask the user for a value in dollars

- Multiply that value by 100

- Find the amount of quarters, dimes, nickels, and pennies

- Print the values

<u>Inside the main:</u>

- Call the function

You might be interested in
What service provides realtime delivery of voice or streaming media?
k0ka [10]
YouTube, Twitch, and Beam are media that you can stream on.
(If that's what you are looking for.)
8 0
3 years ago
How do I make sure I have full access to this app where do I put in payment information
marissa [1.9K]

Answer:

click on your profile and im pretty sure it says privacy information and click on that and from there it will ask you for your information

Explanation:

6 0
3 years ago
Anyone have the Dell xps 13 laptop? if not pls don't answer but if you do, how is it going for you?​
Nady [450]

I do and it’s going alright; would recommend. Here’s what I think in bullet points.

- Good aesthetic design. Weave-like texture is nice and somewhat opulent.

- Good performance; you can overclock the i7 CPU.

- Battery life is at the upper end of the spectrum.

- No USB Type A Ports, big downside.

- Graphics are about 1000 points above industry average (3D Mark Fire Spark)

- Uses an SSD rather than a HDD; much quicker load time.

- I’d go for the $1,899 personally; it’s worth the extra money.

Thanks.

3 0
3 years ago
Read 2 more answers
Can u guys tell me what is the definition of umbra​
oksian1 [2.3K]

Answer:

the fully shaded inner region of a shadow cast by an opaque object, especially the area on the earth or moon experiencing the total phase of an eclipse.

Explanation:

i go.ogled it

5 0
3 years ago
Read 2 more answers
In an array list the time complexity of the remove function is identical to the time complexity of the ____ function.
yaroslaw [1]

Answer:

C. is Full

Explanation:

In an array list the time complexity of the remove function is identical to the time complexity of the ''isFull'' function.

3 0
4 years ago
Read 2 more answers
Other questions:
  • What is one word for inventiveness uncertainty and futuristic
    5·1 answer
  • What operating system was most commonly used by early personal computers? Apple Mac MS-DOS Windows
    6·2 answers
  • Smartphones can have virtual keyboards or physical keyboards. What are 3 advantages and disadvantages to each one?
    13·1 answer
  • _____ allow(s) a user to double click with the mouse in a document to move the insertion point to a new location.
    11·1 answer
  • Word provides an undo button that can be used to cancel the most recent command or action. true or false.
    10·2 answers
  • A function defined beginning with void SetNegativesToZeros(int userValues[], ... should modify userValues such that any negative
    12·1 answer
  • Which of these is one of the primary concerns for protecting your family when online?
    9·2 answers
  • What is information technology?
    9·1 answer
  • ________ was one of the first uses of the Internet
    15·2 answers
  • How much weight does a headgear need to carry
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!