0% found this document useful (0 votes)
32 views3 pages

Q1V3

This document provides instructions for modifying the structure of a game to set the foundation for potential future changes. Students are asked to implement an Weapon enum with values of ARMGUN, RANGED, MELEE. They also need to create subclasses of the Supply class - Defensive and Empowering. The Defensive class should have attributes for whether the player is shielded and their current weapon. The Empowering class should have read-only attributes for action points and damage inflicted per turn. Constructors for each subclass are also specified.

Uploaded by

Marwan Helal
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)
32 views3 pages

Q1V3

This document provides instructions for modifying the structure of a game to set the foundation for potential future changes. Students are asked to implement an Weapon enum with values of ARMGUN, RANGED, MELEE. They also need to create subclasses of the Supply class - Defensive and Empowering. The Defensive class should have attributes for whether the player is shielded and their current weapon. The Empowering class should have read-only attributes for action points and damage inflicted per turn. Constructors for each subclass are also specified.

Uploaded by

Marwan Helal
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/ 3

German University in Cairo

Media Engineering and Technology


Prof. Dr. Slim Abdennadher
Dr. Nourhan Ehab
Dr. Ahmed Abdelfattah

Computer Programming Lab, Spring 2023


The Last of Us Legacy: Quiz 1

Password: YImVMKjuTk

Version 3
In this quiz, we will modify the structure of the game to set the foundation for the following
potential change.

1 Naming and privacy conventions


Please note that all your class attributes must be private and all methods should be public
unless otherwise stated. You should implement the appropriate setters and getters conforming with
the access constraints. Throughout the whole milestone, if a variable is said to be READ then we are
allowed to get its value. If the variable is said to be WRITE then we are allowed to change its value.
Please note that getters and setters should match the Java naming conventions. If the instance
variable is of type boolean, the getter method name starts by is followed by the exact name of the
instance variable. Otherwise, the method name starts with the verb (get or set) followed by the
exact name of the instance variable; the first letter of the instance variable should be capitalized.
Please note that the method names are case-sensitive.

For your task you need to implement the following:

2 Weapon
You need to add the following enum to your code:

Name: Weapon
Package: model.collectibles
Type: Enum
Description: An enum representing the type of weapon that can be owned by a player. Possible
values are: ARMGUN, RANGED, MELEE .

3 Supply
You need to add the following design to your code for class Supply:

3.1 SubClasses
There are two types of supplies, Defensive and Empowering. Each supply type should be
represented as a separate subclass of Supply. You need to add the following Class to your code:

3.2 Defensive
1. Name: Defensive
Package: model.collectibles
Type: Class

Description: A class representing the Supply type that can be owned by a player.

All the class attributes are READ and WRITE unless otherwise specified.
Attributes:

boolean shield: attribute used to indicate whether the player is shielded against zombie attacks or not. The
default value is false.
Weapon weapon: enum attribute which shows the current weapon owned by the player during each turn.

3.3 Constructors
Defensive(Weapon weapon): constructor that initializes the attributes of the Defensive
object.

3.4 Empowering
2. Name: Empowering
Package: model.collectibles
Type: Class

Description: A class representing the Supply type that can be owned by a player.

Attributes:

int coins: attribute used to retrieve Action points per turn for the player. The default value is 50. This
attribute is READ ONLY.
int fullPower: attribute used to inflict damage to the zombie’s HP per turn. The default value is 100. This
attribute is READ ONLY.
3.5 Constructors
Empowering( ): constructor that initializes the attributes of the Empowering object.

You might also like