We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

Looking For Something at vustudents.ning.com? Click Here to Search

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

+ Link For Past Papers, Solved MCQs, Short Notes & More


Dear Students! Share your Assignments / GDBs / Quizzes files as you receive in your LMS, So it can be discussed/solved timely. Add Discussion

How to Add New Discussion in Study Group ? Step By Step Guide Click Here.

Aslam o Aleekum Every One, 

As you know assignment # 3 is ahead. So Why not try to solve it step by Step. Code only you will do and I will guide you through out.

So First Step is create 7 classes. 

Engine

Door

Wheel

Passengers

Bus

Car

Driver

Vehicle

Remember class can't exist until there are attributes or behaviors in the class. therefore some of the attributes and behavior is already given by instructor for vehicle and Car. rest you can think of Own if you want. for example

Engine(engineCapacity:int, engineType:string) 

i.e. engine capacity 1500, 1300 etc, engineType patrol, deisle, gas etc

Door(doorWeight: float, doorTransmission:string) , door weight 10.5, 25.2 KG etc, door transmission , automatic, manual 

Wheel(diameter:int, type:string) 192 diameter etc and type is tubeless 

So Think about all attributes for remaining.

and then below way is of coding step by step for all classes

1. create a class

2. Write attributes defined above as private

3. provide setter and getter for each and every attribute

Things to remember as best coding practice

a. Class name should be Capitalize means if it is single word start Capital if it is multiple word Start every word capital but no space for example if you name your class as AutmaticCar then A and C is capital.

b. all variable in clas should private and camle case which means if it is single word then small alphabet all if it is multi word then first word will be full small and rest all word should start with Capital for example

accountDeposit  , remainingBalance, lastMonthSalary etc

c. function should be public and name of function rule should same as variable

i.e setFuelType, getFuelType, 

Step 1. Create a Class

