11/29/21, 11:10 PM Project 4
https://canvas.vt.edu/courses/135925/assignments/1337336 1/4
Project 4
12/8/2021
100 Possible Points
IN PROGRESS
Next Up: Submit Assignment
Unlimited Attempts Allowed
Attempt 1 Add Comment
Details
Project 4
Bob Belcher, of Bob’s Burgers, has decided he wants to get into the online ordering, and so he has
hired you as part of a team to put together his online ordering system. You have been tasked with
creating the objects that will represent the menu items and bill. You will be using Ruby as the
language.
Ruby is an object oriented language and so we will be using the class constructor to represent our
items. We will have a base class for all of the items and the items will inherient from there. The burger
of the day will also, subsequently inherient from the burger.
Details
Bob’s menu has the following items and prices
Name Price
Burger $5.00
Burger of
the day
$5.95
Cheese +$.50
Fries $2.00
Side Salad $2.50
Soft Drink $2.00
Beer $4.00
Note, that you can add cheese to both the regular burger and the burger of the day which will add
cheese. If cheese, is added, it can be removed. If cheese is added, then the price of the burger will
increase by $0.50. If cheese is added and then removed, the prices will reduce by $0.50.Submit Assignment
11/29/21, 11:10 PM Project 4
https://canvas.vt.edu/courses/135925/assignments/1337336 2/4
The default set of toppings for the burger are as follows:
1. Mustard
2. Ketchup
3. Lettuce
4. Tomato
5. Onion
If present they will be listed in that order as prescribe above. Any topping removals will shift the list
down to cover the removed item and added toppings will be added to the end of the list. See the
example bill for details.
The burger of the day will not list its toppings other than to see that cheese was added, if it was
added.
Removing cheese when cheese has not been added will do nothing to the burger.
API
There is a “detailed” API (https://canvas.vt.edu/courses/135925/files/20944394?wrap=1) , (right click and
open this in a new tab or window), that you can use. It does not show all of the classes that are
required.
You must write a class for each of the items on the menu. Most of the items will be like Fries which
simply needs to call its parent’s initializer. In fact, only Burger and Burger of the Day are different.
Burger of the Day does call it’s parent’s initializer, but remember that Burger of the Day subclasses
Burger…so then it needs to update its own name and price to match.
Main
There’s also the little part of what runs all of this. Well that’s main, but since this is Ruby, you can
simply put this in a file and tell Ruby to run that file like:
ruby file.rb
where file.rb is the name of your Ruby file that you want to run. We’ll spice this up by adding 2
commandline parameters. The first is the name of the file that contains the order, and the second is
the name for the output bill file.
This main needs to parse the order, add the items to the Bill taking into account any special requests
like, “add cheese” or “remove onion”. Then it will compute the total and produce a nicely formatted bill
like the one in the API.
Normally, we would write all of these class and such in separate files, but for the sake of testing and
grading, but them all in 1 file. You can, of course, develop them as separate files, but then put them all
Submit Assignment
https://canvas.vt.edu/courses/135925/files/20944394?wrap=1
11/29/21, 11:10 PM Project 4
https://canvas.vt.edu/courses/135925/assignments/1337336 3/4
Choose a submission type
together for submission.
Testing
Since this is tested using my grading tool it will be checking line by line. So have what I have on each
line as shown. There are 50 dashes on those lines in the bill, btw.
To run your code, use a command like this:
ruby BobsBurgers.rb order.txt bill.txt
Grading
I will get your file from Canvas, the name you use does not matter, and run it using a command like
the one shown above. Then I will compare the results of your bill to the results from my bill.
Files
I will include more orders and bills as soon as possible. Here is the one from the documentation
Bill.txt (https://canvas.vt.edu/courses/135925/files/20944346?wrap=1)
Order.txt (https://canvas.vt.edu/courses/135925/files/20944348?wrap=1)
Upload More
Canvas Files
Choose a file to upload
File permitted: RB
Submit Assignment
https://canvas.vt.edu/courses/135925/files/20944346?wrap=1
https://canvas.vt.edu/courses/135925/files/20944348?wrap=1
11/29/21, 11:10 PM Project 4
https://canvas.vt.edu/courses/135925/assignments/1337336 4/4
Submit Assignment