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
patriot [66]
4 years ago
7

I have the following assignment for Computer science class that is due tomorrow. Can someone help me to solve the code? I'm a be

ginner, so I don't have enough experience to solve the problem.
Write a program that determines the change to be dispensed from a vending machine. An item in the machine can cost between 25 cents and a dollar, in 5 cents increments (25,30,35,40,.......90,95 or 100), and the machine accepts only a single bill to pay for the item.

For example, a possible dialogue with the user might be

Enter the price of the item

(from 25 cents to a dollar, in 5-cent increment) : 45

You bought an item for 45 cents and gave me a dollar.

So your change is :

2 quarters

0 dimes, and

1 nickel.
Computers and Technology
1 answer:
DaniilM [7]4 years ago
7 0

Hello. I have a solution with comments to help you understand the code.

Brainly is bad for formatting code. Teachers often search up submitted answers using services such as search engine. Your answer has been encoded to protect you from plagiarism detection. It is very easy to view the answer for yourself.

Please go to website https://base64.io

Then copy the below text and paste it into the decode textbox in the website. Make sure you remove the part that says, "Read more on Brainly.com...". Thank you.

<em>--- COPY EVERYTHING BELOW AND PASTE INTO SITE, REMOVE THE PART THAT SAYS, "Read more on Brainly.com..." ---</em>

aW1wb3J0IGphdmEudXRpbC5TY2FubmVyOwoKcHVibGljIGNsYXNzIE15Q2xhc3MgewogICAgcHVibGljIHN0YXRpYyB2b2lkIG1haW4oU3RyaW5nIGFyZ3NbXSkgewogICAgICAgIC8vIENyZWF0ZSBTY2FubmVyIG9iamVjdCB0byByZWFkIHVzZXIgaW5wdXQKICAgICAgICBTY2FubmVyIHByaWNlc2Nhbm5lciA9IG5ldyBTY2FubmVyKFN5c3RlbS5pbik7CiAgICAKICAgICAgICAvLyBQcmludCB0byBhc2sgdXNlciB0byB0eXBlIGluIHByaWNlCiAgICAgICAgU3lzdGVtLm91dC5wcmludCgiRW50ZXIgc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gIAogICAgICAgICAgICAvLyBMb29wIGRpdmlkZSB1bnRpbCBubyBtb3JlIGRpbWVzIGFibGUgdG8gYmUgZGl2aWRlZAogICAgICAgICAgICB3aGlsZSAocHJpY2UgLyAxMCA+IDApIHsKICAgICAgICAgICAgICAgIGRpbWVzID0gZGltZXMgKyAxOwogICAgICAgICAgICAgICAgcHJpY2UgPSBwcmljZSAtIDEwOwogICAgICAgICAgICB9CiAgICAgIAogICAgICAgICAgICAvLyBMb29wIGRpdmlkZSB1bnRpbCBubyBtb3JlIG5pY2tlbHMgYWJsZSB0byBiZSBkaXZpZGVkCiAgICAgICAgICAgIHdoaWxlIChwcmljZSAvIDUgPiAwKSB7CiAgICAgICAgICAgICAgICBuaWNrZWxzID0gbmlja2VscyArIDE7CiAgICAgICAgICAgICAgICBwcmljZSA9IHByaWNlIC0gNTsKICAgICAgICAgICAgfQogICAgICAKICAgICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCJZb3VyIGNoYW5nZToiKTsKICAgICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCJRdWFydGVyczogIiAgKyBxdWFydGVycyk7CiAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigiRGltZXM6ICIgKyBkaW1lcyk7CiAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigiTmlja2VsczogIiArIG5pY2tlbHMpOwogICAgICAgIH0gCiAgICB9Cn0=

You might be interested in
18 Select the correct answer.
Elden [556K]

A string for sure, so answer B.

6 0
3 years ago
When an object is selected, it is surrounded by ________, which allow you to change the size of the object.?
boyakko [2]
Matter. because matter surrounds us all and helps us move and change. 
6 0
4 years ago
Which layer of the osi model defines functions related to data delivery, error recovery, and flow control?
Dominik [7]
Answer is the Transport Layer.
5 0
3 years ago
A hotel salesperson enters sales in a text file. Each line contains the following, separated by semicolons: the name of the clie
timama [110]

Answer:

see explaination

Explanation:

Java code

//Header file section

import java.util.Scanner;

import java.io.*;

//main class

public class SalesTestDemo

{

//main method

public static void main(String[] args) throws IOException

{

String inFile;

String line;

double total = 0;

Scanner scn = new Scanner(System.in);

//Read input file name

System.out.print("Enter input file Name: ");

inFile = scn.nextLine();

FileReader fr = new FileReader(new File(inFile));

BufferedReader br = new BufferedReader(fr);

System.out.println("Name \t\tService_Sold \tAmount \tEvent Date");

System.out.println("=====================================================");

line = br.readLine();

//Each line contains the following, separated by semicolons:

//The name of the client, the service sold

//(such as Dinner, Conference, Lodging, and so on)

while(line != null)

{

String temp[] = line.split(";");

for(int i = 0; i < temp.length; i++)

{

System.out.print(temp[i]+"\t");

if(i == 1)

System.out.print("\t");

}

//Calculate total amount for each service category

total += Double.parseDouble(temp[2]);

System.out.println();

line = br.readLine();

}

//Display total amount

System.out.println("\nTotal amount for each service category: "+total);

}

}

inputSale.txt:

Peter;Dinner;1500;30/03/2016

Bill;Conference;100.00;29/03/2016

Scott;Lodging;1200;29/03/2016

Output:

Enter input file Name: inputSale.txt

Name Service_Sold Amount Event Date

=====================================================

Peter Dinner 1500 30/03/2016

Bill Conference 100.00 29/03/2016

Scott Lodging 1200 29/03/2016

Total amount for each service category: 2800.0

3 0
3 years ago
What is Groovefunnels?
Andreyy89

GrooveFunnels is a game-changer and it’s disrupting the market quite a bit.
5 0
3 years ago
Read 2 more answers
Other questions:
  • The CPU is referred to as the ______ of the computer.
    14·2 answers
  • Georgenotfound??? question mark??
    15·2 answers
  • What is the TAG to begin a Web page, as recommended by the W3C?
    13·1 answer
  • What does the CPU do in a computer?
    7·2 answers
  • Instructions:Select the correct answer from each drop-down menu. What type of font color should Kim select if she chooses a dark
    10·2 answers
  • What is the function of a breadcrumb trail website
    7·1 answer
  • What is a single-user computer?
    8·1 answer
  • Explain the main components of a computer system​
    12·1 answer
  • To find detailed information about the origin of an email message, look at the ________________.
    11·1 answer
  • ________ take advantage of vulnerabilities in software. Group of answer choices Blended threats Bots Trojan horses Direct-propag
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!