Professional Documents
Culture Documents
Programme : DCS
Subject Code : ICT2113
Subject Description : Object Oriented Programming
Section : F1
Lecturer : Ng Ruoh Ling
Coursework description : Lab (10%)
Coursework Type : Group
Student’s declaration
We declare that:
We understand what is meant by plagiarism
This Lab answer is all our own work and we have acknowledged any use of the
published or unpublished works of other people.
We hold a copy of this Lab which we can produce if the original is lost or damaged
Lecturer’s Comments
Date: Signature:
Marks
Assessment Criteria Marks awarded
Allocated
Input/output (40%)
Variables, data types 5
Input / output 10
Validation 15
calculation 10
Flow Control (20%)
Selection structure 10
Loop structure 10
Methods (40%)
Make cake 12
Add flour 12
Check stock 16
Total 100
The system keeps track of available amount of flour to make cakes. It starts with inputting
the quantity of 5kg flour from the user. If the quantity is invalid, it loops until the quantity is
valid.
Once the initial quantity is given, the user can perform the following activities. Each activity
is done in a separate method:
Make cake – this method reads the quantity of cake to make. Each cake requires 400
grams of flour. It returns the quantity to update the main if input quantity is valid. It
prompts error messages if quantity is invalid.
Add flour – this method reads the quantity of 5Kg flour to add. It returns the value to
update the main if input is valid. It prompts error message if input is invalid.
Check stock – this method displays the
o total quantity of 5kg flour bought
o the quantity of cakes made
o the total gram of flour bought
o the total gram of flour used
o the total gram of flour remains
User can perform the activities repeatedly until a quit option is chosen.
Menu:
1. Make Cake
2. Add flour
3. Check record
4. Quit
Enter selection (1-4): 1
Enter quantity of cake to make: -4
ICT2113 Coursework: Lab (10%)
Invalid quantity
Menu:
1. Make Cake
2. Add flour
3. Check record
4. Quit
Enter selection (1-4): 1
Enter quantity of cake to make: 20
20 cakes made. flour left is 12000 gram
Menu:
1. Make Cake
2. Add flour
3. Check record
4. Quit
Enter selection (1-4): 1
Enter quantity of cake to make: 50
Insufficient flour.
Available flour is 12000 gram
Menu:
1. Make Cake
2. Add flour
3. Check record
4. Quit
Enter selection (1-4): 2
How many 5kg flour to add? 5
5 of 5kg flour added.
Menu:
1. Make Cake
2. Add flour
3. Check record
4. Quit
Enter selection (1-4): 3
Total quantity of 5 kg flour bought: 9
Total quantity of cake made:20
Total flour bought: 45000gram
Total flour used: 8000gram
Total flour left: 37000gram
Menu:
1. Make Cake
2. Add flour
3. Check record
4. Quit
Menu:
1. Make Cake
2. Add flour
3. Check record
4. Quit
Enter selection (1-4): 3
Total quantity of 5 kg flour bought: 9
Total quantity of cake made:30
Total flour bought: 45000gram
Total flour used: 12000gram
Total flour left: 33000gram
Menu:
1. Make Cake
2. Add flour
3. Check record
4. Quit
Enter selection (1-4): 5
Invalid input
Menu:
1. Make Cake
2. Add flour
3. Check record
4. Quit
Enter selection (1-4): a
Invalid input
Menu:
1. Make Cake
2. Add flour
3. Check record
4. Quit
Enter selection (1-4): 4
Thank you for using the system.
LabSectionGroupNumber.java/.pdf
Example: LabF1G2.java,
LabF1G2.pdf