+1(978)310-4246 credencewriters@gmail.com
  

Learning outcomes (LO):
1. Explore key principles, methods, tools and frameworks used in the development of mobile
games.
2. Describe the processes used to solve development problems.
3. Demonstrate developing literacy in key programming languages for mobile game
development.
4. Review individual learning, practices, and strategies as developers of mobile games
Scenario 1: (LO1, LO2, LO3)
The Ocean Race 2021-22 route is announced. Yachts are ready to sail and will visit 10 international
cities, including the start port and the Grand Finale finish in Genoa, Italy. In ocean navigation,
degrees and minutes (for latitude and longitude) are used to measure locations along with the
direction. Degrees of latitude are either north (N) or south (S) measured from 0 to 180 degrees and
degrees longitude are either east (E) or west (W) measured from 0 to 90.
Example: 38°56’N, 71°0’W is 38 degrees 56 minutes North and 71 degrees 0 minutes West.
Task:
1. Your task is to create a class Yacht that includes the yacht’s number and location (LO3).
a) For Yacht’s Number : You have to number each yacht object as it is created using a
constructor. To do this, you will have a data member that holds a serial number for
each object created from the class. Then you will need another data member that
records a count of how many objects have been created so far.
b) For Yachts Location : Create a class Location that has three member variables -i)
int for degrees (explained above)
ii)
float for minutes (explained above)
iii)
Char for direction letters N,S,E,W
Location class has variables like longitude and latitude. Location class
includes one member getpos() which obtains a location value in degrees
(between 0-180) and minutes (between 0 to 60) and direction (N,S,E,W) from
the user.
c) One member function [ get_pos() ] of the Yacht class should get a position from the
user and store it in the object; Another member function [ display() ] should report
the yacht number and location. display() use two variables from Location class to
represent the yacht’s location, latitude and longitude. display() function will display
the location latitude and longitude in 148°26’ N format.
d) The main() program creates three yachts, asks the user to input the location and
then displays each yacht’s number and location.
2. Prepare the UML class diagram for the Location class (LO1).
3. Clearly describe the process used to solve the problem with the help of appropriate
comments that increases the readability of the program (LO2).
Note: Use the hex character constant ‘xF8’ to display a degree symbol (°). Sample
output :
3
4
Scenario 2: (LO 1, LO 3)
Suppose that you are part of a team which is creating a role-playing game (RPG). You have
been asked to create the foundational classes to represent player characters, that is, the
entity within the game that the user of the game software controls.
The Player Base Class: LO3
• The Player base class contains name, race, hitPoints, and magicPoints data members
for the players.
• It provides a constructor with four parameters corresponding to all of the four data
members.
• It provides getters and setters member functions for all the four data members.
• These four data members will be common to all Player objects.
• The Player class will contain an attack() member function that returns “No attack
method defined yet!”.
Note: The derived classes will override this attack() member function to define specific
attack methods for Warrior, Priest, and Mage derived classes as given in next sub-section.
The enum type: LO 1
• The race can be represented by an enumerated type using enum with the following
values:
o HUMAN
o ELF
o DWARF
o ORC
o TROLL
Note: The enum may be code inside Player.h which will ensure all derived classes have access
to it.
5
Below is a UML class diagram only for the player base class.
The Three Derived Classes:
Following are the specific player types that will be derived classes of the Player class:
• Warrior
o 200 hitPoints, 0 magicPoints
o Their attack method should return “I will destroy you with my sword!”
•
Priest
o 100 hitPoints, 200 magicPoints
o Their attack method should return “I will assault you with holy wrath!”
•
Mage
o 200 hitPoints, 0 magicPoints
o Their attack method should return “I will crush you with my arcane missiles!”
6
The main function:
Inside the main function, you should allow the user to create different kinds of player objects,
allowing them to select the derived class which you can request from the user using a simple
menu. You should also let the user select the race for their player as well. Additionally, you can
ask the user to assign a name to the player as well.
Store players are created by the user in three different vectors namely warrior, priest, and
mage. Once you are done with the creation of player objects, iterate through all three vectors
and print out the player details along with their attack methods, names, and race (LO 4).
Sample Output:
7
Scenario 3: (L01, L02, L04)
Bob Jones is a building architect hired to build a mall in the city centre of Chicago. He needs to
produce the building plan to his team. He wants to calculate the area and perimeter of some of
the structures he is planning to build which is part of the software he uses. Details are as follows:
a) A square room
b) A rectangular room
c) A circular swimming pool
d) A triangular portico
He wants the app to allow him to enter different dataset to see if it can all fit well in the total
available land area.
Task:
You are to draw the class diagram UML clearly depicting the access specifiers, inheritance, data
members and member functions of all classes planned to use. Then write a program in C++ to
incorporate the following.
(L01, LO4)
Implementation details:
• Parent class – Shapes
• Child classes – Square, Rectangle, Triangle, circle
• Use functions to draw the lines, shapes of each selected item as shown in
sample output to facilitate the reuse of the code.
• Create appropriate menus such as Shapes Calculator, Square Calculator,
Rectangle Calculator etc.
• Choose appropriate access specifiers for data members and data functions to
•
•
arrive at the output shown in the sample.
Similarly getData(), calculateArea() and giveResult() member functions are
useful in the parent class.
Again calculatePerimeter() in children classes are more appropriate as they can
inherit the above mentioned 3 functions from the parent.
Typical members of the classes:
Three data members of double data type namely base, height and result may be helpful in the
parent class.
Note: You are free to choose your data members to demonstrate the inheritance and
polymorphism specifically function overloading and function overriding.
Write comments to show the parent class, child classes, access specifiers, constructors,
data members, member functions, inheritance, and polymorphism- function overloading
and function overriding (LO 2).
Sample output
Scenario 4: (L 01, L 03)
Suppose that you are part of a team which is creating a game universe for an Alien based game.
L 03
The Alien class in the game will store height, weight, and gender of some existing Aliens and will
use operator overloading to perform breeding among Aliens using the overloading of following
operator:
➢ + operator will mean “breeding” keeping the following rules in mind:
• Weight of offspring = (sum of parents’ weight)/2
• Height of offspring = (sum of parents’ heights)/2
• Gender = Use 50% chance for female and 50% chance for male
• (rand() function can be used)
➢ Additionally, the Alien class will perform the overloading of following operators for comparing
prestige between any two given Aliens.
• == and !=
• and >=
• < and Alien 6 Alien 5 < Alien 6 Alien 5 >= Alien 6
Alien 5
Purchase answer to see full
attachment

  
error: Content is protected !!