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
Can you please look through this code and see wants wrong with it? its in python
Ivanshal [37]
I’m confused what are you trying to ask? What is the python?
3 0
2 years ago
A user reports network resources can no longer be accessed. The PC reports a link but will only accept static IP addresses. The
Aloiza [94]

Answer: is this a real question but I think it would be Ip address hope this helps :)))

Explanation:

3 0
2 years ago
From the PC or Laptop, open a web browser and navigate to cisco. Srv. Open the link titled A small page. What is the message dis
vladimir2022 [97]

The message displayed on the page is "Hello, world". Check more about messages below.

<h3>What is computer message?</h3>

In computer science, a message is regarded as a data that is in bit size which is often transmitted from sender, to its recipient.

Conclusively, Note that when you press from the PC or Laptop, and then open a web browser and navigate to cisco. Srv. by Opening the link titled A small page, the message that would be shown on the page  is "Hello, world".

Learn more about web browser from

brainly.com/question/15243054

#SPJ1

6 0
1 year ago
Can a 3048 hp motherboard support a i7 10700k cpu?
KonstantinChe [14]

Answer:

Yes

Explanation:

6 0
2 years ago
Read 2 more answers
How can a CRM system help communicate issues in the supply chain between customers and drones?
riadik2000 [5.3K]

Answer:

CRM system can help customers about the service supplied.  

Explanation:

CRM stands for Customer Relationship Management and CRM system is a useful tool for communicating with customers.

CRM can keep the data about the order provided by the customer and has updated info about its status.

For example, if the customer of a logistics company wants to know where his/her order is, customer represantative can give up-to-date info about the order where abouts. Or the customer directly uses web to check the status of the order.

All these service can be provided by a CRM system, since drones can send its location to CRM systems.

8 0
2 years ago
Other questions:
  • Which of the following correctly describes the function of an IP address?
    7·1 answer
  • Given the variables isfulltimestudent and age, write an expression that evaluates to true if age is less than 19 or isfulltimest
    12·1 answer
  • If you work up to your potential but fall short of your goals, you
    15·2 answers
  • A company has its branches spread over five places in a state. It has become difficult for employees to transfer information and
    7·1 answer
  • PreparedStatement ps = connection.prepareStatement("select firstName, mi, lastName from Student where lastName = ?"; ps.setStrin
    5·1 answer
  • 2.7 code practice question 1 edhesive
    13·2 answers
  • Which option will automatically update copied data?
    12·2 answers
  • Which function would you use to make sure all names are prepared for a mailing label? TODAY UPPER PROPER LOWER
    11·1 answer
  • Create One print command in LOGO​
    12·1 answer
  • ) Printers today have many features that include improved quality, photo printing capabilities, digital camera connectivity, bui
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!