www.vustudents.ning.com

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

# assignment No. 03 of CS304 has been uploaded today (Jan 08, 2016). You are required to download assignment file from VULMS and upload your solutions within due date Jan 14, 2016

Assignment No. 03
Semester: Fall  2015
Object Oriented Programming – CS304

Total Marks: 20

Due Date: 14 Jan, 2016

Objectives:

To get a hands on experience in implementing class level association in Object oriented Programming

Instructions:

It should be clear that your assignment will not get any credit if:

• The assignment is submitted after due date.
• The assignment is submitted via email.
• The assignment is copied from Internet or from any other student.
• The submitted assignment does not open or file is corrupt.
• It is in some format other than .cpp (Code File).

Note: All types of plagiarism are strictly prohibited.

For any query about the assignment, contact at CS304@vu.edu.pk

Class Diagram

Problem Statement:

Keeping in view the above class diagram, you have to write code for the below mentioned classes and show their relationship with each other:

1. Class Vehicle:

Attribute:

vehicleNo: string

color: string

Methods/Operations/Getters/Setters:

getVehicleNo(): string

getColor(): string

2. Class Car:

distance: int

Methods/Operations/Getters/Setters:

setDistance(int): void

calculateFare(int): int

displayInformation(): void

Important points:

• Your program should be able to create a Car object having a number, color and distance without creating an explicit object of Vehicle class.
• All Vehicle attributes should be directly accessible to Car and should not be accessible publically.
• Your program should accept value of distance only between 1-500 kilometers; any other value should be treated as invalid value.
• At the end, information about Car (car number, car color, distance covered) and total fare should be displayed whereas calculateFare(int) is a utility function. Fare is 5 rupees/kilometer.

Output:

BEST OF LUCK

Views: 2656

### Replies to This Discussion

Asslam

plz do the discussion

This is awesome! Thanks for sharing

most welcome

plz give more solutions

ye lo mze kro

Attachments:

salam plz check 304 assignment 3 solution

Attachments:

1

2

3

4

5