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
Why a design that doesn't fail initially fails after some time/use? identify at least 3 such mechanisms?
alina1380 [7]
Runs out of memory
has uninitialized    variables
uses  undefined behaviour

4 0
3 years ago
write an algorithm that reads to values, determines the largest value and prints the largest value with an identifying message ​
REY [17]

Answer:

I'm unsure of what language you are referring to, but the explanation below is in Python.

Explanation:

a = int(input("Input your first number: "))

b = int(input("Input your second number: "))  

c = int(input("Input your third number: "))

maximum = max(a, b, c)

print("The largest value: ", maximum)

6 0
2 years ago
cellPhoneBill(m,tx)Write the function cellPhoneBill()that takes two int m and txas input and returns a float.The function takes
lidiya [134]

Answer:

The solution code is written in C++

  1. float cellPhone(int m, int tx){
  2.    float COST_PER_MIN = 0.1;
  3.    float COST_PER_MESSAGE = 0.2;
  4.    
  5.    float bill_amount = m * COST_PER_MIN + tx * COST_PER_MESSAGE;
  6.    
  7.    return bill_amount;
  8. }

Explanation:

Firstly, declare a function named cellPhone() that takes two input parameters, m and tx (Line 1).

Since the policy of the carrier company is not given in the question, I make a presumption that the cost per minutes is $0.10 and the cost per message is $0.20 (Line 2- 3).

Next, apply the formula m * COST_PER_MIN + tx * COST_PER_MESSAGE to calculate the total bill (Line 5) and return the bill_amount as function output (Line 7).

4 0
3 years ago
Choosing the “Quick Print” button will ____________.
harkovskaia [24]
Choosing the "Quick Print" button will print to the default print (Answer is B). The quick print function is accessible in the Quick Access Tool bar . By clicking the drop down arrow of the quick access tool bar it will let you choose different types of default access including your Quick print.
7 0
3 years ago
Which agency coordinates the internet's IP addressing and DNS systems?
german
ICANN is the agency which coordinates the internet's IP addressing and DNS systems.

ICANN stands for Internet Corporation for Assigned Names and Numbers. Aside from coordinating the Domain Name System (DNS) and Internet Protocol (IP) addresses, it also coordinates the technical protocol parameters of ARPA top level domain, Internet DNS root zone management (gTLD and ccTLD), allocates Internet number resources, and other services which will fulfill their vision of "one world, one Internet".

The performance of ICAANs services is all under a U.S Government contract.
4 0
2 years ago
Other questions:
  • A school librarian has been asked to identify inappropriate Internet usage. Which students would most likely be reported to the
    5·2 answers
  • If you specify a user without specifying a hostname, mysql will
    13·1 answer
  • A model release can be either oral or written down. true or false
    13·2 answers
  • which software is used to mimic intricate hand drawings into digital paintings? _____ is used to replicate hand drawings into di
    7·1 answer
  • Explain word processing ​
    11·2 answers
  • Given the following function definition:
    8·1 answer
  • Why is there no ide length or timing for study breaks?​
    12·1 answer
  • Explain the term game! And give me complete sentences. U can use ur opinion as well!
    11·1 answer
  • How to beat level 50 in give up robot 2
    5·1 answer
  • T/F static development is the process of constructing the programs and code modules that serve as the building blocks of the inf
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!