[go: up one dir, main page]

0% found this document useful (0 votes)
424 views40 pages

RSD (G1)

The document outlines an object-oriented programming assignment to create a secondary school track and field competition enrollment system. It assigns tasks like the main menu, selection module, admin module, and billing module to 5 group members. It also provides screenshots and descriptions of the individual tasks and how the system would function for users and administrators.
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)
424 views40 pages

RSD (G1)

The document outlines an object-oriented programming assignment to create a secondary school track and field competition enrollment system. It assigns tasks like the main menu, selection module, admin module, and billing module to 5 group members. It also provides screenshots and descriptions of the individual tasks and how the system would function for users and administrators.
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/ 40

Tunku Abdul Rahman University College

BACS2023
Object-Oriented Programming

Assignment

Programme : RSD
Tutorial Group : G1
Date Submitted to : 10 December 2021
Tutor

Team Members:
No Student Name Student ID Contribution (%) Signature

1. Ng Jun Chen 20WMR12242 ng

2. Benedict Yap Zheng-Yi 20WMR11830 Y ap

3. Gan Eng Kiat 20WMR12361 Gan

4. Loo Kee Chen 20WMR12429 Loo

5. Pow Zheng Teng 20WMR12047 P OW

Total 100 -
Declaration

We confirm that we have read and shall comply with all the terms and conditions of TAR University
College’s plagiarism policy.

We declare that this assignment is free from all forms of plagiarism and for all intents and purposes is my
own properly derived work.

Signature : ng Y ap Gan Loo pow

Name : Ng Jun Chen Benedict Yap Gan Eng Kiat Loo Kee Chen Pow Zheng
Zheng-Yi Teng

Date : 9/12/2021 9/12/2021 9/12/2021 9/12/2021 12-Dec-2021

1
Table of Content
Content Page
Task Allocated 3
General Description 5
Individual Description Based on Own Task 6
UML Diagram 24
Explanation on Encapsulation, Inheritance and Polymorphism 25
Selection Module 25
Billing Module 27
Summary Module 30
Admin Module 31
Schedule Module 35

2
Task Allocated

No. Team Member Task(s) Allocated

1. Ng Jun Chen Main Menu

Selection Module

UML Diagram

2. Benedict Yap Zheng-Yi Admin Module

3. Gan Eng Kiat Summary Module

4. Loo Kee Chen Schedule Module

5. Pow Zheng Teng Billing module

3
4
General Description
Our group consists of 5 members which are Ng Jun Chen, Benedict Yap Zheng-Yi, Gan Eng Kiat,
Loo Kee Chen and Pow Zheng Teng. We decided to create a secondary school based track and
field competition enrollment system. In this system, the object-oriented programming and design
which are encapsulation, inheritance and polymorphism are to be implemented.

This enrollment system's target users are secondary school students. In this system, the students
can register to take part in the track and field competition. There are several event categories and
several events in a category and if the school has the intention of adding up the event, by signing
in as administrator can add events for the students to register and have fun. On top of that, admin
also can check on the signed up students info list. After students register their information and
choose the event they want to take part in, they will need the students to pay the bill and a
summary will print out after payment is successful.

5
Individual Description Based On Own Task

Name Description

Ng Jun Chen Main Menu

- Ask if the user want to sign up, check the competition schedule,
admin login or exit the program

Main Menu Screenshot 1:

Based on the Main Menu Screenshot 1, the system provides several


options for users to choose. If the user wants to sign up as a participant
and take part in the competition, the user will need to enter “1”. Else if the
user wanted to check the competition time schedule, then the user will
need to enter “2”. For the third choice which the user will need to enter “3”
is admin login, the user must be the admin of the system. Lastly, if the
user wishes to exit the program, enter “4”.

Selection Module

- Get contestant info and the event the users wants to take part in

Selection Module Screenshots 1:

6
After the user enters “1” in the main menu which is sign up, the system
will ask users to input their name first, then identity card(IC) number
followed by gender. All the input areas here contain validation. Such as
name input field cannot contain digits and left blank, identity card number
input field cannot contain character and must be 12 digits based on
Malaysia IC format and gender input field can only enter either ‘m’, ‘f’, ‘M’
or ‘F’ as ‘M’ represent male while ‘F’ represent female. If invalid input
occur, invalid input message will occur as the Selection Module Validation
Screenshots below

