PF Assignment
PF Assignment
Objective:
The objective of this assignment is to:
1. Make students working on their problem-solving skills
2. Make students able to apply basic control structures (loops,
conditionals) in algorithm design
Scope:
This assignment (and all its tasks) remain focus on:
1. Algorithms
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:
Sample Output:
3. You are supposed to calculate circumference of circle, when value of r = 50cm and π=3.14.
Sample Output:
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:
Sample Output 2:
5. 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:
8 + 10 = 18
9. 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).
10. 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.
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.
Guidelines
• Submit hardcopy for this assignment
• Cover page of assignment must have your Name, roll number and section.
• No assignment will be considered after deadline.