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
While working alone at their constant rates computer X can process 240 files in 4 hours, and comp Y 240 files in 8 hrs. If all f
djverab [1.8K]

Answer:

2hrs 40 min

Explanation:

3 0
3 years ago
Read 2 more answers
A mobile device user has entered her user ID and password to access an online account. The user immediately receives a text mess
tensa zangetsu [6.8K]

Answer:

A. Multifactor authentication

Explanation:

Multifactor authentication is a security system process that requires a user to verify his or her identity by providing two categories of credentials.

A mobile device user has entered her user ID and password to access an online account, she immediately receives a text message with a unique PIN or One Time Password (OTP) that must be entered before she is granted access to the account. This is an example of a multifactor authentication security method.

8 0
2 years ago
What are the binary symbols?
alexgriva [62]

Answer:

Explanation:

a binary number is a number expressed in the base-2 numeral system or binary numeral system

4 0
2 years ago
Read 2 more answers
public class Test { public static void main(String[] args) { try { method(); System.out.println("After the method call"); } catc
USPshnik [31]

Answer:

"ArithmeticException" is the correct answer for the above question.

Explanation:

Missing Information : The above question does not hold that "what is the output of the program".

  • The above question has a class that holds the two functions one function is the main function which calls the other function in a try-catch block.
  • The method function holds one run time exception which is 1/0 which is an arithmetic exception.
  • It can be handle by the help of an arithmetic class object which is defined in the first catch block.
  • Hence the print function of this catch is executed and prints "ArithmeticException".
8 0
3 years ago
Why is a positive attitude towards work important
bezimeni [28]

Answer:

it lets you get more work done

Explanation:

when you have a positive work attitude you want to do more stuff, and when it's bad you won't want to do anything

3 0
2 years ago
Other questions:
  • Choose the correct sequence for classifier building from the following.
    7·1 answer
  • All of the following are qualities of an aprenticeship except
    12·1 answer
  • ____ indicates the number of pixels that a computer uses to display the letters, numbers, graphics, and background on a screen.
    12·2 answers
  • Read the scenario below. Explain why this is not fair use of copyright materials. What should you do instead of using the entire
    10·1 answer
  • Match the job titles to the tasks
    11·2 answers
  • When are bar charts most commonly used
    10·1 answer
  • You are a running cable in a new network. You are running a series of cables from the wiring closet to the RJ-45 ports for the c
    6·1 answer
  • What single awk command can be used to display all the login names and their associated numerical user IDs
    14·1 answer
  • Which of these are tools used to diagnose and test code? Check all of the boxes that apply.
    9·1 answer
  • Which website offers guidance on putting together a checklist to provide guidance on configuring and hardening operating systems
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!