Selection Module Validation Screenshot 1:

Name input field is empty or contain digits

Selection Module Validation Screenshot 2:

7
After the name input field is valid, input IC and IC input contain character,
digits input length did not reach 12 and does not match Malaysia IC format
(third and fourth digit represent the birth month but the input is 13 but a
year only got 12 months so invalid).

Selection Module Validation Screenshot 3:

After entering the valid IC format, input gender. As the screenshot above
shows, users enter digit ‘1’, characters other than ‘m’, ‘f’, ‘M’ and ‘F’ and
the invalid input message occurs and asks the users to enter again. After
all the info is valid, the system will prompt users the event category menu
and ask the users to choose which category they want and after the users
choose, for example the users enter 1 which mean the user choose
category “Sprints”, then the system will print out the category “Sprints”
event menu as below

8
Selection Module Choose Event 1:

Then the system will ask the users again for the user’s choice. Then after
the users enter their choice, the record will be save down ask the user if
they want to continue sign up or go to billing as screenshot below shows

Selection Module Screenshots 2:

If the users enter 2 then the progress will start from where the system asks
users to choose the event category since the users had input their info
once and nobody would like to keep on entering their info again and again
if they want to take part in more events.

Selection Module Choose Continue Sign Up:

9
If the users choose “to Billing” then the output as below screenshots will
shows:

Selection Module Choose To Billing:

Benedict Yap Admin Modules


Zheng-Yi If the user chooses “3” in the main menu, then the system will bring the
user to the admin login page. In the admin login page, the system will
validate the admin id and password that has been entered by the user. If
the user enters the correct admin ID and password will be logged into the
system but if it is incorrect, the user will be prevented from accessing the
system and the admin ID and password will be required again. After
successfully logging in, the system will display multiple choices such as
visiting event status, generating reports and logout.

Screenshot 1: Admin login and Admin menu

10
In the Admin menu, when the user is choosing the option “1” which is the
event details. The system will bring the user to the event page and display
multiple choices such as visiting event status, updating event status,
editing event status and deleting event status.

Screenshot 2: Event menu

The user can choose option “1” to view the details about the event

Screenshot 3: display event

11
The user can choose option “2” to update new data for each event. The
system displays 5 options of the event to let users choose which event
wants to update new data in.

12
Screenshot 4: Update event

The user can choose option “3” to edit the event data. The system displays
5 options of the event to let users choose which data of the event that they
want to edit.

13
Screenshot 5: Edit event

The user can choose option “4” to delete the event data. The system
displays 5 options of the event to let users choose which data of the event
that they want to delete.

14
Screenshot 6: delete event

For the option “5” is to let the user go back to the previous page which is
the admin menu.

Screenshot 6: previous menu

At the admin menu, users can choose option “2” to generate the
registration of participant reports. The system will bring the user to the
report page and display multiple choices such as generating report,

15
generating report of male and generating report of female.

Screenshot 7: Report menu

The report will display “no record!” when no registration has been
registered in the system.

Screenshot 8: Generate report without data

The user can choose which type of the report that they want to generate
to view from the system.

Screenshot 9: Generate report with different option

16
1. Print out all the participant

2. Print out only male participant

3. Print out only female participant

17
For the option “4” is to let the user go back to the previous page which is
the admin menu.

Screenshot 10: previous menu

At the admin menu, users can choose option “3” to logout from the admin
menu and go back to the main menu.

18
Screenshot 11: Logout page

Summary Modules
1. After billing if the user chooses “3” to exit will display the summary
for users to refer their information in summary.
2. Summary displayed will return to the main menu after user keyin
“1”.
Summary display-Screen shot (1)

Schedule Module

19
-Let the user to know about the schedule of each sport events

Schedule Module ScreenShot 1

Schedule Module ScreenShot 2

Schedule Module ScreenShot 3

Schedule Module ScreenShot 4

Schedule Module ScreenShot 5

