0% found this document useful (0 votes)
4 views1 page

Task 1

Uploaded by

Kunal Puri
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)
4 views1 page

Task 1

Uploaded by

Kunal Puri
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
You are on page 1/ 1

Task 1

1. Write a class definition that creates a class called leverage with on


private data member, crowbar, of type int and one public function
whose declaration is void pry(). Write a constructor that initializes
to 0 the crowbar data.

2. Create a class called time that has separate int member data for
hours, minutes and seconds. One constructor should initialize this
data to 0. and another should initialize it to fixed values. Another
member function should display it, in 11:59:59 format. The final
member function should add two objects of type time passed as
arguments. A main program should create two initialized time
objects and one that isn’t initialized. Then it should add the two
initialized values together, leaving the result in the third time
variable.

3. Imagine a tollbooth at a bridge. Cars passing by the booth are


expected to pay a 50 cent toll. Mostly they do, but sometimes a car
goes by without paying. The tollbooth keeps track of the number of
cars that have gone by, and of the total amount of money collected.

You might also like