OOP Assignment 1
OOP Assignment 1
OOP Assignment 1
ASSIGNMENT # 1
Lab INSTRUCTOR
Mohammad Amir
Instructions
All the questions are mandatory.
Each student has to do the assignment individually.
Plagiarism i.e. Copy/Paste may cause F grade in the Lab.
Read the question carefully before starting any question.
th
Submit hard copy in between the due date of 4 Nov -8TH Nov, 2019
in counselling hours with viva .
Your assignment should be neat and clean. Use assignment pages only
and it should contain front page containing (submitted by, your id #,
subject name, assignment # and submitted to). Such student’s
assignment will not be acceptable who haven’t used assignment pages.
Assignment marks are 10 but it’s subjected to your viva when you
submit the assignment.
1-Write a program to make count the number of objects created using static
data member
2-Imagine a tollbooth with a class called toll Booth. The two data items are a
type unsigned int to hold the total number of cars, and a type double to hold the
total amount of money collected. A constructor initializes both these to 0. A
member function called payingCar ( ) increments the car total and adds 0.50 to
the cash total. Another function, called nopayCar ( ), increments the car total
but adds nothing to the cash total. Finally, a member function called displays
the two totals. Include a program to test this class. This program should allow
the user to push one key to count a paying car, and another to count a
nonpaying car. Pushing the ESC kay should cause the program to print out the
total cars and total cash and then exit.
Enter your area code, exchange, and number: 415 555 1212 My number is
(212) 767-8900 Your number is (415) 555-1212