20
Schedule Module ScreenShot 6

Based on Schedule Module ScreenShot 1, the user can see that there are
5 selections in the menu. Then the user chooses the selection ‘2’ which is
‘Relay’, it will show another menu which like Schedule Module
ScreenShot 2. It will show a different menu when the user selects the
different page like Schedule Module ScreenShot 3. After the user selects
the sport event that he/she wants to see, it will show another menu like
Schedule Module ScreenShot 4. When the user decides to choose the
match he/she wants to see, it will show out the schedule of the match and
ask the user that he/she wants to go back to the schedule or main menu
like Schedule Module ScreenShot 5. If the user chooses 1, it will show like
Schedule Module ScreenShot 1 . If the user chooses 2, it will show like
Schedule Module ScreenShot 6.

Billing module
1. Pay the bill that has just been created
2. Pay the previous bill that already been created

21
In this module users are allowed to pay the bill for the sports they have
been registered in the registration module. Users can pay the bill they
have just created or paid the previous payment that they have not paid.

Screenshot 1 - Payment menu

In the screenshot 1 we can see 3 options for the user to choose.


Option 1 user will pay for the bill that has just been created. Option 2
allows users to pay for the previous payment they have created. Option
9 will exit the billing module and proceed to the next module.

Screenshot(2.1, 2.2) - Current payment and Previous payment

Screenshot 2.1 is if users enter 1 in the payment menu, the system will
show the payment that is just created. While screenshot 2.2 is user enter
2 in the payment menu, the system will display the bill that is already
created including the bill that is just created and it will display a message
to call the user to enter the bill ID that user wanted to pay.

Screenshot(3) - Make Payment

22
Screenshot 3 is the after the user selected the bill they wanted to pay.
The system will prompt a message to ask the user whether the user
wanted to confirm the payment. If yes, the system will display the total
price and ask users to enter the money to pay. If not, the system will
return to the payment menu.

Screenshot(4) - Display Payment

After the user pay the bill, a message like screenshot 4 will be display.

23
UML Class Diagram

Explanation on Encapsulation, Inheritance and Polymorphism

Selection module
24
Name Implementation Description
of Concepts

Encapsulation

Based on the screen shots above, getter and setter


methods are declared in the constructor called
ContestantInfo. The variables in this class are
declared as private, so that the outsider cannot

25
simply access and update the value of the
variables.

Inheritance In the Selection Module, after getting the user input


(participant info), the system will bring the user to
choose the event category they want to take part in,
such as sprints, relays, and so on. After the user
selects the event. Let’s say the user chose the
sprint category, inside the sprint category there are
100m, 200m and 400m events for the user to
choose. Since there is so many event category, so
subclass is created and extends keyword is used as
screenshots below:

Class Sprints, Relays, Distances, Jumps and


Throws are subclasses of SelectionModule.

Polymorphism Since the subclass is created which means


inheritance is achieved, now it’s time for
polymorphism. Polymorphism will allow us to
perform the same action but in different ways. In the
Selection Module, a printMenu() and
getMenuInput() method are declared as below

For asking the user to choose an event category,


then based on the user choice, the system will go
to the particular subclass to override the
printMenu() and getMenuInput() methods to display
the event in the category and get the choice of user
which event they choose such as below, let’s say if
the user choose category sprint

26
27
Billing Module

Name Implementation Description


of Concepts

Encapsulation

I have put getter and setter methods in the class.


Because the variable we have declared is set to
private so the user cannot directly get data by
calling the variable, so the getter and setter is
implemented for the user to get and set the data of
the object.

28
SuperClass: Bill
SubClass: CreateUpdateBill

SuperClass: CreateUpdateBill
SubClass: Male, Female

Bill class is the super class. Within the super class


i have implemented data members, constructor
Inheritance and methods.
Example:
Data member: private String name
Methods : public void getName()

CreateUpdateBill inherits all the data member and


getter setter methods from Bill class.
CreateUpdateBill can access superclass data
members, methods and more.
For example, CreateUpdateBill can use super
class method getName()

Male and Female class extends from


CreateUpdateBill. They have access to Bill and
CreateUpdateBill data members, methods and
more.

