Nothing Special   »   [go: up one dir, main page]

Assignment 1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

RIPHAH INTERNATIONAL UNIVERSITY,

LAHORE CAMPUS.
SCHOOL OF COMPUTING & INNOVATION

Objectives:
 Start with C++ Programming.
 Implement concepts taught in class/lab.
o Data types, Expressions
o Operators
o Conditional Structure

Instructions:
 Assignment type is individual, so no sharing is allowed.
 You can use internet and books as helping resources but sharing content with peers is
strictly prohibited.
 Plagiarized assignments will get zero and may fail the course.
 I am available for your help/guidance.
 Start early!

Submission Method:

Hardcopy due on Wednesday 1st Nov ember 2023

Task 1:
Write a program that takes five numbers input from user and calculate sum and average and
print on console.

Task 2:
Write a program that takes purchase amount input from user and calculate general sales tax
(16%) on that sale and print actual purchase amount, tax amount and total bill (purchase
amount + tax amount) on console.

Task 3:

Riphah International University Lahore Campus


Write a program that takes the radius of a circle as an input and calculates the area and
circumference of the circle.
Area of Circle = π r2
Circumference of Circle = 2 π r

Task 4:
Calculate the pay of an employee based on hours worked. The input includes the employee
total hours worked this week and their hourly pay rate. The employee is to be paid their basic
wage for first 40 hours worked and overtime pay for all hours above 40. Output the employee
regular pay, overtime pay, and total pay for the week on the screen. Assume the base pay
rate = 18.25 and overtime pay rate = 27.78.

Task 5:
Write a program that takes an input in a variable temp from the user and calculate
¾ * pi * temp * (temp - 2) / 4 and display the calculated result on the console.

Task 6:
Write a program that asks the user to enter an angle in degrees and converts it to radians.
radians = degree * PI / 180
Where the value of PI is 3.14159 and is to be taken as a constant variable.

Task 7:
Pizza Palace needs a program to calculate the number of slices a pizza of any size can be
divided into. The program should perform the following steps:
 Ask the user for the diameter of the pizza in inches.
 Calculate the number of slices that may be taken from a pizza of that size.
 Display a message telling the number of slices.

To calculate the number of slices that may be taken from the pizza, you must know the
following facts:
 Each slice should have an area of 14.125 inches.
 To calculate the number of slices, simply divide the area of the pizza by 14.125.
 The area of the pizza is calculated with this formula: Area = "pi r squared" where pi is
approximately 3.14159 and r is the radius (half the the diameter).

Riphah International University Lahore Campus


Task 8:
Write a program that takes a number in your code and check if number is greater than 85 or
not. If number is equal to or greater than 85, print that “Congratulations! You have got A+”,
otherwise print, “Sorry, you have not got A+”.

Task 9:
Write a program that takes 3 numbers from user. Determine whether: all are same, all are
different, or exactly two are same.

Task 10:
Take input grade in code and print the grade of a student from the marks obtained.
The criteria is given below:

GOOD LUCK 

Riphah International University Lahore Campus

You might also like