0% found this document useful (0 votes)
292 views

OOP Assignment 1

This document contains instructions for Assignment #1 in an OOP lab course. It lists 5 questions to be answered by students individually. It specifies requirements like submitting a hard copy of the assignment between certain dates with the front page containing student details. It also mentions the assignment is out of 10 marks but the final marks will depend on a viva session. The 5 questions include: 1) Writing a program to count objects using a static data member. 2) Creating a Toll Booth class to track cars and money. 3) Using a structure to store phone number parts. 4) Creating a basic 4 function calculator. 5) Writing a Bank Account class with necessary methods and variables.

Uploaded by

Ahsan Hassan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
292 views

OOP Assignment 1

This document contains instructions for Assignment #1 in an OOP lab course. It lists 5 questions to be answered by students individually. It specifies requirements like submitting a hard copy of the assignment between certain dates with the front page containing student details. It also mentions the assignment is out of 10 marks but the final marks will depend on a viva session. The 5 questions include: 1) Writing a program to count objects using a static data member. 2) Creating a Toll Booth class to track cars and money. 3) Using a structure to store phone number parts. 4) Creating a basic 4 function calculator. 5) Writing a Bank Account class with necessary methods and variables.

Uploaded by

Ahsan Hassan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

OOP

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.

3- A phone number, such as (212) 767-8900, can be thought of as having three


parts: the area code (212), the exchange (767) and the number (8900). Write a
program that uses a structure to store these three parts of a phone number
separately. Call the structure phone. Create two structure variables of type
phone. Initialize one, and have the user input a number for the other one. Then
display both numbers. The interchange might look like this:

Enter your area code, exchange, and number: 415 555 1212 My number is
(212) 767-8900 Your number is (415) 555-1212

4-Create the equivalent of a four function calculator. The program should


request the user to enter a number, an operator, and another number. It should
then carry out the specified arithmetical operation: adding, subtracting,
multiplying, or dividing the two numbers. (It should use a switch statement to
select the operation). Finally it should display the result. When it finishes the
calculation, the program should ask if the user wants to do another calculation.
The response can be Y or N . Some sample interaction with the program might
look like this. Enter first number, operator, second number: 10/ 3Answer
= 3.333333 Do another (Y/ N)? Y
Enter first number, operator, second number 12 + 100 Answer = 112 Do
another (Y/ N) ? N
5- Write a C++ program demonstrating a Bank Account with necessary
methods and variables

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy