PBT1 Question
PBT1 Question
REGISTRATION NO MARKS
DATE
CLASS
CODE/SUBJECT DFC20113 - PROGRAMMING
ASSESSMENT
FUNDAMENTALS
PROBLEM BASED TASK 1
100
LECTURER
CLO 2: Show simple programs by developing code to solve problems in a computer using
C++ programming language. (P2, PLO 3)
QUESTION 1
The owner of Hayati's Cafe, Puan Nor wanted a system that could display prices based on the
menu chosen by the customer. List of menus should be displayed on the top of the system with
their corresponding prices. Refer Table 1 for details.
As a programmer, you are tasked with building a system using the C++ programming language
that can help Puan Nor solve her problems. The system should also be able to formulate the
total price for each customer, display the cash received and calculate the balance. In addition,
Puan Nor also decided to give a 10% discount for orders over RM100 and must be entered into
the system. (CLO2, P2)
You may follow these steps to build the complete system:
a. Create variables.
b. Declare each variable with the most suitable data type.
c. Initialize variable with initial value if applicable.
d. Write the code to display the menu at the top of the system.
e. Write input statement to allow user to enter the selected menu.
f. Using the switch ... case statement, an "Invalid menu" message will appear when the
user enters the wrong menu. Refer to Figure 1. Users are also allowed to enter a
quantity for their order.
g. Using the do ... while statement, allow the user to enter the character "Y" or "y" to add
a new order. If there are no more orders, the system will display the total price, cash
received and calculate the remaining balance.
h. For orders over RM 100, a 10% discount will be automatically deducted from the total
price. You can use a single if statement to do that.
i. Compile and execute the program.
j. Correct any errors if they occur. The final output should be the same as in Figure 2 (if
only one menu is selected) & Figure 3 (if more than one menu is selected & has a
discount).
Figure 1
Figure 2
Figure 3
NAME
REGISTRATION NO MARKS
CLASS
100
CODE / COURSE NAME DFC20113 PROGRAMMING FUNDAMENTALS
LECTURER
Students able to write all the Students able to write most the Students able to write some the Student not able to write the
Input & Output input & output statements given input & output statements based input & output statements based input & output statements
20
Statement (P) and use correct symbol based on on the scenario given and use on the scenario given but not in adequately based on scenario
the scenario correct symbol. correct symbol. given.
Selection Students able to write code and Students able to write most of
Students able to write some the
Control use the correct selection control the selection control structures Student not able to write or use
selection control structures with 25
Structures structures and clearly solves but does not derive a solution to the selection control structures.
minor errors.
(P) the problem. the problem.
Students able to write code use Students able to write most of Students able to write some the
Loops Control loop control structures with
the correct loop control the loop control structures but Student not able to write or use
Structures minor error. 25
structures and clearly solves the does not derive a solution to the the loop control structures.
(P)
problem. problem.
*Zero (0) mark will be given if students do not answer/ perform the criteria needed.