object oriented programming Assignment 2, Assignments of Object Oriented Programming

this document will help student and teacher to prepare quiz of object oriented programming

Typology: Assignments

2019/2020

Uploaded on 10/25/2020

mehwish-mehmood
mehwish-mehmood 🇵🇰

2.3

(3)

6 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Question No 1: Q/A [ 5 Marks]
1) There are five categories or types of run-time polymorphism: [1 Marks]
1. Polymorphic assignment statements
2. Polymorphic Parameter Passing
3. Polymorphic return types
4. Polymorphic (Generic) Array Types
5. Polymorphic exception handling (not in AP subset)
Define each of them in detail with example.
2) Write a code that demonstrate the working of up casting and down casting. [0.5 Marks]
3) What is the difference between late binding and early binding. [0.5 Marks]
4) Can we overload and override static method in Java? Elaborate your answer shortly. [0.5
Marks]
5) What is association, aggregation and composition? Explain with examples. [1 Marks]
6) How one-to-one, one-to-many and many-to-many association relationships are
implemented? Explain with examples. [1 Marks]
Question No 2: Programming [5 marks]
1. The UML diagram of an examination system that contains the following classes. Convert
these classes into java code.
SIR SYED UNIVERSITY OF ENGINEERING & TECHNOLOGY
BI0NFORMATICS DEPARTMENT
FALL 2019
OBJECT ORIENTED PROGRAMMING (CS-224)
ASSIGNMENT 3
Semester: VI Batch: 2018
Due Date: 29-Aug-2019 Max Marks: 10
Instructions:
Attempt all questions
Route
- startingFrom: String
- terminating: String
- shuttleList: Shuttle [ ]
- nbShuttles: int
+ Route (String, String)
+ addShuttle (Shuttle shuttle) : void
+ getTotalNumofPassengers() : int
+ printRouteDetails ( )
Shuttle
- driverName: String
- shuttleNumber: int
- numofPessenggers: int
+ Shuttle ( String, int, int)
+ getDriverName(): String
+ getNumofPessengers(): int
Application
+ main (args: String[ ] ): void
pf3

Partial preview of the text

Download object oriented programming Assignment 2 and more Assignments Object Oriented Programming in PDF only on Docsity!

Question No 1: Q/A [ 5 Marks]

  1. There are five categories or types of run-time polymorphism: [1 Marks]
  1. Polymorphic assignment statements
  2. Polymorphic Parameter Passing
  3. Polymorphic return types
  4. Polymorphic (Generic) Array Types
  5. Polymorphic exception handling (not in AP subset) Define each of them in detail with example.
  1. Write a code that demonstrate the working of up casting and down casting. [0.5 Marks]
  2. What is the difference between late binding and early binding. [0.5 Marks]
  3. Can we overload and override static method in Java? Elaborate your answer shortly. [0. Marks]
  4. What is association, aggregation and composition? Explain with examples. [1 Marks]
  5. How one-to-one, one-to-many and many-to-many association relationships are implemented? Explain with examples. [1 Marks]

Question No 2: Programming [5 marks]

  1. The UML diagram of an examination system that contains the following classes. Convert these classes into java code.

SIR SYED UNIVERSITY OF ENGINEERING & TECHNOLOGY

BI0NFORMATICS DEPARTMENT

FALL 2019

OBJECT ORIENTED PROGRAMMING (CS-224)

ASSIGNMENT 3

Semester: VI Batch: 2018 Due Date: 29-Aug-2019 Max Marks: 10 Instructions:  Attempt all questions Route

  • startingFrom: String
  • terminating: String
  • shuttleList: Shuttle [ ]
  • nbShuttles: int
  • Route (String, String)
  • addShuttle (Shuttle shuttle) : void
  • getTotalNumofPassengers() : int
  • printRouteDetails ( ) Shuttle
  • driverName: String
  • shuttleNumber: int
  • numofPessenggers: int
  • Shuttle ( String, int, int)
  • getDriverName(): String
  • getNumofPessengers(): int Application
  • main (args: String[ ] ): void

Class Order : Attribute : startingFrom, terminating, shuttleList, nbShuttles. Constructor : Route (startingFrom: String, terminating: String). Method : addShuttle() that adds a new shuttle to shuttleList. Maximum 10 shuttles can be added. getTotalNumofPassengers() that returns the total number of passenger traveling at that route. printRouteDetailst() prints the startingFrom, terminating and list of shuttles along with their driver names and number of passengers. Class Application: Write an application class and create Five (5) objects of Shuttle class and Two (2) object of Route class. Add first three shuttles to first route and last two shuttles to second route and and print the route details.

  1. Update the code( add delete update and search method) which we discuss in class

Question No 3: Output [3 Marks]

1. What will be the output of this code and explain properly in your own words.

[1 Marks]

2. Consider the following class and write the output and explain it in your own

words. [1 Marks]