You are on page 1of 3

CPE 101 HANDS-ON EXAMINATION

NAME: _____________________________________ SCORE: ________/RATING: _________


ID NUMBER: ______________________________ COURSE: _________________

1. Write a program that accepts dates written in numerical form and the output them as a complete form. For
example, the input: 2 14 1984

Should produce the output: February 14, 1984

2. Write a program that accepts your first name, middle initial and your last name and display your full name in
single statement. Sample Output:
Enter your first name: Walter
Enter your middle initial: Potter
Enter your last name: Marquez

Your Full name: Marquez, Walter Potter

3. Create a program that converts the inputted number of days into years, months, weeks and days.
Sample Output:
Enter number of days: 1567

Year(s): 4
Month(s): 8
Week(s): 1
Day(s): 4

4. Create a program that asks the user how many eggs he/she has and then tells the user how many gross eggs
and dozen eggs he/she has and how many extra eggs are left. A gross of eggs is equal to 144 eggs. Extend
your program so that it will tell the user how many gross, how many dozen, and how many left over eggs has.
Sample Output:
Enter how many eggs: 1342
Your number of eggs is 9 gross, 3 dozen(s), and 10 eggs left

5. The LeVan Car Rental Company charges $0.25/mile if the total mileage does not exceed 100. If the total
mileage is over 100, the company charges $0.25/mile for the first 100 miles, then it charges $0.15/mile for any
additional mileage over 100. Write a program so that if the clerk enters the number of miles, the program would
display the total price owed.

6. Create a program that computes the area of a washer. (The area of the shell should be bigger than the area
of the hole.)

Area of
outer shell Area of hole
7. Write a program for the Air Force to label an aircraft as military or civilian. The program is to be given the
plane’s observed speed in km/h and its estimated length in meters. For Planes travelling in excess of 1100 km/h,
and longer than 52 meters, you should label them as “civilian” aircraft, and shorter such as 500 km/h and 20
meters as “military” aircraft. For planes travelling at slower speeds, you will issue and “It’s a bird message”.

8. Create a program that accepts the employee’s HOURS WORKED and HOURLY RATE and compute for the
GROSSPAY base on the following criteria.
CRITERIA FORMULA
HOURSWORKED up to 40 HOURSWORKED * HOURLY RATE
((HOURSWORKED – 40) * (HOURLY RATE *
HOURSWORKED over 40 up to 54
1.5)) + (40 * HOURLY RATE)
(40 * HOURLY RATE) + (14 * (HOURLY RATE *
HOURSWORKED over 54 1.5)) + ((HOURSWORKED – 54) *
(HOURLYRATE * 2))

9. Create a BMI Calculator. Accept the user’s weight (in kg) and height (in meters), calculate the BMI and display
the following message according to the calculated BMI. BMI can be calculated by dividing your weight by the
squared value of your height.
BMI MEANING
<18.5 Underweight
18.5–24.9 Normal weight
25–29.9 Overweight
BMI of 30 or greater Obesity

10. Create a program that accepts a number as alcohol content (g), and prints a message according to the
following table:
ALCOHOL CONTENT (g) MESSAGE
40 < g extra strong liquor
20 < g <= 40 strong liquor
15 < g <= 20 liquor
12 < g <=15 strong vine
10. 5 < g <= 12 normal vine
g <= 10. 5 light vine
11. Let the user choose among the plane shapes by inputting any of the numbers 1 to 4. Use that input as a
criteria on how to determine the second input. For example, if the user choose 3, the program shall prompt the
user an input for the rectangle’s WIDTH and HEIGHT to compute for its AREA. Remember, your output should
be the AREA of the chosen plane shape. Display an error message if the user input a choice which is not on the
list above.
PLANE SHAPES FORMULA TO GET AREA
(1) Triangle Area = ½ * base * height
(2) Square Area = a2 (a: length of side)
(3) Rectangle Area = width * height
(4) Parallelogram Area = base * height

12. Create a program that accepts the Birthdate of a user and display his / her Zodiac Signs. Refer on the
following table for the criteria.
ZODIAC
ARIES March 21 - April 19
TAURUS April 20 - May 20
GEMINI May 21 - June 20
CANCER June 21 - July 22
LEO July 23 - August 22
VIRGO August 23 - September 22
LIBRA September 23 - October 22
SCORPIO October 23 - November 21
SAGITTARIUS November 22 - December 21
CAPRICORN December 22 - January 19
AQUARIUS January 20 - February 18
PISCES February 19 - March 20

13. Based on an automobile’s model year and weight the State of New Jersey determines the car’s weight class
and registration fee using the following schedule:
Model Year Weight Weight Class Registration Fee
1980 or earlier Less than 2700 lbs. 1 $16.50
2700 to 3800 lbs. 2 $25.50
More than 3800 lbs. 3 $46.50
1981 to 1989 Less than 2700 lbs. 4 $27.00
2700 to 3800 lbs. 5 $30.50
More than 3800 lbs. 6 $52.50
1990 or later Less than 3500 lbs. 7 $19.50
3500 or more lbs. 8 $52.50
Using this information, write a program that accepts the year and weights of an automobile and determines and
displays the weight class and registration fee of the car.

You might also like