29
Figure 1

Polymorphism

Figure 2

Figure 1 is a method from the Bill(superclass,


Layer 1) and Figure 2 is a method from
CreateUpdateBill(subclass of Bill, Layer 2). Figure
2 method Override the method from Bill.

If the user only wants the Bill class data the user
can call the method by (Bill)(variable
name).toString(). If the user wants the data that is
implemented in CreateUpdateBill, the user needs
to call the method by (CreateUpdateBill)(variable
name).toString().

30
Summary Module

Name Implementation of Description


Concepts

Summary Module The main function for the summary module is to


display a summary for users to check their own details
like name, how many events selected, payment status
whether it is pending or alrd paid. After displaying all
the summary for the user, it will show “End” and show
“Enter 1 to exit to main menu” (have try catch) after
user keyin 1 it will return to main menu.

Encapsulation Encapsulation in Java is a mechanism of wrapping the


variables and code acting on the methods together as
a single unit, the variables class will hide from other
classes, and it can be accessed only through the
methods of their current class. To achieve
encapsulation the easiest way is to provide a public
getter and setter methods to modify and view the
variables values. Example as below…

The BillSummary class has the getter and setter for


the Summary class to call out the method for
displaying the user profile.

Inheritance Inheritance is a mechanism in which one object


acquires all the properties and behavior of a parent
object.

Terms that used in Inheritance


Class, Sub class, super class, reusability.

31
In my SummaryDate i extends the CreatSummary,
SummaryDate is my subclass and CreatSummary is
my super class. It can get all those information,
methods from CreatSummary.

The CreatSummary has all those contestant info so


that SummaryDate can display the user info and add
the date time.

Polymorphism Polymorphism that is used in assignment is just


overriding by adding a toString function to print out the
information.

A override toString in CreatSummary that print


contestant information.

A override toString in SummaryDate to print out the


date time. Which superclass is CreatSummary.

32
Admin Module

Encapsulation In the Admin.java there are getter and setter methods to


get and set the data in it. This is because all the data in
Admin.java was made private and other classes will not
be able to access the data through the private data
member.

Inheritance In the AdminMenu.java there is a superclass called


Report with two subclasses called ReportMale and
ReportFemale.

33
The subclass (ReportMale) and (ReportFemale) were
extended from superclass (Report). Then the
(ReportMale) and (ReportFemale) will inherit all the data
members and methods from (Report). All the methods
from (Report) can be accessible by (ReportMale) and
(ReportFemale).

In the (Report) has a method called printReportFormat()


with the function to display the format of the report. So
the (ReportMale) and (ReportFemale) can inherit and use
the method from the (Report).

Example

printReportFormat() method in the superclass Report

Call the method with the super keyword from the


superclass Report

Polymorphism In the AdminMenu.java there is a superclass called


Report with a method called printReport(). Then the
subclass of Report is ReportMale and ReportFemale.
Inside the subclass have their own implementation of
report type with the same method name which is
34
printReport().

For example, the user has three report types to choose to


display the report.(refer to Figure 1)

Report type selection include


- display all the data reports (refer to Figure 2)

- display data reports where the gender is male


(refer to Figure 3)

- display data reports where the gender is female


(refer to Figure 4)

Figure 1

35
Figure 2

Figure 3

Figure 4

36
Schedule Module

Encapsulation

37
There are getter and setter methods in the class. the
user cannot get the data directly by calling the
variable because the variable we declared is set
private so getters and setters are implemented to get
and set the object's data.

Inheritance

In the schedule module, the users can choose the


schedule that they
want to see, they will see 5 selections which are

38
Sprint , Relay, Middle and Long distances, Jump and
Throw.

This ‘Timetable….’ class is to show the table that the


users want to see.

Polymorphism

There are still many polymorphism parts in my code,


so I just screenshot some to explain. Based on the
screenshot above, I use void ‘timetable13’ to store all
the time tables of the 13 - 14 years old matches like
sprint, relay , jump and others. I also use this
technique in 15-16 years old matches and 17 years
old matches which are ‘timetable15’ and ‘timetable17’.

39

You might also like