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
Write a program using integers user_num and x as input, and output user_num divided by x three times.Ex: If the input is:20002Th
HACTEHA [7]

Answer:

Following are the code to the given question:

user_num = int(input())#defining a variable user_num that takes input from user-end

x = int(input())#defining a variable x that takes input from user-end

for j in range(3):#defining for loop that divides the value three times

   user_num = user_num // x#dividing the value and store integer part

   print(user_num)#print value

Output:

2000

2

1000

500

250

Explanation:

In the above-given program code two-variable "user_num and x" is declared that inputs the value from the user-end and define a for loop that uses the "j" variable with the range method.

In the loop, it divides the "user_num" value with the "x" value and holds the integer part in the "user_num" variable, and prints its value.  

5 0
2 years ago
alex needs to email his graduation certificate to a prospective employer. he has only physical copies of the certificate. what d
svlad2 [7]
He should use a scanner, which would convert an image into an electronic file.
7 0
2 years ago
When backing up a database server to LTO tape drives, the following schedule is used. Backups take one hour to complete.
AleksandrR [38]

Answer:

C. 3

Explanation:

Linear Tape Open LTO tape drives are magnetic tapes used to store data. This can be used with small and large computers for backup purposes. The backup needs to maintained frequently so that new data is backup on every interval. The is a RAID failure on database server to ensure complete backup there must be 3  backup tapes needed.

4 0
3 years ago
Which type of button turns a feature on and off
densk [106]
D. Toggle
Toggle switches whatever the current control is.
8 0
2 years ago
Which of the following is an absolute cell reference
rodikova [14]

Answer:

The content of the cell is called an absolute cell reference.

Explanation:

Ms-excel can hold a value or string or number or formulas in each cell.  

The end-user can input the values to a cell and do any calculation by using inbuilt formulas and do the necessary calculation and get the output in the required cell  

When end-user try to copy and paste the data to another cell he or she can use paste special option where he or she can select values, by selecting values to end-user is just copying the data not formula this is called absolute reference of the cell

By using paste special end users copy the image or Unicode also.

This process is called an absolute cell reference

6 0
3 years ago
Other questions:
  • Yes, because it allows many users to get together and work to help project their services.
    14·1 answer
  • In cell R9, enter a formula using the AVERAGEIF function to determine the average number of years of experience for lifeguards.
    12·1 answer
  • When planning the structure of a spreadsheet, columns are for _______ items and rows are for _______ items.
    5·2 answers
  • Regulatory and informational markers are easily identified through which features
    12·1 answer
  • DEFINE WHAT COPYRIGHT?
    14·2 answers
  • What does this mean, i am so confused- Explain the importance of identifying the purpose/use for pre-production documents
    9·1 answer
  • What is software and explain the five types of software
    5·2 answers
  • Moving your Sprite from right to left is considered the X coordinate?
    5·1 answer
  • Question #2: How would you demonstrate professionalism in a video call with a teacher? Edmentum Digital world Please Help!!
    8·1 answer
  • joe is in the planning stages to make sure that an upcoming company promotion during a major sporting event will not overwhelm h
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!