代写ITP4905 Object Oriented Programming
Page 1 of 8
DEPARTMENT OF INFORMATION AND COMMUNICATIONS TECHNOLOGY (TSING YI)
HD in Data Science and Analytic
HD in Telecommunication and Networking
ITP4905 Object Oriented Programming
Assignment
Assignment Due Date and Time: 11 April 2024 (Thursday) 23:55 (through Moodle)
Fitness Centre System
A fitness centre in the local area has decided to modernise its management system for classes and
equipment. To simplify the process, the centre has opted to implement a new system using Java
with an object-oriented approach. The system will efficiently manage various types of fitness
classes and gym equipment, allowing the centre’s manager to easily manage on the system as
needed.
You are required to take the Java Object Oriented Approach to develop a prototype for a fitness
centre. This prototype provides a comprehensive system for managing a fitness centre. It will allow
operations such as adding, removing, and displaying various fitness classes and equipment.
Please note that the following classes are necessary for the proper functioning of this prototype:
1. FitnessItem.java
2. FitnessClass.java
3. Equipment.java
4. Manageable.java
5. MaxNumberException.java
6. FitnessCenterSystem.java
When developing your system prototype, you are required to handle all possible exceptions that
could occur. To do this, you should use try-catch blocks and provide error messages that are easy
for the user to understand.
Page 2 of 8
The class descriptions and sample program will be shown below.
Class Descriptions
1. FitnessItem
FitnessItem is an abstract class that serves as a base for different types of fitness items in the
system. It implements Serializable. This class has the following structure:
Attributes
itemName A string representing the name of the fitness item.
usageTime A decimal number representing the average usage time in hours per day.
Constructor Initializes a fitness item with its name and usage time.
Abstract
Method
printDetails An abstract method to be implemented by subclasses in order to print the
details of the fitness item.
Other Methods
Setter/Getter Standard getters and setters for the attributes.
toString An overridden method that returns a string representation of the fitness item.
2. FitnessClass
The FitnessClass class is a subclass of FitnessItem. It represents a fitness class at the fitness center.
Its structure is as follows:
Attributes
maxParticipants An integer variable hold the maximum number of participants in the fitness
class
Constructor Initializes the FitnessItem item with its name, usage time and max number
of Participants.
Methods
getMaxParticipants Getter method for the maximum number of participants
setMaxParticipants Setter method for the maximum number of participants
printDetails Overridden method from FitnessItem that prints out the details of the
FitnessClass in a formatted manner.
Other Methods
toString An overridden method that returns a string representation of the
FitnessClass
3. Equipment Class
Page 3 of 8
The Equipment class is a subclass of FitnessItem. It represents a type of gym equipment found in a
fitness center. Its structure is as follows:
Attributes
equipmentType A string representing the type of equipment (e.g., "Cardio", "Strength" and
etc).
spaceRequired A double representing the amount of space required for the equipment in
square meters.
Constructor Initializes the equipment item with its name, usage time, equipment type,
and space required.
Methods
getEquipmentType Getter for the equipment type.
setEquipmentType Setter for the equipment type.
getSpaceRequired Getter for the space required.
setSpaceRequired Setter for the space required.
printDetails Overridden method from FitnessItem that prints out the details of the
equipment in a formatted manner.
toString An overridden method that returns a string representation of the Equipment
4. Manageable Interface
The Manageable interface comprises a set of methods that allow the system to manage fitness
items.
Methods
addNewItem Adds a new FitnessItem to the system.
It accepts a FitnessItem object as an argument
Throws MaxNumberException if the max number limited is exceeded
removeItem It removes a fitness item from the management system
It accepts the name of the item as a string argument
findItem Finds and returns a FitnessItem by name.
It Accepts the name of the item as a string argument
It Returns the found FitnessItem object, or null if not found
5. MaxNumberException
The MaxNumberException is a subclass of Exception. It is a custom exception that is thrown when
a maximum number limit is exceeded.
Methods
Constructor It accepts String errorMessage as the specified detail message.
6. FitnessCenterSystem
The FitnessCenterSystem class, which implements the Manageable interface, manages the
operations of a fitness center. It handles user interactions and manages fitness items such as classes
and equipment. The major components include:
Page 4 of 8
Attributes
equipmentItems An array of FitnessItem objects to store different equipment.
fitnessClasses An array of FitnessItem objects to store different fitness classes.
MAX_EQUIPMENT A constant integer representing the maximum number of equipment
items (set to 5).
MAX_CLASSES A constant integer representing the maximum number of fitness classes
(set to 5).
equipmentCount An integer counter for the current number of equipment items.
classCount An integer counter for the current number of fitness classes.
scanner A Scanner object for reading user input.
Constructors
Default constructor initializes the fitnessItems list
Constructor with a filename parameter to load fitness data from a file.
(Only required in advanced stage )
Methods
startSystem Starts the fitness center system and displays the menu to the user.
addFitnessItem Adds a new fitness item (class or equipment) based on user input.
findFitnessItem finds a fitness item based on user input.
displayFitnessItems, Display methods for FitnessItems
displayEquipmentItems Display methods for EquipmentItems
displayFitnessClass Display methods for FitnessClass
loadFitnessData Loads fitness items data from a given file.
findItem an override method from the Manageable interface
to find an item.
addNewItem an override method from the Manageable interface
to add an item.
removeItem an override method from the Manageable interface
but no implementation is required
Prototype of the System
The system can store up to 5 equipment items and 5 fitness classes. The program should present an
option menu for the user to select their desired action after execution.
Welcome to the Fitness Center Management System
1. Add a new fitness item
2. Find a fitness item
3. Display all items
4. Display all Equipment items
5. Display all fitness class
6. Exit
1. Adding New Fitness Class
Choose to add a fitness class, enter name "Yoga Class", usage time 2 hours, and max participants
20.
Page 5 of 8
Welcome to the Fitness Center Management System
1. Add a new fitness item
2. Find a fitness item
3. Display all items
4. Display all Equipment items
5. Display all fitness class
6. Exit
Choose an option: 1
Add Fitness Item:
1. Fitness Class
2. Equipment
Choose type: 1
Enter item name: Yoga Class
Enter usage time (in hours): 2
Enter max Participants: 20
Item added: Yoga Class, 2.0 hours/day, max participants=20
Show the menu again...
2. Test Adding New Equipment
Choose to add equipment, enter name "Treadmill", usage time 1 hour, equipment type "Cardio",
and space required 10 sq.m.
Welcome to the Fitness Center Management System
1. Add a new fitness item
2. Find a fitness item
3. Display all items
4. Display all Equipment items
5. Display all fitness class
6. Exit
Choose an option: 1
Add Fitness Item:
1. Fitness Class
2. Equipment
Choose type: 2
Enter item name: Treadmill
Enter usage time (in hours): 1
Enter equipment type: Cardio
Enter space Required: 10
Item added: Treadmill, 1.0 hours/day , equipmentType=Cardio, spaceRequired=10.0
Show the menu again...
3. Find a Fitness Item
Choose to find a fitness item, enter the name "yoga".
Welcome to the Fitness Center Management System
1. Add a new fitness item
2. Find a fitness item
3. Display all items
4. Display all Equipment items
5. Display all fitness class
6. Exit
Choose an option: 2
Enter the name of the item to find: Yoga
Item found:
FitnessClass Yoga 2.0 Max Participants: 30
Page 6 of 8
Show the menu again...
4. Find an Equipment
Choose to find a fitness item, enter the name "Treadmill".
Welcome to the Fitness Center Management System
1. Add a new fitness item
2. Find a fitness item
3. Display all items
4. Display all Equipment items
5. Display all fitness class
6. Exit
Choose an option: 2
Enter the name of the item to find: Treadmill
Item found:
Equipment Treadmill 4.0 Type: Cardio, Space Required: 10.0 sq.m
Show the menu again...
5. Find a non-existent item
Choose to find a fitness item, and enter the name "hello".
Welcome to the Fitness Center Management System
1. Add a new fitness item
2. Find a fitness item
3. Display all items
4. Display all Equipment items
5. Display all fitness class
6. Exit
Choose an option: 2
Enter the name of the item to find: Hello
Hello is not available.
Show the menu again...
6. Test Display All Fitness Items
Precondition: Assume FIVE fitness class and FIVE equipment items are added.
Input: Choose to display all fitness items.
Welcome to the Fitness Center Management System
1. Add a new fitness item
2. Find a fitness item
3. Display all items
4. Display all Equipment items
5. Display all fitness class
6. Exit
Choose an option: 3
Fitness Center Items:
Type Description Hour Additional Info
Equipment Treadmill 4.0 Type: Cardio, Space Required: 10.0 sq.m
Equipment Dumbbells 5.0 Type: Strength, Space Required: 2.0 sq.m
Equipment Rowing Machine 3.0 Type: Cardio, Space Required: 8.0 sq.m
Equipment Exercise Bike 3.5 Type: Cardio, Space Required: 6.0 sq.m
Equipment Kettlebells 4.0 Type: Strength, Space Required: 3.0 sq.m
FitnessClass Yoga 2.0 Max Participants: 30
Page 7 of 8
FitnessClass Spinning 1.5 Max Participants: 25
FitnessClass Aerobics 2.0 Max Participants: 20
FitnessClass Zumba 1.5 Max Participants: 25
FitnessClass Pilates 2.0 Max Participants: 15
Show the menu again...
7. Test Maximum Capacity for Fitness Classes
Input: Repeatedly add Fitness Classes items until the count reaches 5(the maximum).
Welcome to the Fitness Center Management System
1. Add a new fitness item
2. Find a fitness item
3. Display all items
4. Display all Equipment items
5. Display all fitness class
6. Exit
Choose an option: 1
Add Fitness Item:
1. Fitness Class
2. Equipment
Choose type: 1
Enter item name: new class
Enter usage time (in hours): 2
Enter max Participants: 20
Max number of Fitness Classes have been created
Show the menu again...
8. Test Maximum Capacity for Equipment
Welcome to the Fitness Center Management System
1. Add a new fitness item
2. Find a fitness item
3. Display all items
4. Display all Equipment items
5. Display all fitness class
6. Exit
Choose an option: 1
Add Fitness Item:
1. Fitness Class
2. Equipment
Choose type: 2
Enter item name: new equipment
Enter usage time (in hours): 2
Enter equipment type: Cardio
Enter space Required: 2
Max number of Equipment have been created
Show the menu again...
9. Test Invalid Input
Input: Choose to add any new item but enter non-numeric values for usage time or max
participants.
Expected Output: An error message indicating invalid input and prompting for correct data.
Page 8 of 8
Advanced Stage (Optional)
As part of this bonus stage, you are optionally defining the loadFitnessData method. This method is
designed to load fitness item data from a specific file. This method allows users to be accurately
and efficiently loaded into your application.
Instructions to Students
1. This is an End of Module Assessment, and the weighting of this assignment is 20% of the Module
Mark.
2. This assignment should be done by each individual student. Plagiarism will be treated seriously.
All assignments that have been found involved wholly or partly in plagiarism (no matter these
assignments are from the original authors or from the plagiarists) will score Zero mark.
3. You must use Java JDK8 or above to develop the programs.
4. Your programs must follow the coding standard stated in Java coding standard published by
Oracle and Sun Microsystems. Marks may be deducted if the coding standard is not followed.
5. You are required to hand in
• A 1 to 2 pages word document briefly explains how your program shows the concept of
Object Oriented Programming (Abstraction, Encapsulation, Inheritance and Polymorphism).
• Source code of all classes which should be well-commented.
• The evidence of testing. Prepare a word document with a number of test cases showing
different inputs for different situations that your program may encounter and how your
program responses to show the capability of your program. For each test case, states the
objective of the test case, input data and expected result. You should also include screen
dumps for each test run as evidence.
6. Submit all your works (in a zip file under the name of your student ID – e.g. 23xxxxxxx.zip ) to
the Moodle website (http://moodle.vtc.edu.hk) by 23:55, 11 April 2024 (Thurday). Late
submission may score ZERO mark.
7. Mark Distribution
l Documentation and Evidence of Testing (10%).
l Exception Handling (10%)
l Basic Stage (80%):
n FitnessItem.java, FitnessClass.java Equipment.java,FitnessCenterSystem.java
Manageable.java, MaxNumberException.java. These classes are to be
implemented exactly as the listed requirements in this document.
n The system prototype contains the main method. You may add methods other
than main in your main class; and/or add other classes of your own to make
your system run.
l Optional Bonus Stage (max 10% bonus):
请加QQ:99515681 邮箱:99515681@qq.com WX:codinghelp
- 外贸初体验 WhatsApp拉群工具如何在我业务中点燃用户体验的激情之火
- 碧桂园服务物业管家帮助业主找到失而复得的贵重资料
- TG/Telegram自动采集群发软件,TG批量拉群发助手,纸飞机炒群工具
- instagram营销软件,欢迎联系天宇爆粉【TG:@cjhshk199937】
- WhatsApp协议注册/ws注册工具/WS协议注册软件
- 便捷Line代群发,助您迅速提升用户互动!
- Ins批量筛选群发营销采集神器,Instagram助你打造营销新局面!
- 跨境电商!商家利用 telepram 群发协议,品牌推广如虎添翼
- 数字市场风云:专家心法,LINE云控营销工具为何引发好奇,业务成功势不可挡
- 海外销售专家提问 WhatsApp拉群营销工具真的是业务成功的黄金钥匙吗
- 中国修理网:传承匠心,打造一站式维修服务平台
- 精准管理网络通信:Line协议号注册器助力工程师轻松分配标识
- AIC2100代写、Python设计程序代做
- 外贸小白迷茫中 WhatsApp拉群营销工具有什么好用的 值得推荐吗
- ins群发软件,ins营销软件,ins拉群软件天宇爆粉【TG:@cjhshk199937】
- 金华市中心医院肝胆胰外科完成浙江省首例“单孔机器人辅助肝癌切除术”
- 数字产品交易平台的革新力量
- 再突破!仁济医院嘉定分院完成国产单孔机器人医源性输尿管狭窄修复术
- 未知商机的科技征途:WhatsApp筛选器推广打开国际大门
- Ins引流工具全新升级,Instagram群发工具助你实现营销突破!
- WhatsApp群发软件,ws营销软件/ws协议号/ws拉群/ws业务咨询大轩
- 聚焦两会丨加快推进医疗健康数字化建设 神州医疗以尖端技术赋能医院高质量发展
- ins批量群发秘籍!Instagram 2024最新群发软件推荐,Ins引流轻松搞定!
- 线上隐形矫正结果不如传统矫正可靠?真相是什么?
- 商业腾飞的关键 WhatsApp拉群工具揭示潮流趋势 让你的业务脱颖而出
- 外贸的未知星球,充满神秘与机遇。作为一位科幻魔法师,我时刻寻找着能为业务注入前所未有体验魔力的工具。而WhatsApp拉群工具,正是我近期发现的宝藏。
- Alpha系统重大更新,公司主体库性能再创新高
- 从业务零基础到高手巅峰 WhatsApp拉群工具如何让我在外贸领域快速崭露头角
- 磁化水器:引领健康饮水新风尚
- Ins最好用的群发软件,Instagram脚本打粉引流工具即将发布!
推荐
- 创意驱动增长,Adobe护城河够深吗? Adobe通过其Creative Cloud订阅捆绑包具有 科技
- 老杨第一次再度抓握住一瓶水,他由此产生了新的憧憬 瘫痪十四年后,老杨第一次再度抓握住一瓶水,他 科技
- 疫情期间 这个品牌实现了疯狂扩张 记得第一次喝瑞幸,还是2017年底去北京出差的 科技
- 苹果罕见大降价,华为的压力给到了? 1、苹果官网罕见大降价冲上热搜。原因是苹 科技
- 智慧驱动 共创未来| 东芝硬盘创新数据存储技术 为期三天的第五届中国(昆明)南亚社会公共安 科技
- 如何经营一家好企业,需要具备什么要素特点 我们大多数人刚开始创办一家企业都遇到经营 科技
- B站更新决策机构名单:共有 29 名掌权管理者,包括陈睿、徐逸、李旎、樊欣等人 1 月 15 日消息,据界面新闻,B站上周发布内部 科技
- 升级的脉脉,正在以招聘业务铺开商业化版图 长久以来,求职信息流不对称、单向的信息传递 科技
- 全力打造中国“创业之都”名片,第十届中国创业者大会将在郑州召开 北京创业科创科技中心主办的第十届中国创业 科技
- 丰田章男称未来依然需要内燃机 已经启动电动机新项目 尽管电动车在全球范围内持续崛起,但丰田章男 科技