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

Asg 2

This document outlines Assignment #2 for course CC1021, detailing the tasks and questions to be completed by students, with a maximum score of 170 marks. Students are required to write pseudocode and C++ code for various problems, including calculations for quizzes, triangle area, circle circumference, and more. The assignment must be submitted by the specified deadlines, and guidelines for submission are provided.

Uploaded by

irha.mustafa2011
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views4 pages

Asg 2

This document outlines Assignment #2 for course CC1021, detailing the tasks and questions to be completed by students, with a maximum score of 170 marks. Students are required to write pseudocode and C++ code for various problems, including calculations for quizzes, triangle area, circle circumference, and more. The assignment must be submitted by the specified deadlines, and guidelines for submission are provided.

Uploaded by

irha.mustafa2011
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

ASSIGNMENT#2

COURSE CODE: CC1021 MAXIMUM MARKS: 17*10=170


INSTRUCTOR’S NAME: Ms. Afnan Iftikhar
SUBMISSION DEADLINE: start of class 28 November (Y5) and 29 November (Y9)
Instructions: Attempt all questions. Copied assignments will be cancelled & NEGATIVE marks will be
awarded.

Question Number CLO Mapping BT Level


1-8 CLO2 C4
9 - 17 CLO3 C3

Scope:
This assignment (and all its tasks) remain focus on:
1. Recognizing what type of data and processes are involved in solution.
2. Simple program development using standard control structures.

Write pseudocode on paper and C++ code on compilers for all the given
problems.

Problem 1: CLO2
1. Input the marks of 5 quiz from user. Then calculate as the percentage of marks of 5 quizzes, where
every quiz is out of 15 marks.

Sample Output:

Please enter marks of quiz 1: 5


Please enter marks of quiz 2: 10
Please enter marks of quiz 3: 12
Please enter marks of quiz 4: 15
Please enter marks of quiz 5: 15
Percentage = 76

2. Input the “Base” and “Height” of triangle from user than calculate the Area of the Triangle

Formula: Area of Triangle = (base*height)/2.


Sample Output:

Please enter height: 5


Please enter base: 10
Area of triangle with height 5 and base 10 is: 25

3. You are supposed to calculate circumference of circle, when value of r = 50cm and π=3.14.

Formula: circumference of circle =2πr

Sample Output:

circumference of circle with r = 50 is 314

4. Read angle between three side of triangle then check whether a triangle can be formed by the
given value for the angles.
Note: a triangle can be formed if the sum of all 3 angles is 180.

Sample Output 1:

Please enter angle1: 10


Please enter angle2: 100
Please enter angle3: 70

Yes, tringle can be formed

Sample Output 2:

Please enter angle1: 10


Please enter angle2: 10
Please enter angle3: 70

No, tringle can be formed

5. Read the moles of oxygen from user then display the corresponding mass in grams.

Note: Mass of one mole of oxygen is 32 grams.

6. Write pseudocode to calculate r, where r = 2a + 6 (b + c)


d+ e

7. Write a program input principle, rate and time from user and print the interest with appropriate
message.
Formula: interest = principle * rate * time.
8. A car is in a 1000 m race and reaches the finish line in exactly 1 minute and 20 seconds.
Calculate the velocity of the car.
𝒇𝒊𝒏𝒂𝒍 𝒑𝒐𝒔𝒊𝒕𝒊𝒐𝒏−𝒊𝒏𝒊𝒕𝒊𝒂𝒍 𝒑𝒐𝒔𝒊𝒕𝒊𝒐𝒏
Velocity = 𝒕𝒊𝒎𝒆

9. Read 2 number from user than swap their values to arrange them in ascending order.

10. Read any digit (0 - 9) from user, and then display that digit in the word.

11. Input an integer form the user and store it in the variable currentNumber. If integer variable
currentNumber contains an odd value, change its value so that it is now 3 times currentNumber
plus 1, otherwise change its value so that it is now half of currentNumber. Display the value
before changing and also after changing.

12. Input employee name, hours worked for the week, and an hourly rate of pay from the user.
Your program is to calculate an amount for the regular pay (hours up to and including 40), the
overtime pay (time and one half for hours over 40), and the gross pay (the sum of the regular pay
and overtime). Look for calculations that are always performed in the same manner and those
that differ according to the hours worked. You should not have any redundant code in your
program. Output the three calculated values at the end of your program.

13. Read volts1 and volts2 from user. If the difference between volts1 and volts2 is less than .001, set the
variable approx to zero, else calculate approx as the quantity (voltsl - volts2) / 2.0.

14. Read an alphabet from user and check if it is vowel or not

15. Make a calculator which should be able to perform the following operations. Display these
operations in form of menu to user then Prompt the user to enter two numbers and operator from
the given menu. Your calculator should be able to perform the required operation.
• Addition
• Subtraction
• Multiplication
• Division
Sample Output 1:

Calculator can perform + , - , * , /

Please enter number1: 8


Please enter number2: 10
Please enter the operator: +

8 + 10 = 18
16. Take the CostPrice and SellingPrice of an item into appropriate variables. Print the amount of
profit or loss the seller suffered on the item. (Hint: Remember if SP>CP then its profit otherwise
its loss).

17. Input two integers from the user and store these in variables numerator and denominator. If
the denominator is not equal to zero then display the result of the division otherwise output a
message stating division by zero is an illegal operation.

Guidelines
• Submit a hard copy with proper cover page containing you name, roll number and
section.
• Create a single .cpp file containing all tasks
• Name of file should be your roll number and section
• Capture images of hardcopy then submit both images and .cpp file on google classroom.
• No assignment will be considered after deadline.

You might also like