You are on page 1of 6

COURSEWORK SPECIFICATION COVER

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

Name ID Section Signature

Lecturer’s Comments

Date: Signature:

ICT2113 Coursework: Lab (10%)


Assessment Form

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

ICT2113 Coursework: Lab (10%)


Question

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.

You are required to fulfill the following requirements:


 Write the program under only 1 class without using any object and object variables
 All methods are static methods.
 Provide input validation and prompt appropriate error messages for invalid input
 Use selection structure for selection options
 Use loop structure to handle looping of activities
 Handle each activity with a different method
 Use only local variables to pass and return data needed to and from main.

Below shows an example of the input and output of the program:

Input the number of 5kg flour to start:


-5 Invalid input, quantity must be
positive Input the number of 5kg flour
to start: 0 Invalid input, quantity must
be positive Input the number of 5kg
flour to start: 4 4 of 5Kg flour added.

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

ICT2113 Coursework: Lab (10%)


Enter selection (1-4): 1
Enter quantity of cake to make: 10
10 cakes made. flour left is 33000 gram

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.

BUILD SUCCESSFUL (total time: 1 minute 36 seconds)

ICT2113 Coursework: Lab (10%)


Blackboard Submission requirements:
Each group is required to submit two files into the assignment drop bin:
 1st file: Report – submit a report in PDF format. Include the following items in the
report:
o Lab cover page
o Assessment form
o Complete output of the program that tests every single feature of your
program
o Source code with proper alignment according to report page margin
nd
 2 file: Source code – submit only the .java file (not the project)

Follow the naming convention given below to name your files:

LabSectionGroupNumber.java/.pdf

Example: LabF1G2.java,
LabF1G2.pdf

ICT2113 Coursework: Lab (10%)

You might also like