Day 20 at Makers Academy

Takeaway Challenge

Today we undertook the Takeaway Challenge. Unfortunately it is much less delicious than it sounds, it involves no actual eating of takeaways! We had to build a takeaway application which could show a menu, take orders, show the costs and place an order. We were given relatively little direction on how to do this, so I went with a similar method to the student directory from a couple of weeks ago. I thought it might be easier to show it working rather than talk through it!

Firstly the menu comes up and prompts for an option to be entered by the user
Entering option 1 shows you the menu. After each option has finished doing what it is supposed to, the option menu shows again
Option 2 lets you order food, you input the menu number and then the quantity you would like.
Option 3 shows you what you have ordered
Option 4 shows you the cost
Option 5 lets you place the order, checking if you are happy first. If you haven’t ordered anything it will tell you here
Finally once the order is placed a text is sent to confirm

My app works, it met all the user functionality it needed to as well. I wrote a few tests for it, trying to follow the TDD process, however I know I probably should have written more than I did. My coverage is currently 83%, so definitely room for improvement. The main issue I had with testing was where I was asking for user input, the test would get stuck, and I couldn’t get it to accept input as a double!

The main difference between this and the student directory is the use of different classes and dependancy injection, trying to follow the single responsibility principle. I got it working quite well, most classes only did the minimum they had to. The biggest was the Menu class which had to display a menu, receive input and then process the input. Each input would go to a different class, but it was still quite long!


Todays song of the day is a song from the Borderlands 3 trailer which released yesterday. I am very excited for that game, and their trailers always have the best music, I would recommend listening to the music from all of them!

Leave a comment