Programming for Software Engineers: University Sports Center Java

Verified

Added on  2022/08/18

|17
|2434
|17
Project
AI Summary
This Java program is designed to manage and maintain the activities of a University Sports Center. Students can book group exercises, provide feedback, and access monthly reports. The system includes classes for booking (GrpExercise, ModifyBooking), feedback (ReviewClass), reporting (MonthlyReport, ChampionClass), and a main class (UniversitySportCentre) to manage user interactions. It covers booking processes, modification of bookings, feedback collection, monthly report generation (student attendance, ratings, popular class), and a champion class report. The program uses a simple class design pattern, SOLID principles, and some DAO design patterns. JUnit testing is implemented to ensure the functionality of the program, with test cases for each class. Refactoring is used to improve the code's structure and readability. The program includes UML class diagrams, program explanations, and assumptions, highlighting the limitations (lack of database, console-based interface) and potential improvements.
Document Page
Running Head: PROGRAMMING FOR SOFTWARE ENGINEERS
PROGRAMMING FOR SOFTWARE ENGINEERS
Name of the Student
Name of the University
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
1PROGRAMMING FOR SOFTWARE ENGINEERS
Table of Contents
UML Class Diagram............................................................................................................2
Program Explanation...........................................................................................................3
Assumptions about the System............................................................................................5
Design and Structure of the Program...................................................................................6
Design Principle and Pattern...............................................................................................8
JUnit Testing........................................................................................................................9
Refactoring........................................................................................................................10
Commit Message...............................................................................................................11
Document Page
2PROGRAMMING FOR SOFTWARE ENGINEERS
UML Class Diagram
Class diagram for the University Sports Center
Document Page
3PROGRAMMING FOR SOFTWARE ENGINEERS
Program Explanation
This is a Java program that is used to manage and maintain the activity of the University
Sports Center. According to the university sports center, students can book any group exercise by
specifying the day and the group exercise name. The university sports center provides exercise
classes on Sunday and Saturday every week where students can book exercise classes either on
Sunday or Saturday. Students are allowed to book as many classes of exercise class until the time
does not conflict with other classes. The university also allows every student who attends any
group exercise can give their valuable feedback on their experience, which helps centers to come
up with new and updated things. Sports Center provides various group exercise classes for their
students like Zumba, yoga, aquacise, box fit, and body blitz. Students can enroll themselves by
giving some information related to their classes. The university sports center offers group
exercise classes in three different time slots on Saturdays and Sundays: The time slots are
morning: 8: 00–11: 00; 2. Noon: 12: 00–3: 00; 3.Evening: 6: 30–9: 30. Students can join any
group exercise class from the above-listed class name. The student also has to select their class
time and class day whether they want to attend the class on Saturday or Sunday. After providing
this information, the student has to pay a fee for the class, and then the student can attend group
exercise classes on the specified day.
After attending the class, students can give ratings and reviews about the class based on
their experience. Students can only provide a summary in a line and give a rating between 1 and
5. The above system is also capable of generating a monthly report, which includes details of
students and their average rating on a daily basis. This report prints out the total number of
students who attend the class and their feedbacks. The above system is also able to generate a
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
4PROGRAMMING FOR SOFTWARE ENGINEERS
monthly report which prints the most popular class of the month with total income from the most
popular group exercise classes.
The above-discussed system is implemented using five separate java classes, and one
main class, the classes, are GrpExercise, ModifyBooking, MonthlyReport, ChampionClass, and
ReviewClass with one main class called UniversitySportCentre. These classes are discussed
below.
1. GrpExercise: This class controls the booking process for a group exercise class. This
class uses four different methods to carry out the booking process, and the methods
are SaturdayClass(), SundayClass(), AnotherBooking(), and bookinglist(). Whenever
Students wants to book a new class, then the main method calls this class which asks
the student to select group exercise class along with day and time slot after this
system prints out all relevant information with booking message.
2. ModifyBooking: This class works the same as the GrpExcercise only difference is
that its prints previous booking details which student want to change and after
successfully change the details system prints relevant information with booking
modified message.
3. ReviewClass: This class asks students to give their valuable feedback and rating
based on their class experience. In this class, a constructor is used to perform the
operation mentioned above.
4. MonthlyReport: This class is responsible for generating a monthly report. This class
has one constructor and one method. This class calls the RatingList () method, which
prints 20 reviews and ratings with other relevant information, as mentioned above.
Document Page
5PROGRAMMING FOR SOFTWARE ENGINEERS
5. ChampionClass: This class is used to generate a report which contains a popular class
of the month and total income from those popular class. For creating a report system,
ask the user to select a month, and based on the user input, it generates a report.
6. UniversitySportCentre: This is the main class of the system, which is used to run the
program, and this class is responsible for managing class calls and user input.
Assumptions about the System
In the program, as mentioned earlier, it is seen that the system is not perfect or accurate.
In the system discussed above, some of the significant functionality can be added, which helps
the system works accurately. As per the above discussion in this system, there is no concept of
database which makes the system weaker. It stores each data using the array list at run time, and
the nature of the array and array list is that it removes all of its data after the program completes
its execution. So it is not possible to retrieve any kind of data after the program terminates
because every data is lost after the program ends. Although if the program uses a database, then
every information can be stored and retrieved at any point of time, which makes the system more
reliable. The above program is console-based, and there is no concept of any GUI which works
through command. The above-discussed program is only work in java ide and from the
command prompt. If the program is developed using a GUI framework which makes the
program easy to navigate and easy to use.
Document Page
6PROGRAMMING FOR SOFTWARE ENGINEERS
Design and Structure of the Program
According to the above program description, there are five different java classes used to
develop the above-discussed system with the main method, which is used to execute the
program. The main class of the system is responsible for calling classes based on user input. In
the main class, there is a method called UniversitySportCentre, which is used to perform all the
significant functionality of the main class. First of all, the main class calls the
UniversitySportCentre method after the program started executing because this method is used to
perform all the primary activities of the program. This method first prints a menu based on this
menu user can perform five different events. The list contains five different options like book a
group exercise, change a booking, attend a class, monthly class report, and monthly champion
class report along with an exit option. Users can only select one option from the menu mentioned
above, and based on the user input, the system calls appropriate methods and class to perform the
specific activity. If the student wants to book a group exercise class, then the student has to select
the first option from the menu after selecting the choice the main class calls GrpExcercise class
and the methods of this class which ask users to choose exercise class day either Sunday or
Saturday because University sports center provides only exercise classes on weekends. After this
system asks the user to select exercise class from the list, then the system asks the user to choose
a time slot after successfully selecting the time slot system reserve a space for the students and
displays all the information related to the class with a booking message.
After performing the activity mentioned above program, ask the user to book another
group exercise class if the user press ‘Y or y,’ then the program calls AnotherBooking method,
which asks the user to book another class and this class again calls the GrpExcercise class
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
7PROGRAMMING FOR SOFTWARE ENGINEERS
contractor who performs the booking operation. The above program also provides a feature to
change and modify the previous booking if the user wants to change or alter their classes then the
user has to select Change a Booking option from the menu then the program calls a method of
GrpExcecise class called BookingList() which holds the details of previous booking and this
method displays the previously booked class details from the array list then the main class calls
ModifyBooking class, and this class is responsible for modifying details of the already scheduled
class. This class works the same as GrpExcercise class, and this class asks the user to provide
appropriate information then the system changes the previously booked class details with the
recent update. After modification program prints all the information with modified details.
The next option of the menu list is ‘Attend the class,’ this option is basically used to take
user feedback after attending the class. If the user selects this option, then the main method calls
ReviewClass class, which ask the user to give a short review about the class based on their
experience and also provide a rating on the scale of 1 to 5 after taking the review the program
displays the review and rating on the screen.
The next two option of the menu is used to generate two different types of report. If the
user selects the monthly report option, then the main class calls MonthlyReport class, which
prints average numbers of students on a daily basis with 20 reviews and average ratings. If the
user selects the Monthly champion class report option, then the program calls ChampionClass
class, which asks users to choose the month from the list, and based on the user input its prints
the most popular class name with the total income.
Document Page
8PROGRAMMING FOR SOFTWARE ENGINEERS
Design Principle and Pattern
There are many different types of design principles, and patterns are present in the
market. It is essential to follow the design pattern and principle of developing any kind of java
program. In the system mentioned above, Simple class design pattern and solid principle with
some of the DAO design pattern is used. The significant advantage of the DAO design pattern is
that any progressions made in the code can be handily distinguished. As per the above
discussion, the database is not used for storing data, so a simple class design pattern is used.
According to the class diagram, every class which is used to implement the above program is
directly associated with the main class, so the main class easily call any of the classes through
DAO. Every class of this program follows some of the principles of the SOLID principle such
that Single responsibility, open-closed principle. Every class which is utilized to actualize the
above program follows the single responsibility principle. The initial idea of this standard is that
each class performs just a single activity. In the above program, mainly simple class design
patterns and SOLID principles are used along with some DAO design pattern to implement the
program.
Document Page
9PROGRAMMING FOR SOFTWARE ENGINEERS
JUnit Testing
JUnit Testing is used in java for unit testing. It is an open-source framework that is used
to test program functionality. Junit testing helps to identify the program is working correctly or
not by checking a small piece of code. JUnit testing assists with quickening program execution
time, and it is implemented by generating a method and way. Junit Testing also helps to identify
errors in the code, which makes the program more accurate and correct. JUnit testing applied
before creating the actual program because it helps to check the actual system is working
correctly or not.
In this program, Junit testing is used to make sure the functionality of the program. In the
program mentioned above, five test classes are created to make sure every class works correctly.
The test case is TESTChampionClass, TESTGrpClass, TestModifyBooking, TestMonthlyReport,
and TestReviewClass. As per the name, it is seen that for every class, there is a test case. Every
test cases check the user input to guarantee the right information is given by the user or not. If
the user input information is coordinated with the test cases, at that point of time, it should return
true else; it returns false. For this activity, the assertEqual method is utilized and brings in each
test case.
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
10PROGRAMMING FOR SOFTWARE ENGINEERS
Refactoring
Refactoring is a procedure of improving the inner structure of the system programming
without changing the outside conduct of the application. It helps to improve the code of the
program, which creates the code more useful and readable. The refactoring process is
challenging to perform because it is a self-evident process, and most of the time, refactoring used
estimation of the process. This process helps to make the application more useful, and any
addition or removal of the features is possible without modifying the entire program. It also helps
to maintain the applications, and it also helps to identify bugs from the code.
In the program mentioned above, a very simple refactoring technique is used in the form
of code. Every class which is used to implement the above program is directly related to the main
class, so on every occasion, a new elegance is created, and it could be easily referred to as from
the primary method without changing the existing code because each class is known as from the
principle approach. Memory allocation is done in the main class.
Document Page
11PROGRAMMING FOR SOFTWARE ENGINEERS
Commit Message
Fig1: Initial Commit
chevron_up_icon
1 out of 17
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]