You are on page 1of 29

DIPLOMA IN INFORMATION TECHNOLOGY

COURSEWORK

Subject: OBJECT-ORIENTED MODELLING


Subject code: DIT2123

DEADLINE: Week 9 (TBC)

NAME STUDENT ID

SAEGAN LOO 20028841

MEKAN PATDYYEV 20024709

CHIEW KAR ONN 20034120

SYED ALTAMASH ALI 20037966


INSTRUCTIONS TO CANDIDATES
This assignment will contribute 40 % to your final grade.
This is a group assignment (THREE to FOUR students in a group).

IMPORTANT
The Sunway Diploma Studies requires students to adhere to submission deadlines for any
form of assessment. Penalties are applied in relation to unauthorised late submission of work.

- Coursework submitted after the deadline but within 1 week will be considered as late
submission.
- Work handed in following the extension of 1 week after the original deadline will be
regarded as a non-submission and marked zero.
Academic Honesty Acknowledgement
"We verify that this paper contains entirely my own work. We have not consulted with any
outside person or materials other than what was specified (an interviewee, for example) in the
assignment or the syllabus requirements. Further, we have not copied or inadvertently copied
ideas, sentences, or paragraphs from another student. we realise the penalties (refer to the
student handbook diploma and undergraduate programme) for any kind of copying or
collaboration on any assignment."

Name Signature Date


Saegan Loo Saegan 04/07/2021
Mekan Patdyyev Mekan 21/07/2021
Chiew Kar Onn KOChiew 23/07/2021
Syed Altamash Ali syed 23/07/2021

2
Group Member Contribution

INSTRUCTION
The contribution must be signed by all members. 3 marks will be deducted from the total
marks awarded if the group fail to comply with this requirement.

Role & Responsibilities


Signatur
Student Name Student ID (e.g. create class diagram,
e
compile report etc)
Saegan Loo 20028841 Saegan Class diagram and justification
Mekan Patdyyev 20024709 Mekan Introduction and Conclusion
Chiew Kar Onn 20034120 KOChiew Coding Interfaces and classes
Syed Altamash Ali 20037966 syed Coding

3
Marking Scheme

Scale Excellent (5) Good (4) Satisfactory (3) Poor (2) Weak (1) Score
Introduction (3) Background is Background is Background with Background with Background with
included with included with little elaboration. limited very limited or
proper some Objectives are elaboration. without
elaboration. elaboration. stated and Objectives are elaboration.
Objectives are Objectives are slightly stated but Objectives are
clearly stated, clearly stated impractical. unrealistic. not stated.
realistic and and relevant.
achievable.
Class Diagram All necessary Most necessary Some classes Most classes are Very limited
 Classes, classes are classes are are named with not described or classes are not
attributes, included and included and descriptive the names are described or the
methods, named with named with names. not descriptive. names are not
relationships descriptive descriptive Some attributes Many attributes descriptive.
and multiplicity names. names. are well are fairly Few or no
(10) Attributes are Most attributes described and described and attributes are
 Discussion (5) well described are well include their data include their data included.
and include their described and types for most types for some Few or no
data types for all include their data classes. classes. methods are
classes. types for most Some methods Many methods included.
All methods classes. including including Few or no
including Most methods constructors are constructors are relationship and
constructors are including well described fairly described multiplicity are
well described constructors are and include their and include their included.
and include their well described data types and data types and Unclear or no
data types and and include their returns for most returns for many discussion made
returns for all data types and classes. classes on OO concept
classes. returns for most Some Many used in design
All relationships classes. relationships and relationships and
and multiplicities Most multiplicities are multiplicities are
are well relationships and well described. fairly described.
described. multiplicities are Brief discussion Limited
Comprehensive well described. made on OO discussion made
discussion made Detail discussion concept used in on OO concept
on OO concept made on OO design. used in design
used in design. concept used in
design.
Coding No errors. No errors. No errors. Contains logic Program not
 Functionality Supports all Supports most Supports some errors. executable.
(10) necessary necessary necessary Supports limited Unable to
 User- features. features. features. necessary support
friendliness (5) User friendly. Quite user Somewhat user features. necessary
 Mapping in Fully mapped friendly. friendly. Not user friendly. features.
between with the class Mostly mapped Fairly mapped Difficult mapped Not user friendly.
design and diagram. with the class with the class with the class Not mapped with
implementation diagram. diagram. diagram. the class
(5) diagram.
Conclusion (2) Conclusion sum Conclusion sum Conclusion not Conclusion sum No conclusion
up what has up what has fully sum up up minor part of presented.
been done with been done. what has been what has been
justification. done. done.
Comments: Total (40 marks)

