You are on page 1of 1

CLB 10503 PRINCIPLE OF PROGRAMMING Assignment 1 Problem 1: ( 20 marks) A project currently underway at Chemical Labs, Inc.

requires that a substance be continually heated in a vat. A technician must check the substances temperature every 15 minutes. If the substances temperature does not exceed 102.5 degrees Celsius, then the technician does nothing. However, if the temperature is greater than 102.5 degrees Celsius, the technician must turn down the vats thermostat, wait 5 minutes, and check the temperature again. The technician repeats these steps until the temperature does not exceed 102.5 degrees Celsius. The director of engineering has asked you to write a program that guides the technician through this process. Here is the algorithms: 1. Prompt the user to enter the substances temperature. 2. Repeat the following steps as long as the temperature is greater than 102.5 degrees Celsius: a) Tell the technician to turn down the thermostat, wait 5 minutes, and check the temperature again. b) Prompt the user to enter the substances temperature 3. After the loop finishes, tell the technician that the temperature is acceptable and to check if again in 15 minutes. Problem 2: ( 30 marks) Write a program that will predict the size of a population of organisms. The program should ask the user for the starting number of organisms, their average daily population increase (as a percentage), and the number of days they will multiply. A loop should display the size of the population for each day. Input Validation : Do not accept a number less than 2 for the starting size of the population. Do not accept a negative number for average daily population increase. Do not accept a number less than 1 for the number of days they will multiply. Implementation: A. For this assignment, you may work in group of NOT more than three(3) persons. (Note : For each problem, read it several times until you understand it. Think how to solve the problem before coding. Translate your logic into a program. A problem often can be solved in many different ways. Students are encouraged to explore various solutions.) B. C. Each program should be complete and can be compiled and executed. Run the program with test data for input and print screen the program output.

Grading: A. The design of your program. B. C. The correctness and format of your output. The clarify, neatness and documentation of your code.

Submitting: A.

Print out the programs source codes and sample output and hand the print-out to me by : 22/March/2013. Dont forget to write your group members name, ID and section on the print-out.

B.

PREPARED BY : MDM TEO SIEW HWAY

You might also like