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
enyata [817]
3 years ago
9

Write a program. Commence the change to be dispensed from a vending machine. An item machine can cost between $0.25 send a dolla

r in five cent and crew( 25 30 35 90 95 or 100 and the Machine accepts only a single dollar to pay for the item for example a possible
Computers and Technology
1 answer:
SSSSS [86.1K]3 years ago
4 0

Answer:

Explanation:

The objective of this question is to write a java program for a vending machine.

/* This program finds out what amount the vending machine is going to dispense. A given item in the machine can cost between $0.25 and a dollar in five-cent increments (25, 30, 35, 40...90, 95 or 100), and the machine accepts only a dollar bill to pay for the item. */

// Compile: javac PP10. java

// Run: java PP10

// imported the scanner class from util package.

import java. util. Scanner;

//class declaration

public class PP10 {

// main method is defined here.

       public static void main(String[]   args)

          {

// declaration of the variables.

             Scanner keyboard=new Scanner (System.in):

//taking the string type input

              int nl, amount, n2, n3, n4, n5;

            System.out.println("Enter price of item (from 20

cents to a dollar, in 5-cents) :");

             n1=keyboard. nextInt ();

            System.out.println("You bought an item for "+n1+"

cents and gave me a dollar");

            System.out.println ("so your change is ");

//the amount is first calculated.

          amount=100-n1;

// quarter value is calculated

            n2=amount/25;

// rest amount is get here.

            amount=amount%25;

// dime value is calculated

             n3-amount/10;

// rest amount is calculated

            amount=amount%10;

// value of nickel is calculated here

            n4=amount/5;

// rest amount is calculated

            amount=amount%5;

//at last the number of pennies is get

            n5=amount;

// Display output

              System. out . println(n2+" quarters") :

              System. out . println(n3+" dimes") ;

              System. out . println(n4+" nickels") ;

              System. out . println(n5+" pennies") ;

       }

  }

Output:

Enter the price of the item (from 20 cents to a dollar, in 5 - cents):

So, you bought an item for $0.45 and gave me one dollar; thus, your change is

2 quarters

0 dimes

1 nickel

0 pennies

You might be interested in
Please Help!!!<br> I keep getting this answer wrong
IgorC [24]

Answer:

I think its option a. and d.

Explanation:

option a. is right I'm sure.

option b. and c. are doubtful for me.

option d. can be true. but unlike a job letter, resumes carry a deeper view of the employee's accomplishments and qualifications.

but I still hold with option a. and b. if it's wrong please do inform, so I can refer.

5 0
3 years ago
List out two ways to execute the script.​
castortr0y [4]

Answer:

1) Execute Shell Script Using File Name. Use the shell script file name to execute it either by using it's relative path or absolute path as shown below

2) Execute Shell Script Using Source Command.

7 0
2 years ago
Read 2 more answers
What are the benefits of building blocks?
BartSMP [9]

I'm not sure if this is what you're looking for but you can benefit from using the Building Blocks feature in Word. Building blocks are pieces of document content or pre-defined items, like tables, lists, headers, and text boxes. They can be used again and again in Word files on your computer.

Hope this helps

8 0
2 years ago
Read 2 more answers
Are u a chicken nugget!!??
creativ13 [48]
Yes. Yes I would classify myself as the nugget of the chicken thank you for asking me. 
3 0
3 years ago
Read 2 more answers
PLS HELP ASAP- Select the correct text in the passage.
SCORPION-xisa [38]

Answer:

reread the text

Explanation:

I do it it helps

5 0
2 years ago
Read 2 more answers
Other questions:
  • Write the SQL statements that define the relational schema (tables)for this database. Assume that person_id, play_id, birth_year
    8·1 answer
  • Which two statements are true regarding the user exec mode? (choose two.)?
    6·1 answer
  • Double clicking a word selects the entire word?
    9·2 answers
  • The communication channel used in IMC must rev: 12_06_2018_QC_ CDR-223 Multiple Choice match the traditional channel used in tha
    14·1 answer
  • What kind of app or technology would you like to create?  Why ? <br><br><br>​
    11·1 answer
  • Which of the following is not a command for determining if MySQL is running on Linux (Ubuntu)?
    7·1 answer
  • Um ok that makes sooo much sence
    11·2 answers
  • KAPWING Video Editing Software allows you to use existing You Tube Videos in your design.
    8·1 answer
  • In disc brakes, pads are forced against the of a brake disc​
    14·1 answer
  • Which actions represent parody?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!