class Engine {    

};
Step 2. Write private attributes
class Engine {    
private:
float engineCapacity;
char* engineType;
};
Step 3. Write Setter & Getter ( Encapsulation

Rule of writing setter and getter is as follow
setter method should have no return type but setter must have one argument which should be same type as the attribute name. in this class we have two attributes engineCapacity, and engineType, therefore our setter will bet setEngineCapacity and setEngineType
as i mentioned earlier function name should be camle case
the body of setter function will be only setting the value to the class member.
for Getter there should be same return type as attribute type but no argument
class Engine {    
private:
float engineCapacity;
char* engineType;
public:
void setEngineCapacity(float capacityParam ){
this->engineCapacity = capacityParam;
}
float getEngineCapacity(){
return this->engineCapacity;
}
void setEngineType(char* typeParam ){
this->engineType = typeParam;
}
char* getEngineType(){
return engineType;
}
};


Now your next task is to compile this code and write all your classes in this format i suggest your to write all your classes in different cpp files and then include where it needed. you can also write all classes in single cpp file.
I will be available from 1:30 pm to 2:15 PM in mondy to thursday. u can discuss there or reply in same thread.
Once you complete writing all classes with attribute , setter getters etc then we will move our assignment to next level where we will do Inheritance and composition aggregation as mentioned in assignment.
so this will complete our OOP design after that we will move to last step which is implementing business logic and writing the main program to run it.
THank you very much.

Good Bye TO ready made solutions.

+ How to Follow the New Added Discussions at Your Mail Address?

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?


See Your Saved Posts Timeline

Views: 4674

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

+ Click Here To Join (Our facebook study Group)

Replies to This Discussion

For some questions common sense and understanding of the concept is involved. if you are setting the object porperties which means it obvious that object contain that.

Please Discuss here about this assignment.Thanks

Our main purpose here discussion not just Solution

We are here with you hands in hands to facilitate your learning and do not appreciate the idea of copying or replicating solutions.

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:

Please read the following instructions carefully before submitting assignment:

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

image: http://storage.ning.com/topology/rest/1.0/file/get/303818085...

 

Problem Statement:

Keeping in view the above class diagram, you have to write code for the below mentioned classes and show theirrelationship 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 whereascalculateFare(int) is a utility function. Fare is 5 rupees/kilometer.

 

 

 

 

Output:

image: http://storage.ning.com/topology/rest/1.0/file/get/303818710...

 

Error in previous code is only in DevC++ compiler

if any one compiling thru eclipse it will work fine.

Below is corrected solution with static error removal.

Attachments:

not treat as invalid value if insert distance other than 1-500km

Dear Students Don’t wait for solution post your problems here and discuss ... after discussion a perfect solution will come in a result. So, Start it now, replies here give your comments according to your knowledge and understandings....

salam cs304 3 assignment solution without any error dua mein yad rakhin

Attachments:

RSS

Latest Activity

+ M.Tariq Malik replied to مخلص's discussion Samsung Galaxy S11 Leaked Camera Features
50 seconds ago
+ M.Tariq Malik liked مخلص's discussion Samsung Galaxy S11 Leaked Camera Features
1 minute ago
+ M.Tariq Malik replied to + M.Tariq Malik's discussion ECO401 Economics GDB Fall 2019 Solution & Discussion in the group ECO401 Economics
1 minute ago
+ M.Tariq Malik replied to +¢αяєℓєѕѕ gιяℓ's discussion MCM301 - Communication skills Assignment No.1 Due Date Nov 27, 2019 in the group MCM301 Communication skills
3 minutes ago
+ M.Tariq Malik liked +¢αяєℓєѕѕ gιяℓ's discussion MCM301 - Communication skills Assignment No.1 Due Date Nov 27, 2019
5 minutes ago
+ M.Tariq Malik replied to + M.Tariq Malik's discussion MGT603 Strategic Management Assignment No 01 Fall 2019 Solution & Discussion in the group MGT603 Strategic Management
6 minutes ago
+ M.Tariq Malik replied to + M.Tariq Malik's discussion MGT603 Strategic Management Assignment No 01 Fall 2019 Solution & Discussion in the group MGT603 Strategic Management
6 minutes ago
Profile Iconmubashar hussain, Hurain, Abdul Majid Jamil and 13 more joined Virtual University of Pakistan
7 minutes ago
+ M.Tariq Malik liked UMER UMER's discussion What is Love?
8 minutes ago
+ M.Tariq Malik liked Abdul Majid Jamil's discussion for assignment of zoogy on topic wildlife counting
8 minutes ago
Abdul Majid Jamil posted a discussion
9 minutes ago
+ ! ! ! ! ! ! BaDd TamEeZ updated their profile
10 minutes ago
+ NurAl Ain + updated their profile
10 minutes ago
Abdul Majid Jamil posted a status
"i am the student of m.phill zoology ...m happy to fined that place ...i need some help"
10 minutes ago
+ M.Tariq Malik replied to + M.Tariq Malik's discussion ENG201 Business and Technical English Writing Assignment No 01 Fall 2019 Solution & Discussion in the group ENG201 Business and Technical English Writing
11 minutes ago
+ M.Tariq Malik liked UMER UMER's discussion Ego is the Enemy.
12 minutes ago
Mr khan liked + M.Tariq Malik's discussion ECO601 Business Econometrics Assignment No 01 Fall 2019 Solution & Discussion Due Date: 21-11-2019
12 minutes ago
+ M.Tariq Malik liked + ! ! ! ! ! ! ! ! ! ! ! ! ! ! !'s discussion 100 Instructions from the Quran
13 minutes ago
+ M.Tariq Malik replied to + M.Tariq Malik's discussion MGT111 Introduction to Public Administration Assignment No 01 Fall 2019 Solution & Discussion Due Date: 26-11-2019 in the group MGT111 Introduction to Public Administration
14 minutes ago
+ M.Tariq Malik liked + M.Tariq Malik's discussion MGT111 Introduction to Public Administration Assignment No 01 Fall 2019 Solution & Discussion Due Date: 26-11-2019
14 minutes ago

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

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