Monday, November 20, 2006

Activity No. 2 (Computer Programming)

Directions:

Your instructor will be the one to determine your station. For station 20, your task is problem number 12. For station 19, your task is problem number 11. For station 18, your task is problem number 10. Blahh,blahh....For Station 8, your task is problem number 12. For station 7, your task is problem number 11. For station 6, your task is problem number 10. Blahh,blahh.... You will be given 1 hour to solve the problem. Asking, standing, and photocopies are not allowed during the activity. Mind your business, ika nga!

1.Write a Turbo C program that finds the smallest among the five integers inputted by the user.

2.Write a program that computes the grade of a student using the formula: Grade=40% major exam+30% average of long exams+30% average of 3 short quizzes. Display the average of two long exams, average of 3 short quizzes and the grade of the student. Display also a message whether the student passed or failed. Passing is 75%.

3.Write a program that asks the user for the hours worked for the week and the hourly rate. The basic salary is computed as: Salary = hours worked * hourly rate.
Bonuses are given:
No. of hours > 45---------------------- Bonus of 500 pesos
No. of hours > 40 and <=45------------ Bonus of 250 pesos
No. of hours > 35 and <=40------------ Bonus of 150 pesos.
Display the basic salary, bonus and the total salary (basic salary + bonus) for the week.

4.XYZ Company gives year-end bonus to its employees based on their number of years of service and their salary, using the following:
Years of Service -------------------- Bonus
1-------------------------------- 10% of salary
2 to 5--------------------------- 20% of salary
6 to 10-------------------------- 30% of salary
11 and above-------------------- 75% of salary
Upon displaying the name of the employee, years of service and the salary, the bonus will be printed/displayed automatically.

5.Write a program that accepts five numbers from the user and displays the highest and the lowest number. Assume that there are no duplicate values.

6.Write a program that accepts three numbers from the user and display the values from the lowest to highest. Assume that there are no duplicate values.

7.Write a program that accepts three numbers from the user and display the values from the highest to lowest. Assume that there are no duplicate values.

8.Write a program segment that will ask the user if he wants to compute the perimeter of the area of a triangle. If the perimeter is wanted, ask the measure of the three sides and compute for the perimeter. If the area is wanted, ask for the measure of the base and height and compute for the area. Display the computed value.

9.Write a program that will display “Its cold!” if the temperature is less than 20, “Its Hot!” if the temperature is greater than 30, “Cool Climate!” otherwise.

10.Write a program that gives a discount of 100 pesos to a customer if the shirt bought is XL and the price is greater than 500 pesos; a discount of 50 pesos if the shirt bought is L and the price is greater than 400.

11.Write a program to determine the equivalent grade of each student in a class as follows:
Read in the student’s name, midterm grade, minor B and final exam ratings.
Determine the final grade of the student by the formula:
Final grade=0.30 of midterm grade + 0.10 of minor B + 0.60 of final exam
Determine the equivalent grade for the numerical value obtained by the following grading marks:
98 – 100 ============ 4.00
95 – 97 ============= 3.75
92 – 94 ============= 3.50
89 – 91 ============= 3.25
86 – 88 ============= 3.00
83 – 85 ============= 2.75
80 - 82 ============= 2.50
77 – 79 ============= 2.25
74 – 76 ============= 2.00
71 - 73 ============= 1.75
68 – 70 ============= 1.50
64 – 67 ============= 1.25
60 – 63 ============= 1.00
Below60============= 0.00

12.Write a program that will read a date (month, day and year) in integer form and display that date in standard format.
Sample Run:
Enter month: 10
Enter day: 23
Enter year: 2006

October 23, 2006

0 Comments:

Post a Comment

<< Home