Tuesday, January 20, 2015

Lab 5

Temp Employer wants a program that will allow the company's clerk to enter an employee's name and the number of hours the employees works every month. The program will display the name, number of weeks, days and hours worked. For example, if the employee enters the number 70, the program will display the employee's name, then 1 week, 3 days, and 6 hours.

List the input, process and output
Draw the flow chart
Write a program


Design an algorithm for a program to convert temperature in degrees Fahrenheit to degrees Celsius. The equation for this conversion is:
Celsius = 5.0 / 9.0 (Fahrenheit - 32.0)


Design an algorithm for a program to calculate the sum of the numbers from 1 to 100. The formula for calculation this sum is:
sum = (n / 2) (2 * a + (n - 1) d)
where n is number of terms to be added, a is the first number abd d is the difference between each number.



Shipping Industries  needs a program that allows its shipping staff to enter an item's name, the quantity of the item in inventory, and how many units of the item can be packed in a box for shipping. The program should display the item's name, the number of full boxes that can be packed from the quantity on hand, and the quantity of items left over.


Write a program to calculate and display the coordinates of the midpoint of the line connecting the two points whose coordinates are entered by user (x1, y1) and (x2, y2). Use the fact that the coordinates of the midpoint between two points having coordinates (x1, x2) and (x2, y2) are ((x1+x2)/2), ((y1+y2)/2). The display produced by your program should be:

The x corrrdinate of the midpoint is xxx.xx
The y coordinate of the midpoint is yyy.yy

where xxx.xx and yyy.yy denotes that the calculated value should be placed in a field wide enough for three places to the left of the decimal point and two places to the right of it.



Write a program to create a customer's bill for a company. The company sells five computer gadgets which are CD, keyboard, printer, pen drive and speaker. The unit prices are RM60.00 per pack, RM130.00, RM850.00, RM65.00 and RM72.50, respectively.The program must read from the keyboard the quantity of each piece of equipment purchased. It then calculates the cost of each item, the subtotal, and the total cost after 3.25% sales tax.

Use constant for the unit prices and the tax rate.



No comments:

Post a Comment