Lab 2

Applying pre-programming problem solving tools

Instruction: Answer all the questions below. Discuss with your demonstrator for questions 1, 2 and 3 in the lab. Submit questions 4, 5 and 6.

Dateline: 21/8/2009

1.Analyse each of the problem below using Problem Analysis Chart (PAC), Hierarchy Input Process Output (HIPO) chart and Input Process Output (IPO) chart:

  1. Calculate a tax based on the net pay where the tax is 9.5% of net pay.
  2. Read four integers and get the difference for the first two integers and the second two integers.
  3. Get the average of four integers.
  1. Analyse each of the problem below using Problem Analysis Chart (PAC), Hierarchy Input Process Output (HIPO) chart and Input Process Output (IPO) chart:
  2. One acre of land is equivalent to 43,560 square feet. Calculate the number of acres in a tract of land with 389,767 square feet.
  3. Calculate the average of three test scores and display all of them.
  4. An electronics company sells circuit boards at 40 percent profit. If you know the retail price of a circuit board, you can calculate its profit with the following formula:

Profit = Retail price x 0.4

Calculate the amount of profit earned for that product based on the retail price and display the results.

  1. Draw a flowchart for each of the problem in question 2.
  1. Write an algorithm for each of the problem in question 2.
  1. Draw a flow chart and write an algorithm that asks the user to enter the number of calories and fat grams in a food item. Display the percentage of the calories that come from the fat. One gram fat has 9 calories, therefore:

Calories from fat = fat grams * 9

The percentage of calories from fat can be calculated as follows:

Calories from fat / total calories

If the calories from fat are less than 30 percent of the total calories of the food, it should also display a message indicating the food is low in fat.

  1. Draw a flowchart and write an algorithm for the problem below:

An Internet service provider has three different subscription packages for its customers:

Package A: For RM49.95 per month 10 hours of access are provided. Additional hours are RM2.00 per hour.

Package B: For RM53.95 per month 20 hours of access are provided. Additional hours are RM1.00 per hour.

Package C: For RM79.95 per month unlimited access are provided.

Calculate a customer’s monthly bill. It should ask the user to enter the letter of the package the customer has purchased (A, B, or C) and the number of hours that were used. Display the total charges.

  1. The formula for converting a temperature from Fahrenheit to Centigrade is

Celsius = 5/9 x (Fahrenheit – 32)

Draw a flowchart and write an algorithm to display the Fahrenheit temperatures 0 through 20 and their Celsius equivalents.

  1. An interest on the next monthly payment can be calculated if you know the balance and the annual percentage interest. The formula as below:

Interest = balance x (annualInterestRate / 1200)

Draw a flowchart to display the interest on the next monthly payment.

  1. A vendor company will give some discounts on it products based on the total units bought by the customer and the price of each unit. The table below shows the discount given with the price and the total units:

Number of the / Price (RM)
items bought / 0.01 – 10.00 / 10.01 – 100.00 / 100.01
1 - 9 / 0% / 2% / 5%
10 - 99 / 5 % / 7% / 9%
100 - 499 / 9% / 15% / 21%
500 – 999 / 14% / 23% / 32%
More than 1000 / 21% / 32% / 43%

Draw a flowchart to analyse the above problem and display the price after the discount.

1

SAK 3100(Sem.1 09/10)