Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Due: Wednesday, Mar. 2 7 , 2 0 2 4 @ 1 1 : 0 0 am , soft copy in Moodle. Maximum: 1 0

Due: Wednesday, Mar. 27,2024@ 11:00 am, soft copy in Moodle.
Maximum: 100 points
The following program is developed in two phases as following:
Phase 1- Inheritance:
You are a beginner programmer where you are asked to develop a video game called SimCity.
The game simulates a metropolitan city where it has various transportation means. As a start,
your team leader asks you to write a code that describes cars, planes, and trucks objects. The
type of a vehicle is to be decided at run-time in the game. Each vehicle should have a
position, size, and cost. Also, a common operation is move (), in addition to the setters
and getter of the common attributes. In the game, Cars and Trucks move in 2D plane, while
airplanes move in 3D space. You are free in your design to select the specific attributes and
methods for each vehicle type. However, you are asked to follow the OO-programming
principles such as modularity, SW component reuse, information hiding, encapsulation, and
polymorphism.
Phase 2- Interface:
As a second step of developing SimCity game, you are sked to integrate other items into the
game, such as Buildings, Roads, and Trees. The common attributes of these items are
position, size, and cost, same as above, in addition to the setters and getter of the
attributes. In the game, Roads is represented in 2D images, while Buildings and Trees are
represented in 3D images. You are free in your design to select the specific attributes and
methods for each item type. However, you are asked to follow the OO-programming principles
such as modularity, SW component reuse, information hiding, encapsulation, and
polymorphism.
You are asked by your team leader to integrate the new items with the transportation vehicles,
such that any type of those items (in phase 1 or phase 2) is added into the game at run time
(polymorphically).
The design/code of phase 1 may change after incorporating phase 2 to it. The final
submission should include the enhanced design for both phase 1 and phase 2
combined. Therefore, no need to submit phase 1 alone.
You need to provide the UML class diagram for your whole design (phase 1 and 2
combined).Important Notes:
Items in 2D require only x and y coordinates, while 3D items require x,y and z
coordinates. Therefore, setting position and size for 2D items differ than those of
3D items. The same idea for method move, where a vehicle moves in 2D space vs in 3D
space.
The variable position represents one point in space either in 2D plane or 3D space.
The variable size in 2D is measured by meter square, where in 3D is measured by
meter cube.
You can place an item in any place, however the item size must be contained within the
item position.
The cost is by SimCity currency units.
Testing Setup:
Create a driver/test class where it should contain a space of your defined size. This space is in
3D, think of it as a box, and you should select one plane side to be the ground. All objects must
be contained inside this space which we will call the "game space". Produce multiple objects of
each kind and place them in the game space. However, you have to consider the following
restrictions:
Objects of type Road, Tree, Building, Car and Truck should be placed in the
ground plane only.
If the object type is Road, Tree or Building, then space overlapping is restricted.
Meaning, you cannot place an object of these types on top of each other. You have to
make sure that the position is not occupied from these types of objects first. You need a
way to compare between objects positions.
Testing steps:
After creating the objects, output each object's type and information (position, size and
cost) to the screen.
Show if there are some objects that were not added to the game because of an
overlapping space conflict with already existing items.
Test operation move() to all vehicles. Cars and Trucks move only on roads in 2D space,
whereas, planes move vertically in 3D space.
Show the information of the objects after moving some vehicles.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started