You are on page 1of 8

NCP 3106 (Software Design Laboratory)

MACHINE PROBLEM #2
DECISION STRUCTURES
NAME: Zapanta, Angelo Miguel A. DR. JOAN P. LAZARO
SECTION: 1CPE DATE: 09/17/21 GRADE:

Problem #1:
Write a program that prompts the user to enter a number within the range of 1 through
100. The program should display the Roman numeral version of that number. If the number is
outside the range of 1 through 100, the program should display an error message.

Program code:

1|Page
NCP 3106 (Software Design Laboratory)

Output:

Problem #2:
Write a program that calculates and displays a person’s body mass index (BMI). The
BMI is often used to determine whether a person with a sedentary lifestyle is overweight or
underweight for his or her height. A person’s BMI is calculated with the following formula:
BMI = Weight * 703 / Height2
where weight is measured in pounds and height is measured in inches. The program should
display a message indicating whether the person has optimal weight, is underweight, or is
overweight. A sedentary person’s weight is considered optimal if his or her BMI is between 18.5
and 25. If the BMI is less than 18.5, the person is considered underweight. If the BMI value is
greater than 25, the person is considered overweight.

2|Page
NCP 3106 (Software Design Laboratory)

Program code:

Output:

Problem #3:
Write a program that has variables to hold three test scores. The program should ask the
user to enter three test scores and then assign the values entered to the variables. The program
should display the average of the test scores and the letter grade that is assigned for the test score
average. Use the grading scheme in the following table:

3|Page
NCP 3106 (Software Design Laboratory)

Test Score Average Letter Grade Test Score Average Letter Grade
93-100 A 73-76 C
90-92 A- 70-72 C-
87-89 B+ 67-69 D+
83-86 B 63-66 D
80-82 B- 60-62 D-
77-79 C+ Below 60 F

Program code:

4|Page
NCP 3106 (Software Design Laboratory)

Output:

Problem #4:
A software company sells a package that retails for P888. Quantity discounts are given according
to the following table:
Quantity Discount
10–19 20%
20–49 30%
50–99 40%
100 or more 50%

Write a program that asks the user to enter the number of packages purchased. The
program should then display the amount of the discount (if any) and the total amount of the
purchase after the discount.

Program Code:

5|Page
NCP 3106 (Software Design Laboratory)

Output:

6|Page
NCP 3106 (Software Design Laboratory)

Problem #5:
The Lost Boxes Company charges the following rates:
Weight of Package Rate per 500 meters Shipped
Not more than 1 kilogram P139.99
Not more than 3 kilograms P359.99
Not more than 5 kilograms P579.99
Not more than 10 kilograms P799.99
Not more than 20 kilograms P1319.99

The shipping charges per 500 meters are not prorated. For example, if a 1-kilogram
package is shipped 550 meters, the charges would be P279.98. Write a program that asks the user
to enter the weight of a package in kilograms, the distance to be the package will be shipped and
then displays the shipping charges.

Program code:

7|Page
NCP 3106 (Software Design Laboratory)

Output:

8|Page

You might also like