Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Edible Insects Japan has vending machines where you can buy edible insects. Left to right: Crickets ( CR ) 1 4 8 0 Mealy worms

Edible Insects Japan has vending machines where you can buy edible insects.
Left to right:
Crickets (CR)1480
Mealy worms (MW)1580
Locusts(LO)1680
Cicadas(CI)1380
Silk worms(SW)1480
The machine uses 10,50,100, and 500 coins ( is the symbol for yen). Write a program named EatEm that asks the user which of the five items that they desire. They will be filling in the two letter code. Ask them which type of coin they want to deposit. Let them keep depositing coins until they have enough. Let them know what their change is. Also let them know what the cost would have been in US dollars.
You need to validate that they pick a valid two-letter code and that they put in a valid coin. Then add a loop so they can get more yummy insects. Continue until they answer no.
Part 2: Insect and EatEm2
Write the same application as EatEm, except use a blueprint and driver. The output will be identical.
Sample output:
Which type of edibile insect would you like?
cricket(CR), mealy worm (MW), locust (LO), cicada (CI) or silk worm (SW)
Please type in the two letter code
LL
That is not a valid code
Which type of edibile insect would you like?
cricket(CR), mealy worm (MW), locust (LO), cicada (CI) or silk worm (SW)
Please type in the two letter code
LO
The cost is 1680 yen
Deposit a coin - either 10,50,100, or 500 yen
Which value of coin?
500
The remaining cost is 1180
Deposit a coin - either 10,50,100, or 500 yen
Which value of coin?
400
Not a valid coin
Deposit a coin - either 10,50,100, or 500 yen
Which value of coin?
500
The remaining cost is 680
Deposit a coin - either 10,50,100, or 500 yen
Which value of coin?
500
The remaining cost is 180
Deposit a coin - either 10,50,100, or 500 yen
Which value of coin?
500
Your change is 320. Here is your snack.
Here are your coins back
Your change is 3100Y 210Y coins
In American money, the snack would cost $15.14
More yummy insects? (yes or no)
yes
Which type of edibile insect would you like?
cricket(CR), mealy worm (MW), locust (LO), cicada (CI) or silk worm (SW)
Please type in the two letter code
MM
That is not a valid code
Which type of edibile insect would you like?
cricket(CR), mealy worm (MW), locust (LO), cicada (CI) or silk worm (SW)
Please type in the two letter code
MW
The cost is 1580 yen
Deposit a coin - either 10,50,100, or 500 yen
Which value of coin?
500
The remaining cost is 1080
Deposit a coin - either 10,50,100, or 500 yen
Which value of coin?
500
The remaining cost is 580
Deposit a coin - either 10,50,100, or 500 yen
Which value of coin?
100
The remaining cost is 480
Deposit a coin - either 10,50,100, or 500 yen
Which value of coin?
100
The remaining cost is 380
Deposit a coin - either 10,50,100, or 500 yen
Which value of coin?
100
The remaining cost is 280
Deposit a coin - either 10,50,100, or 500 yen
Which value of coin?
100
The remaining cost is 180
Deposit a coin - either 10,50,100, or 500 yen
Which value of coin?
500
Your change is 320. Here is your snack.
Here are your coins back
Your change is 3100Y 210Y coins
In American money, the snack would cost $14.23
More yummy insects? (yes or no)
no
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transactions On Large Scale Data And Knowledge Centered Systems X Special Issue On Database And Expert Systems Applications Lncs 8220

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Stephen W. Liddle ,Klaus-Dieter Schewe ,Xiaofang Zhou

2013th Edition

3642412203, 978-3642412202

Students also viewed these Databases questions

Question

Explain the pay-as-you-go system.

Answered: 1 week ago