Latest Activity In Study Groups

Join Your Study Groups

VU Past Papers, MCQs and More

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

CS304 Assignment No 2 (Last Date Dec 10)

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 Bus:

Attribute:

BusNo:string

SeatingCapacity:int

SeatsReservedSofar:int

 

Methods/Operations/Getters/Setters:

GetSeatingCapacity():int

SetSeatingCapacity(bCap:int)

GetBusNo():string

SetBusNo(bNo:string)

ReserveSeat(p:Passenger)

DisplayInfo()

 

2. Class passenger:

 

Attribute:

Name:string

Gender:char

 

Methods/Operations/Getters/Setters:

SetPassengerName(name:string)

GetPassengerName():string

SetGender(gender:char)

GetGender():char

 

Hint: You have to implement the relationship of aggregation between class “bus” and “passenger” through C++ code.

  • Your program should allow the user to enter information of bus while creating and information of passenger while adding a passenger in bus.
  • It should give option (yes/no) to add more passenger if capacity of bus allows.
  • After adding the last passenger (i.e. when adding a passenger makes buss full) or “No” is selected as option, it should display the complete summary about bus and all passenger in bus as shown in output below. 

 

Output:

Views: 12467

Attachments:

Replies to This Discussion

zero marks oh

ismain error hai

Is ka output to yeah nikalta hy bhai

Attachments:

yeh galhat hai ooor her taraf shanti hai

this is wrong code, in this file there is no use of OOP , its just cin & cout..

the purpose of remaining code is to just confuse......

i removed the "class"  code and still its giving same output .... see urself

Attachments:

Bad Idea.................... where is classes and their attributes and methods and aggregation 

KOI HA JO IS KO SOLVE KAR SAKE

anyone solve it ??????

ye Error a raha hy koi bta sakta hy galti kia hy????

Correct Solution...

Attachments:

Tnx man!!!

Works fine.

        

RSS

Looking For Something? Search Below

VIP Member Badge & Others

How to Get This Badge at Your Profile DP

------------------------------------

Management: Admins ::: Moderators

Other Awards Badges List Moderators Group

© 2021   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service