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]
3 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]3 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
Ashley Baker has been the webmaster for Berryhill Finance only ten days when she received an e-mail that threatened to shut down
Natasha_Volkova [10]

Answer:

cyber-extortion

Explanation:

Ashley Baker has been the webmaster for Berryhill Finance only ten days when she received an e-mail that threatened to shut down Berryhill's website unless Ashley wired payment to an overseas account. Ashley was concerned that Berryhill Finance would suffer huge losses if its website went down, so she wired money to the appropriate account. The author of the e-mail successfully committed cyber-extortion.

7 0
3 years ago
2) What is the value stored in the variable z by the statements below?
Dmitriy789 [7]

Answer:

7

Explanation:

Because the q.length is a inbuilt function in the programming which used to get the length of the array. In the array, there are 7 values are store. Therefore, the size 7 store in the variable z.

For example:

int[] array={1,2};

int x = array.length;

the answer of above code is 2, because the elements present in the array is 2.

 

5 0
3 years ago
A hardware component that keeps data and information when the device is not powered is called a ____ device.
serious [3.7K]

It should be noted that the hardware component that keeps data and information when the device is not powered is called a storage device.

This device can be permanent or temporary storage device.

<h3>What is a storage device?</h3>

Storage device can be regarded as the device that store data.

There are different storage devices for the computer system, they includes;

  • Optical Storage Devices.
  • External HDDs
  • Random Access Memory
  • Flash memory devices.
  • Floppy Disks.

Learn more about storage device at ;

brainly.com/question/21283135

5 0
2 years ago
Write a JavaScript program to generate the following pattern but the number of rows should be user input.
Nookie1986 [14]

Answer:

Testicles

Explanation:

u sukkk

3 0
3 years ago
What is communication barriers?​
SSSSS [86.1K]

Answer:

A communication barrier is anything that prevents us from receiving and understanding the messages others use to convey their information, ideas and thoughts.They can interfere with or block the message you are trying to send.

7 0
3 years ago
Read 2 more answers
Other questions:
  • Esther has acquired an associate's degree in information technology and certifications in PageMaker and Illustrator. Which caree
    8·2 answers
  • The approved systems design document is used by programmers, the personnel department, and information systems personnel.
    8·1 answer
  • 5. Pins on Pinterest can be linked to
    8·1 answer
  • Using C#, declare two variables of type string and assign them a value "The "use" of quotations causes difficulties." (without t
    11·1 answer
  • Write a program Gas.java that computes and displays the price a person will pay for gas at the gas station. The program takes th
    12·1 answer
  • In the game of $Mindmaster$, secret codes are created by placing pegs of any of seven different colors into four slots. Colors m
    5·1 answer
  • Which of the following sentences use personification 
    9·1 answer
  • 8.10 Code Practice Question 3
    6·1 answer
  • Write a static method reOrder56(int[] nums) that return an array that contains exactly the same numbers as the given array, but
    10·1 answer
  • A photographer stores digital photographs on her computer. In this case the photographs are considered the data. Each photograph
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!