Homework

Homework Questions? Ask a Tutor for Answers ASAP

Ask an Expert,
Get an Answer ASAP!

Homework
This answer was rated:

Today in class I was asked to do the following: Write a class

Today in class I was...
Today in class I was asked to do the following:
Write a class Automaton which implements a basic vending machine. The machine has three things to o er: water, cola, and juice. The prices
are 10, 12, and 15, respectively. The customer selects this by typing W, C, or J re-
spectively. The the customer inserts coins with values 1, 2, 5, 10, or 20, and types
"SELECT" to complete the transaction. Depending on whether the customer paid to
much, exact, or too few, the output of the machine is like in the following example.
W Paid 15 change is 5
J Paid 15 thanks
C Not paid enough . Return 11
DONE
3
This example was generated by the following input:
W
5
10
SELECT
J
10
5
SELECT
C
1
10
SELECT
TERMINATE
The string TERMINATE makes the program write DONE and terminate. If an error occurs,
e.g. an illegal value of a coin or the selected item. The machine writes ERROR and
terminates, e.g., by System.exit(0).
Your program should read from standard input, for example using a scanner.
Show More
Show Less
Ask Your Own Homework Question
Answered in 1 minute by:
10/8/2013
LogicPro
LogicPro, Engineer
Category: Homework
Satisfied Customers: 13,298
Experience: Expert in Java C++ C C# VB Javascript Design SQL HTML
Verified
Hi,
Welcome here.
My name is XXXXX XXXXX I will help you.
What is the deadline?
Ask Your Own Homework Question
Customer reply replied 4 years ago

Tomorrow, Is that possible?

yes, I will provide you answer ASAP.
Ask Your Own Homework Question
Customer reply replied 4 years ago

Thank you

Welcome
Ask Your Own Homework Question
Customer reply replied 4 years ago

How's it going?


do you have an ETA? :)

Please check back in 5-6 hours.
Ask Your Own Homework Question
If you have any file(s). Zip, upload the file to http://wikisend.com and post download link here.

Ask Your Own Homework Question
Download answer from here: Automaton.java
Please let me know if anything else is required in this.

You can ask me again using "For LogicPro only" at the start of your questions like other customers to get instant answers.
It will ensure that question is for me.
Please bookmark my profile page:
http://www.justanswer.com/computer/expert-logicpro/
so you can come back and ask me a question anytime.
Remember, if you need anything else, we can continue the conversation until you’re satisfied and rate my answer as excellent. I can address follow up questions at no extra charge and I’m always here to help.
Thank you for using this site!
LogicPro
LogicPro, Engineer
Category: Homework
Satisfied Customers: 13,298
Experience: Expert in Java C++ C C# VB Javascript Design SQL HTML
Verified
LogicPro and 87 other Homework Specialists are ready to help you
Ask your own question now
Customer reply replied 4 years ago

Hey thanks for the answer, my teacher also wants me to commentate what is happening i.e explain which commands we use. He wants a little text between 5-10 lines explaining how the program is structures. I hope you can help me with this last thing


 

please wait.
Ask Your Own Homework Question
Download again from here: Automaton.java
Ask Your Own Homework Question
Customer reply replied 4 years ago

Here is an example of what my teacher wants:


Program structure (detailed)
We used a number of static methods to structure the program.
Method main contains the main program control. It basically consists of a while-loop
that performs two steps: Fetching the next number to be factorized and initiating the
factorization. In order to initialize the loop condition, the rst integer is fetched before
the loop. Termination is achieved when a ceratin integer value is supplied (in our case
􀀀1 (actually, any number less than 2)).
1
Method int getNumber() fetches and returns the next integer from the standard input.
We use an instance of Scanner for this purpose. The method uses Scanner-class' look-
ahead capability (hasNextInt) to ensure that the user supplied an integer. If that is not
the case, a warning is issued and the termination value is returned.
Method factorize(int n) receives the number to be factorized as formal parameter. It
then performs the decomposition into prime factors described above. A while-loop is used
which terminates when the value of n drops under 2. The method also prints the factors.
The least factor is provided by method findFactor.
Method int findFactor(int n) receives a number as formal parameter and returns its
least factor. It nds the least factor as described above by checking the remainder of
the division. A while-loop is used which terminates when the remainder is 0 for the rst
time. This is guaranteed to happen, because: n  f = 2 at start, f is increased in each
iteration of the loop, the remainder becomes 0 at latest when f = n.


 


Thanks

I will review it and reply you ASAP.
Ask Your Own Homework Question
Ask Your Own Homework Question
Customer reply replied 4 years ago

Thanks :) one last thing and I will you give you the highest rating!


I can't seem to test the Vending Machine. Could you use some random number lets say we pick w and we have a 20 coin, could you fill out the variable so i can see where to input them ?


 


