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

Lab 2.. OOP Preston Uni

lab 3 OOP Preston Uni

Uploaded by

ah8951512
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)
3 views4 pages

Lab 2.. OOP Preston Uni

lab 3 OOP Preston Uni

Uploaded by

ah8951512
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

PRESTON UNIVERSITY ISLAMABAD

Obiect-Oriented Programming Lab Report Submitted by:


Name: Waheed Ur Rehman

Reg no: 1422-123004

Submitted to:

Mrs. Saira Kishwar Abbas

Lab # 2
Section: BSCS(E)

Submission Date : 12/22/2023


LAB #2
LOOPS AND DECISION
Program No#1:
Write C++ programs to do the (Four-function Calculator) [5] Create the equivalent of a four-function
calculator. The program should ask the user to enter a number, an operator, and another number. (Use
floating point.) It should then carry out the specified arithmetical operation: adding, subtracting,
multiplying, or dividing the two numbers. Use a switch statement to select the operation. Finally, display
the result. When it finishes the calculation, the program should ask whether the user wants to do another
calculation. The response can be 'y' or 'n
Program No#2:
Time Calculator (7) Write a program that asks the user to enter a number of seconds.
• There are 60 seconds in a minute. If the number of seconds entered by the user is greater than or equal to 60, the
program should display the number of minutes in that many seconds.
• There are 3,600 seconds in an hour. If the number of seconds entered by the user is greater than or equal to 3,600,
the program should display the number of hours in that many seconds.
• There are 86,400 seconds in a day. If the number of seconds entered by the user is greater than or equal to 86,400,
the program should display the number of days in that many seconds.

Program No#3:
Sales Bar Chart [7]) Write a program that asks the user to enter today's sales for five stores. The program should
then display a bar graph comparing each store's sales. Create each bar in the bar graph by displaying a row of
asterisks. Each asterisk should represent Rs100 of sales
Program No#4:
Body Mass Index [6] Write a program that calculates and displays a person's body mass index (BMI). The BMI is often
used to determine whether a person with a sedentary lifestyle is over-weight or underweight for his or her height. A
person's BMI is calculated with the following formula: BMI = weight in kilograms (height in meters) where weight is
measured in kilograms and height is measured in meters. The program should display a message indicating whether
the person has optimal weight, is underweight, or is overweight. A sedentary person's weight is considered to be
optimal if his or her BMI is between 18.5 and 25. If the BMI is less than 18.5, the person is considered to be
underweight. If the BMI value is greater than 25, the person is considered to be overweight.

Program No#5:
Write a program that reads in a five-digit integer and determines whether it's a palindrome.

You might also like