0% found this document useful (0 votes)
5 views6 pages

C++ OOP Assignment: Car & Circle Classes

Uploaded by

minahiln245
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views6 pages

C++ OOP Assignment: Car & Circle Classes

Uploaded by

minahiln245
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Name: Yasir Asghar

Roll Number: F2024376388

OOP LAB

Assignment

Q1: Write a C++ program to make a car class with wheels, doors as
private data members and cur_speed as public data member while speed
and break as public member functions. Use constructor with default value
of wheels=4,doors=2 and cur_speed=0 for initialization. Make two objects
in the name of ferrari and hino. Ferrari is initialized through default values
while hino has 10 wheels, 4 doors. Every time when you call speed
function cur_speed is increased by 5 while break function decrease it by 5.
Display current speed.
OUTPUT:
Q2: Make a class in the name of circle with data memberâA˘ Z´ s radius,
perimeter, and area. Use overloaded constructor one with no argument
which initializes radius=1. The other constructor accepts argument of
radius and initializes. Make two objects circle1 and circle2, circle with no
values and circle2 with any input value en- tered in run time from your
keyboard. Find area and perimeter of both circles and display them. Also
modify destructor code which display which circle with area is deleted.
Formulas: Area=ÏA˘ r2ˆ perimeter=2ÏA˘ r
OUTPUT:

You might also like