4
Introduction
During the COVID-19 pandemic, many businesses have changed their strategies. Selling
online has become a priority to many business owners as it is safe, convenient and does not
require face to face contact between seller and buyer. One of the examples is Secret Garden, a
bakery shop that offers a wide range of cakes and bread at a very affordable price. Secret
Garden has decided to take pre-orders via WhatsApp and WeChat and included add-on
options, including several options such as add-on services that include customisation of
design, custom made candles, and so on. The shop eventually has come to the point where
pre-orders have massively increased over time due to increased demand. Secret Garden
started to face difficulties managing orders. It is crystal clear that the company needs a
computerised system to make the pre-order process faster and more efficient. The owner of
"Secret Garden", Ms Ayumi Lucas, requested our company to design and develop a pre-order
system for the company. Based on requirements given by Ms Ayumi Lucas, our team will
build and create a fully computerised system for pre-orders for "Secret Garden".

Class Diagram
A class diagram is a type of static structure diagram that describes the structure of a system
by demonstrating the system's classes, attributes, methods, and the relationship among
objects.
For Secret Garden's programme, the class diagram consists of various classes that assist in
performing its tasks. The following capture displays the overall class diagram for Secret
Garden's bakery shop system:

5
6
As it can be seen above, the following classes Bread and Cake, represent the products of
Secret Garden. The class Cake has two subclasses which are Candle and Design. These are
additional items that can be purchased if the customer orders a cake. Additionally, the
subclass Design has a subclass called 'WrittingMsg'. This is an extra design that displays a
message such as "Happy Birthday!", "Happy Graduation!" and "Happy Anniversary". The
class Member represents the discount entitled to the members of Secret Garden.

Coding and Screenshot


File name: bread.java
package oomassignment;

/**
*
* @author user
*/
public class Bread {
String type;
double weight;
int quantity;
static double price;

public Bread(String type, double weight, int quantity, double price) {


this.type = type;
this.weight = weight;
this.quantity = quantity;
this.price = price;
}

public String getType() {


return type;
}

7
public void setType(String type) {
this.type = type;
}

public double getWeight() {


return weight;
}

public void setWeight(double weight) {


this.weight = weight;
}

public int getQuantity() {


return quantity;
}

public void setQuantity(int quantity) {


this.quantity = quantity;
}

public double getPrice() {


System.out.println("Your total is: "+price);
return price;
}

public void setPrice(double price) {


this.price = price;
}

8
public static void print(){
System.out.println("Your Total for bread is: RM"+price);
}
}

File name: cake.java


package oomassignment;

/**
*
* @author user
*/
public class Cake {
String flavour;
double weight;
String shape;
int quantity;
static double price;

public Cake(String flavour, double weight, String shape, int quantity, double price) {
this.flavour = flavour;
this.weight = weight;
this.shape = shape;
this.quantity = quantity;
this.price = price;
}

public String getFlavour() {


return flavour;
}

9
public void setFlavour(String flavour) {
this.flavour = flavour;
}

public double getWeight() {


return weight;
}

public void setWeight(double weight) {


this.weight = weight;
}

public String getShape() {


return shape;
}

public void setShape(String shape) {


this.shape = shape;
}

public int getQuantity() {


return quantity;
}

public void setQuantity(int quantity) {


this.quantity = quantity;
}

public double getPrice() {

10
return price;
}

public void setPrice(double price) {


this.price = price;
}

public static void print(){


System.out.println("Your total for cake is : RM "+price);
}
}

File name: candle.java


package oomassignment;

/**
*
* @author user
*/
public class Candle {

String color;
String design;
int quantity;

public Candle(String color, String design, int quantity) {


this.color = color;
this.design = design;
this.quantity = quantity;
}

11
public String getColor() {
return color;
}

public void setColor(String color) {


this.color = color;
}

public String getDesign() {


return design;
}

public void setDesign(String design) {


this.design = design;
}

public int getQuantity() {


return quantity;
}

public void setQuantity(int quantity) {


this.quantity = quantity;
}
}

File name: checkout.java


package oomassignment;

/**

12
*
* @author user
*/
public class Checkout {
}

File name: design.java


package oomassignment;

/**
*
* @author user
*/
public class Design {

String pattern;
String color;

public Design(String pattern, String color) {


this.pattern = pattern;
this.color = color;
}

public String getPattern() {


return pattern;
}

public void setPattern(String pattern) {


this.pattern = pattern;
}

13
public String getColor() {
return color;
}

public void setColor(String color) {


this.color = color;
}
}

File name: member.java

package oomassignment;

/**
*
* @author user
*/
public class Member {

double discount = 0.05;

public double getDiscount() {


return discount;
}

public void setDiscount(double discount) {


this.discount = discount;

14
}
}

File name: OOMAssignment.java

package oomassignment;

import java.util.*;

