You are on page 1of 5

Shaheed Zulfikar Ali Bhutto Institute of Science & Technology

COMPUTER SCIENCE DEPARTMENT

Total Marks: 04

Obtained Marks:

Object Oriented Software


Engineering
Assignment # 02
Last date of Submission: 4th March, 2020

Submitted To: Ms. Arfaa Asaf


_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________

Student Name:
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________

Reg Number:
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________

OOSE BS(SE) 5 SZABIST-ISB


Shaheed Zulfikar Ali Bhutto Institute of Science & Technology

COMPUTER SCIENCE DEPARTMENT

Instructions: Copied or shown assignments will be marked zero. Late submissions are not
entertained in any case.

Iteration/Assignment 2: Elaboration of Object Oriented Design


Concepts.
Scenario 1: Suppose you are a Game developer. You have to design a
game for kids on the theme of superheroes. These superheroes will differ
on the basis of weapon, slogan, superpower and color of their uniform.
This game has different rounds. The kid can perform a quiz on super
heroes. The kid can choose the superhero for saving the city. The kid can
play the song of the selected superhero as well. Keeping in mind, the
concept of polymorphism, design the given game. Provide a hierarchy
showing polymorphism between classes. Provide the relevant piece of
code as well.
NOTE: You can make following assumptions about the superheroes
 Weapon
 Slogan
 Superpower
 Uniform Color
Super hero
Name (string)
Superpower(string)
Weapon(string)
Slogan(string)
Uniform(string)
spider men + ~superhero()
Super men Iron men
#Virtual void activate() =0;

+Void quiz () +Void quiz () +Void quiz ()


+Voidplaysound(soun +Void +Void
d_id) playsound(sound_id) playsound(sound_id)

IMPLEMENTATION:
 The activate ( ) is a sand box method sine it is a virtual abstract
class subclasses must override it. This make it clear to someone
creating a power sub class where their work has to go.

OOSE BS(SE) 5 SZABIST-ISB


Shaheed Zulfikar Ali Bhutto Institute of Science & Technology

COMPUTER SCIENCE DEPARTMENT

 The other method of sub classes perform operation and changing


their implementation using polymorphism.
CODE WITHOUT IMPLEMENTATION
Class superhero
{
Public:
String name;
String superpower;
String weapon;
String slogan;
Public:
Virtual superhero() { }
Protected:
Virtual void activate() =0;
};
Public class spidermen extend superhero{
Public:
Void activate(){
Void quiz();
Void playsound(sound_id)
}
}
Public class batmen extend superhero{
Public:
Void activate(){
Void quiz();
Void playsound(sound_id)
}
}
Public class ironmen extend superhero{
Public:
Void activate(){
Void quiz();
OOSE BS(SE) 5 SZABIST-ISB
Shaheed Zulfikar Ali Bhutto Institute of Science & Technology

COMPUTER SCIENCE DEPARTMENT

Void playsound(sound_id)
services }
}

Scenario 1: Consider an organization i.e. “Effective Business Solutions”.


This organization is supposed to provide different services to clients. These
services include marketing, Sales and Maintenance. On the basis of these
services, the company has different departments. These departments are
the department of Sales, Marketing, Maintenance, Accounts, Admin and
HR. Each department has a lead, assistant and team members. The team
members i.e. employees of the department HR can also work in the
department of Admin as well. Keeping in mind, the concept of inheritance
and its types, design the given system. Provide a hierarchy showing
inheritance between classes. Make necessary relevant assumptions to
adjust different types of inheritance as well. Compare and contrast
different types of inheritance using the designed system.
NOTE: You can make relevant assumptions
 to adjust different types of inheritance
 about attributes and methods of classes

clients services

OOSE BS(SE) 5 SZABIST-ISB


Shaheed Zulfikar Ali Bhutto Institute of Science & Technology

COMPUTER SCIENCE DEPARTMENT

marketing sales maintance

departments

Sales_dep Marketing_dep Maintnce_dep Acc_de admin HR


p
employee

OOSE BS(SE) 5 SZABIST-ISB

You might also like