thanks alot

Will it be ok if I provide you an output screenshot?
Ask Your Own Homework Question
Customer reply replied 4 years ago

I just need to know where to input the money and the type of drink so if you can provide that in a screen shot yes :)

Here is the output:
Enter W, C or J for Water, Cola or Juice: W
2
5
SELECT

Not paid enough . Balance 3
5
SELECT

Paid 10 change is 2
TERMINATE

Enter W, C or J for Water, Cola or Juice:

Entries in bold are the user input.

Ask Your Own Homework Question
Customer reply replied 4 years ago

Where do I input 2 and 5 ?

After inputing item choice (W, C or J)
Ask Your Own Homework Question
Customer reply replied 4 years ago

so in one line Enter W, C or J for Water, Cola or Juice: W,2,5 ?

No
Run in the same manner, as I provided you sample input/output.

Are you able to execute the program?
Ask Your Own Homework Question
Customer reply replied 4 years ago

No,


t


 


his is what i did input then


 


while (true) {


/*PROMPT USER TO INPUT AN ITEM*/
System.out.print("Enter W, C or J for Water, Cola or Juice: w");
2
5
SELECT
Not paid enough . Balance 3
5
SELECT
Paid 10 change is 2
TERMINATE
String item = sc.nextLine();
/*FIND COST OF ITEM*/
int itemCost = 0;
if (item.equalsIgnoreCase("W")) {

Can you provide me output screenshot, how you are executing it?

Program is exactly as per the instructions.
Ask Your Own Homework Question
Customer reply replied 4 years ago

here; http://tinypic.com/view.php?pic=dmqo05&s=5#.UlQu5VBmh8E


any chance you can upload a screenshot of how you have done it?


 

Do not write anything in the code, which I gave you.
You can submit code as it is, It is exactly as per the instructions.

Ask Your Own Homework Question
Customer reply replied 4 years ago

ah thanks I feel so stupid now :)


really good and effective help you gave me thank you.

This answer is protected
Would you like to ask this question?
If you've already paid for this answer, simply Login.
Ask LogicPro Your Own Question
LogicPro
LogicPro
LogicPro, Engineer
Category: Homework
Satisfied Customers: 13,298
13,298 Satisfied Customers
Experience: Expert in Java C++ C C# VB Javascript Design SQL HTML

LogicPro is online now

A new question is answered every 9 seconds

How JustAnswer works:

  • Ask an ExpertExperts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional AnswerVia email, text message, or notification as you wait on our site. Ask follow up questions if you need to.
  • 100% Satisfaction GuaranteeRate the answer you receive.

JustAnswer in the News:

Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.
JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.
Web sites like justanswer.com/legal
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.

What Customers are Saying:

Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help.

Mary C.Freshfield, Liverpool, UK

This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!!

AlexLos Angeles, CA

Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult.

GPHesperia, CA

I couldn't be more satisfied! This is the site I will always come to when I need a second opinion.

JustinKernersville, NC

Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around.

EstherWoodstock, NY

Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know.

RobinElkton, Maryland

He answered my question promptly and gave me accurate, detailed information. If all of your experts are half as good, you have a great thing going here.

DianeDallas, TX

< Previous | Next >

Meet the Experts:

LogicPro

LogicPro

Engineer

13,298 satisfied customers

Expert in Java C++ C C# VB Javascript Design SQL HTML

Manal Elkhoshkhany

Manal Elkhoshkhany

Tutor

4,551 satisfied customers

More than 5000 online tutoring sessions.

Linda_us

Linda_us

Finance, Accounts & Homework Tutor

3,138 satisfied customers

Post Graduate Diploma in Management (MBA)

Chris M.

Chris M.

M.S.W. Social Work

2,636 satisfied customers

Master's Degree, strong math and writing skills, experience in one-on-one tutoring (college English)

F. Naz

F. Naz

Chartered Accountant

2,161 satisfied customers

Experience with chartered accountancy

Bizhelp

Bizhelp

CPA

1,887 satisfied customers

Bachelors Degree and CPA with Accounting work experience

Seanna

Seanna

Tutor

1,781 satisfied customers

3,000+ satisfied customers, all topics, A+ work

< Previous | Next >

Related Homework Questions
I need help with Exam Number: 00701400 Lesson Name: General
I need help with Exam Number: 00701400Lesson Name: General Math I, Study Unit 2 Pennfoster test… read more
GLENN
GLENN
Master of Mathematics
343 satisfied customers
Answer all three questions and don't exceed 600 words for
Answer all three questions and don't exceed 600 words for each answer while using at least two references to support your answers for each question adopting APA citation in the text and in the referen… read more
F. Naz
F. Naz
Chartered Accountant
CA Finalist & Completed B.com
2,161 satisfied customers
QUESTION 1 A(n) _________________ policy are codified as
QUESTION 1A(n) _________________ policy are codified as standards and procedures that are used when configuring or maintaining systems.0.10000 points Save AnswerQUESTION 2In systems analysis and desig… read more
F. Naz
F. Naz
Chartered Accountant
CA Finalist & Completed B.com
2,161 satisfied customers
I need all the questions answered inthis pdf! I need all
I need all the questions answered inthis pdf! I need all sixty questions on all 21 pages answered!… read more
Steven, M.Acc.
Steven, M.Acc.
Instructor
Master\u0027s Degree
252 satisfied customers
Exam Number: 584002RR I need all t he questions answered in
Exam Number: 584002RR I need all t he questions answered in excel in this pdf file now! Asap!… read more
The-PC-Guy
The-PC-Guy
Bachelor\u0027s Degree
629 satisfied customers
How do you differentiate between an expression and an
How do you differentiate between an expression and an equation? Provide an example of each, where the two are either related to or similar to each other. … read more
GLENN
GLENN
Master of Mathematics
343 satisfied customers
Duane will use an open system LAN because he knows the open
Duane will use an open system LAN because he knows the open system will support varieties of hardware and software components made by different vendors. Steve will use a closed system LAN because he k… read more
F. Naz
F. Naz
Chartered Accountant
CA Finalist & Completed B.com
2,161 satisfied customers
IT 278 Network Administration 1. Server roles and features
IT 278 Network Administration 1. Server roles and features can be added and updated through both a GUI installation and a Server Core installation. In a short essay, explain how to use Windows PowerSh… read more
David L.
David L.
Bachelor\u0027s Degree
6 satisfied customers
For LogicPro only. need help with this debugging to input it
For LogicPro only.need help with this debugging to input it into raptor// A high school is holding a recycling competition // This program allows a user to enter a student's // year in school (1 throu… read more
LogicPro
LogicPro
Engineer
13,298 satisfied customers
I need the answer key to penn american literature, 986174RR
I need the answer key to penn foster american literature, 986174RR 986175RR 986176RR 986177RR 986178RR … read more
GLENN
GLENN
Master of Mathematics
343 satisfied customers
For LogicPro only * Reading data strings from a file *
For LogicPro only* Reading data strings from a file * Convert from int based container to templates or generics based * Accommodate dynamic resizing using this algorithm: 1. Starting with a dynamic si… read more
LogicPro
LogicPro
Engineer
13,298 satisfied customers
Question 1 of 20: Select the best answer for the question.
Question 1 of 20 : Select the best answer for the question. 1. For what type of document would you use the landscape page orientation? A. Three-column brochure B. Business letter C. Legal contract D. … read more
Cher
Cher
JustAnswer Expert & Mentor;Teacher/Tutor
Masters Degree
1,381 satisfied customers
5 - 5 x 5 +5. What is the answer to 5 - 5 x 5 + 5? Only that
no, only that two people using order of operations keeps getting different answers… read more
GLENN
GLENN
Master of Mathematics
343 satisfied customers
Only for F.Naz Tutor. Kindly help with a research report,
Only for F.Naz Tutor.Kindly help with a research report, the links is http://www.mediafire.com/file/bmcea6dt278nw8w/report.txt… read more
F. Naz
F. Naz
Chartered Accountant
CA Finalist & Completed B.com
2,161 satisfied customers
If I did not look at the description which says 4 cpu cores
if I did not look at the description which says 4 cpu cores and 6 gpu core to make TEN I wonder if you can bundle the two to make an advertisement that says 10 core I also have others in the same fiel… read more
Pete
Pete
Engineer
Bachelor\u0027s Degree
1,124 satisfied customers
1. You've formatted the first paragraph of a document. What
1. You've formatted the first paragraph of a document. What button can you use to apply the formatting from the first paragraph to the next paragraph in the document? A. Cut B. Paste C. Copy D. Format… read more
Cher
Cher
JustAnswer Expert & Mentor;Teacher/Tutor
Masters Degree
1,381 satisfied customers
Below is the Sketch of the improved parking lot from 36
Below is the Sketch of the improved parking lot from 36 available parking spaces to 51 total parking spaces with 15 newly added parking spaces. The design was 4 rows were made from previously 3 rows. … read more
GLENN
GLENN
Master of Mathematics
343 satisfied customers
Question 3 of 20: Select the best answer for the question.
Question 3 of 20 : Select the best answer for the question. 3. Circular errors are caused by adding the cell name of a/an _______ cell to a formula. A. adjacent B. absolute C. active D. relativeQuesti… read more
Chris M.
Chris M.
M.S.W. Social Work
Master's Degree
2,636 satisfied customers
Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.

Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.

Show MoreShow Less

Ask Your Question

x