Italian Takeaway Ordering System

An Italian Takeaway is asking you to write a computer program to facilitate the ordering process and automatically calculate the total cost of an order.

They have stored their menu and all prices into a text file with the following information:

Code;Description;Price;


TextFilefood-menu.txt

When a customer order food, they give the lists of codes they would like order. For instance a customer could order the following: S4,P3,P7,X2,D4,C1,W2

Your program should allow the customer to order as many options from the menu as they need. For each option, it should lookup the price in the text file provided. It should then calculate and output the total cost of the order.

To complete this challenge you will need to read more about how to read through a CSV file.

Complete the Code


Testing


Once you have completed the code check that it produces the expected output by performing the following tests:

Test # Input Values Expected Output Actual Output
#1 S4,P3,P7 £28.89
#2 P10,S1 £16.00
#3 P4,D2,C2 £19.30

Extension Task


Add some input validation routines to your code so that the customer can only enter a valid code from the menu.

Video Tutorial / Solution



unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Did you like this challenge?

Click on a star to rate it!

Average rating 4.3 / 5. Vote count: 31

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!

Tagged with: , ,