0% found this document useful (0 votes)
4 views4 pages

LAB MANUAL 6 Practice Entire Class

This document outlines a lab session on Object Oriented Programming (OOP) focusing on classes, constructors, and destructors, led by instructor Jawad Hassan. It includes a series of labs with tasks such as creating an ATM application and designing a calculator class, emphasizing the application of OOP principles. The document also specifies objectives, instructions, and error handling for the tasks assigned to students.

Uploaded by

tayyab.rafique
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 views4 pages

LAB MANUAL 6 Practice Entire Class

This document outlines a lab session on Object Oriented Programming (OOP) focusing on classes, constructors, and destructors, led by instructor Jawad Hassan. It includes a series of labs with tasks such as creating an ATM application and designing a calculator class, emphasizing the application of OOP principles. The document also specifies objectives, instructions, and error handling for the tasks assigned to students.

Uploaded by

tayyab.rafique
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/ 4

OOP – Class | Constructor | Constructor | Destructor | Quiz-1

Object Oriented Programming


LAB 05

Lab Instructor: Jawad Hassan


Department of Artificial Intelligence
Email: [email protected]

SESSION: Fall-2024
SEMESTER: 2nd
OOP – Class | Object | Data Members |Member Functions |
Outlines
Lab - 1
Revised Programming Fundamentals
Lab – 2 (CLO-1– Unerstand)
 OOP Introduction
 Class
 Object
 Data Members
 Member Member Functions
Lab – 3 (CLO-1 and 2 – Unerstand and identyfy)
Unified Modeling Language to Code
 Class
 Object
 Data Members
 Member Member Functions
 Constructor
 Defualt
 Parametrize
Lab – 4 (CLO-3 – Apply)
Code to the given Scenarios
Lab – 5 (CLO-3 – Apply)
Code Practice
 Constructor
 Defualt
Parametrize
 Destructor
 Practice Task
 Quiz – 1
 Home Task
Lab – 6 (CLO-3 – Apply)
Practice Entire Class
OOP – Class | Object | Data Members |Member Functions |

Constructor

Practice Task

Write a C++ code to Create an ATM application using class Diagram………


ATM have following features
 Check balance
 Deposit Money
 Withdraw Money
 Exit ATM

Home Task
Task: Creating a Calculator Class with Private Data Members and Display Menu
OOP – Class | Object | Data Members |Member Functions |

Objective:

The objective of this task is to design and implement a simple calculator class using object-
oriented principles. The calculator should allow users to perform basic arithmetic
operations on two numbers, with the option to choose the operation via a menu.
Instructions:

Class Design:

Create a class named Calculator.


Define two private data members to store the two numbers (number1 and number2).

Menu Display:

Implement a method named displayMenu() that displays a menu of available operations.


The menu should include options for addition, subtraction, multiplication, and division.
Each option should be associated with a number (e.g., 1 for addition, 2 for subtraction,
etc.).

Arithmetic Operations:

Implement methods for performing each arithmetic operation (addition, subtraction,


multiplication, and division).
These methods should take no parameters and return the result of the operation.

Input Handling:

Implement methods to set the values of number1 and number2.


These methods should take parameters and set the corresponding private data members.

Main Program:

In the main program, create an instance of the Calculator class.


Prompt the user to enter values for number1 and number2.
Display the menu using the displayMenu() method.
Prompt the user to choose an operation from the menu.
Perform the selected operation using the appropriate method.
Display the result to the user.

Error Handling:

Handle any potential errors gracefully, such as division by zero

You might also like