0% found this document useful (0 votes)
30 views5 pages

Practical 7

Uploaded by

Desmond
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views5 pages

Practical 7

Uploaded by

Desmond
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS

CSIS 1534 – Practical 7

DATE: 25 April 2023


DUE DATE: End of practical sessions

• All files must include your name and student number at the very top of every file
(The ve concept). Marks will be subtracted for every missing occurrence.
• Your program must run.
• Code that is commented out is not marked.
• You must use comments to separate your program login. In other words, use
comments to mark the different sections of your code.
• Remember to breath and work through the practical one instruction at a time.

Develop a Console (.NET Framework) application and name it OrderingSystem. Develop an


ordering system for a cashier at a small café. Display a menu with meal items as in Figure 1.
Each meal should have an order number associated to it. Allow the user to select an order
number and the quanity of meals (See Figure 2). The program should display the number of
meals ordered, the price per meal as on the menu, and the total price as well as a thank you
message when an order has been place (See Figure 3). Once an order is complete, the user
asked if another customer order should be generated (See Figure 4). If yes [‘Y’], clear the
console and allow the user to take another order (See Figure 5). If the user selects no [‘N’],
allow the user to exit the program (See Figure 8). The program must make provision for
lowercase input.

Notes:
• Create a method named TotalPrice that returns a decimal and accepts the quantity
of meal items ordered and the cost per meal as parameters. The method should
calculate and return the total price of the order as in Figure 3.
• Create a method named GenerateOrder that will not return anything and accepts a
decimal paramter. The method should prompt the user for the quanity of menu items
to order, calculate the total price, and display output as in Figure 3.
- You must call the TotalPrice method from within the GenerateOrder
method to calculate the total price of the meal order.
• Create a method called isAnotherOne that returns a bool. This method should
prompt the user for another customer order (See Figure 4) and return the bool result
of the user’s response.

1
• Use an appropriate loop to display the menu and the rest of the program. The loop
body should be executed at least once before the loop condition is checked.
- The loop should be controlled by the state of one of your custom methods.

• Use a switch structure to cycle through the menu options. For each case, you may
hard-code the price of the corresponding meal item in a variable.
- Do not create a new variable for each case. Rather, you must create one
variable to which you will assign a value in each case. Remember to take
variable scope into consideration. Ensure that you use the correct data type
for money.
- For each case, you must also call the GenerateOrder method.
- The default case should handle user error as in Figure 7.

Figure 1: Initial screen

Figure 2: User has selected meal order and is


prompted for the quantity

2
Figure 3: Output generated – numbr of meals,
price per meal, and total price.

Figure 4: User is prompted for another


customer order

Figure 5: The user has selected ‘Y’ – console is


cleared and menu is displayed.

3
Figure 6: Output displayed due to user error –
user has a selected an option that is not on the
menu

Figure 7: User error detected – user can press


any key to try again and the program will start
from the beginning

4
Figure 8: User is prompted for next customer -
the user has selected ‘N’ and is allowed to exit
program.

Submission checklist
 I have added a comment block with my information before the using directives.
 I have used comments to separate my program logic.
 I have zipped my entire solution folder and named it correctly: Surname (Student
number) where Surname and Student number is replaced with my own surname and
student number.
 I have downloaded my zipped folder to check that I have submitted the correct project
folder (You must submit the entire project folder, not just the .sln file).

You might also like