/**
*
* @author user
*/
public class OOMAssignment extends Checkout{

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here

int checkout1 ;

System.out.println(" #### #####");


System.out.println("# #");
System.out.println("# #");
System.out.println(" ### # ##");
System.out.println(" # # #");

15
System.out.println(" # # #");
System.out.println("#### ##### ");

System.out.println("The Super-Duper Tiny-Winy Ordernimatronic 5000");

do{
System.out.println("What would you like to do?");
System.out.println("-----------------------");
System.out.println("|1-Order Bread |\n-----------------------\n"
+ "|2-Order Cake |\n-----------------------\n"
+ "|3-Renew Membership |\n-----------------------\n"
+ "|4-Display All Product|");
System.out.println("-----------------------");

Scanner item = new Scanner(System.in);


int item1 = item.nextInt();

switch(item1){
case 1:{

System.out.println("Please choose the bread: \n----------------------------\n"


+ "|1-Rye Bread:RM2.50 |\n----------------------------\n"
+ "|2-Sour Dough:RM3 |\n----------------------------\n"
+ "|3-White Bread:RM1.70 |\n----------------------------\n"
+ "|4-Whole Wheat Bread:RM2.70|\n----------------------------\n"
+ "|5-Butter Bread:RM3.50 |\n----------------------------\n");
Scanner bread = new Scanner(System.in);
int bread1 = bread.nextInt();
switch(bread1){

16
case 1:{
Bread product = new Bread("Rye Bread",300,1,2.50);
System.out.println("You ordered "+product.type+"\nWeight:
"+product.weight+"\nQuantity: "+product.quantity);
break;
}
case 2:{
Bread product = new Bread("Sour Dough",300,1,3.00);
System.out.println("You ordered "+product.type+"\nWeight:
"+product.weight+"\nQuantity: "+product.quantity);
break;
}
case 3:{
Bread product = new Bread("White Bread",300,1,1.70);
System.out.println("You ordered "+product.type+"\nWeight:
"+product.weight+"\nQuantity: "+product.quantity);
break;
}
case 4:{
Bread product = new Bread("Whole Wheat Bread",300,1,2.70);
System.out.println("You ordered "+product.type+"\nWeight:
"+product.weight+"\nQuantity: "+product.quantity);
break;
}
case 5:{
Bread product = new Bread("Butter Bread",300,1,3.50);
System.out.println("You ordered "+product.type+"\nWeight:
"+product.weight+"\nQuantity: "+product.quantity);
break;
}
default:{
System.out.println("Error");

17
return;
}

break;
}
case 2:{
System.out.println("Please choose your favourite cake:\n------------------------\n"
+ "|1-Chocolate Cake:RM54 |\n------------------------\n"
+ "|2-Strawberry Cake:RM45|\n------------------------\n"
+ "|3-Cheese Cake:RM60 |\n------------------------\n"
+ "|4-Red Velvet Cake:RM65|\n------------------------\n");
Scanner cake = new Scanner(System.in);
int cake1 = cake.nextInt();

switch(cake1){
case 1:{
Cake product = new Cake("Chocolate",500,"Square",1,54);
System.out.println("You ordered "+product.flavour+"\nWeight:
"+product.weight+"\nQuantity: "+product.quantity+"\nShape: "+product.shape);
break;
}
case 2:{
Cake product = new Cake("Strawberry",500,"Round",1,45);
System.out.println("You ordered "+product.flavour+"\nWeight:
"+product.weight+"\nQuantity: "+product.quantity+"\nShape: "+product.shape);
break;

18
}
case 3:{
Cake product = new Cake("Cheese",500,"Rectangle",1,60);
System.out.println("You ordered "+product.flavour+"\nWeight:
"+product.weight+"\nQuantity: "+product.quantity+"\nShape: "+product.shape);
break;
}
case 4:{
Cake product = new Cake("Red Velvet",500,"Trangle",1,65);
System.out.println("You ordered "+product.flavour+"\nWeight:
"+product.weight+"\nQuantity: "+product.quantity+"\nShape: "+product.shape);
break;
}
default:{
System.out.println("Error");
return;
}

}
System.out.println("Please choose your design: \n----------------\n"
+ "|1-Flower |\n----------------\n"
+ "|2-Braid |\n----------------\n"
+ "|3-Comtemporary|\n----------------\n");
Scanner design = new Scanner(System.in);
int design1 = design.nextInt();
switch(design1){
case 1:{
Design onCake = new Design("Flower","Red");
break;
}
case 2:{

19
Design onCake = new Design("Braid","Green");
break;
}
case 3:{
Design onCake = new Design("Contemporary","Blue");
break;
}
default:{
System.out.println("Error");
return;
}
}
System.out.println("Please choose your candle design: \n------------\n"
+ "|1-Standard|\n------------\n"
+ "|2-Numbers |\n------------\n"
+ "|3-Shapes |\n------------\n");
Scanner Candle = new Scanner(System.in);
int candle1 = Candle.nextInt();
switch(candle1){
case 1:{
Candle onCakeCandle = new Candle("Red","Standard",10);
break;
}
case 2:{
Candle onCakeCandle = new Candle("Blue","Numbers",10);
break;
}
case 3:{
Candle onCakeCandle = new Candle("Green","Shapes",10);
break;

20
}
default:{
System.out.println("Error");
return;
}
}
System.out.println("Please choose your messages: \n-----------------------\n"
+ "|1-Happy BirthDay!! |\n-----------------------\n"
+ "|2-Happy Anniversary!!|\n-----------------------\n"
+ "|3-Happy Graduation!! |\n-----------------------\n");
Scanner WrittingMsg = new Scanner(System.in);
int msg1 = WrittingMsg.nextInt();
switch(msg1){
case 1:{
WrittingMsg onCakeMsg = new WrittingMsg("Happy BirthDay!!","Red");
break;
}
case 2:{
WrittingMsg onCakeMsg = new WrittingMsg("Happy Anniversary!!","Red");
break;
}
case 3:{
WrittingMsg onCakeMsg = new WrittingMsg("Happy Graduation!!","Red");
break;
}
default:{
System.out.println("Error");
return;
}
}

21
break;
}

case 3:{
System.out.println("Would you like to renew your membership?\n1-Yes\n2-No");
Scanner mem = new Scanner(System.in);
String mem1 =mem.next();
switch(mem1){
case "Yes":{
System.out.println("Please input your member ID: ");
Scanner ID = new Scanner(System.in);
int ID1 = ID.nextInt();
if(ID1>0){
System.out.println("Your ID is: "+ID1);
System.out.println("Your renewal cost would be RM10");
Scanner pay = new Scanner(System.in);
String pay1 = pay.next();
switch(pay1){
case "pay":{
System.out.println("Thank you very much for renewing your
membership");
return;
}
default:{
System.out.println("Error");
return;
}
}

22
}
else{
System.out.println("Error");
return;
}

}
case 4:{
System.out.println("Cakes:\n1-Chocolate Cake:RM54\n2-Strawberry
Cake:RM45\n3-Cheese Cake:RM60\n4-Red Velvet Cake:RM65");
System.out.println("Breads:\n1-Rye Bread:RM2.50\n2-Sour Dough:RM3\n3-White
Bread:RM1.70\n4-Whole Wheat Bread:RM2.70\n5-Butter Bread:RM3.50");
return;
}

default:{
System.out.println("Error");
return;
}

23
System.out.println("Would you like to check out?(1-Yes/2-No)");
Scanner input = new Scanner(System.in);
checkout1 = input.nextInt();
}while(checkout1 != 1);

if(checkout1 == 1){

System.out.println("Are you a member?(1-Yes/2-No)");


Scanner member = new Scanner(System.in);
String member1 = member.nextLine();
switch(member1){
case "1":{
System.out.println("Please input your member ID: ");
Scanner memId = new Scanner(System.in);
int memId1 = memId.nextInt();
if(memId1>0){
double sum1;
double sum2;
double sum3;
sum1 = Bread.price * 0.95;
sum2 = Cake.price * 0.95;
sum3 = sum1 + sum2;
System.out.println("Your total for bread is: RM"+sum1);
System.out.println("Your total for cake is: RM"+sum2);
System.out.println("----------------------------------");
System.out.println("Grand total: RM "+sum3);
}
else{
System.out.println("Error");
}

24
break;
}
case "2":{
Bread.print();
Cake.print();
break;
}
default:{
System.out.println("Error");
break;
}
}

}
else{
return;
}

}
}

File name: WrittingMsg.java


package oomassignment;

/**
*
* @author user
*/
public class WrittingMsg {

25
String Message;
String color;

public WrittingMsg(String Message, String color) {


this.Message = Message;
this.color = color;
}

public String getMessage() {


return Message;
}

public void setMessage(String Message) {


this.Message = Message;
}

public String getColor() {


return color;
}

public void setColor(String color) {


this.color = color;
}
}

26
27
28
Conclusion
COVID-19 pandemic has affected many businesses, and business owners have had to change their
strategies to survive difficult times. Many business owners have decided to bring their business into
the online selling field. Due to lack of experience, many companies have suffered because some
applications could not handle many orders, add-on options, etc. As requested by Ms Ayumi Lucas,
our team has been assigned to create and build a computerised pre-order system for Secret Garden
bakery shop as it was clear that unprepared and irrelevant applications cannot fulfil the requirements
of business owners when selling their products. Our team has decided to build a system with all the
needed functions to make the pre-orders process more organised and faster. As a result, we have
created a system with pre-order functions and add-on options, and last but not least, customers can
now customise the design and choose custom-made products such as candles, cakes, etc.

29

You might also like