Showing posts with label CSC128. Show all posts
Showing posts with label CSC128. Show all posts

Thursday, February 5, 2015

Exercise


Write a program that ask user to enter student's full name. Repeat the process until user click 'N'.
After the program stop, the program will display the total number of students


Write a program that ask user to input student's full name, three quizzes, two test and two assignments. And calculate the total marks. Repeat the process until no more student to enter.

Thursday, January 22, 2015

Lab 8

NASA Consultant Co Ltd wants to develop a program that can help the consultant to give advice regarding the home loan. The program receives four inputs from the consultant, which are the amount of House Cost in Ringgit Malaysia and years of term applied. Based on these two inputs, program should be able to calculate the monthly repayment. The table for the interest calculation is provided as follows:

Year >= 25, interest 7.5%
Year >= 20, interest 6.5%
Year >= 15, interest 5.5%
Year >= 10, interest 4.5%
Year < 10, interest 4.0%

The formulas for the monthly repayment calculation are as follows:
Interest (RM) = interest (%) x house cost (RM)
House cost with interest = house cost (RM) + interest (RM)
Monthly repayment = house cost with interest / (year of term applied x 12)


YSM Co Ltd is one of the promotion companies. This company wants you to develop a program to help up in calculating the bonus for its employees. The bonus will be calculated based on the sales of the employee and monthly salary. Your program should be able receive two inputs from user, which are sales in Ringgit Malaysia and Monthly Salary. This program should therefore be able to calculate and display the bonus to the user. The table for the bonus rate and index for monthly salary is provided as follows:

The formulas for calculation are as follows:
Bonus based on sales = sales (RM) x bonus (%)
Bonus (RM) = (Monthly salary x index) + bonus based on sales




Tuesday, January 20, 2015

Lab 6


YDL National Bank wants to develop a program that can help the customer to calculate the monthly installment. The program should be able to receive two inputs from the customer, which are the amount of loan in Ringgit Malaysia and year of installment. Based on these two inputs, the program should therefore be able to calculate the monthly installment. The table for the interest calculation is provided as follows:

Year < 5, interest 4.5%
Year >= 5, interest 6.5

The formulas for the monthly installment calculation are as follows:

Interest (RM) = Interest (%) x amount of loan
total loan with interest = amount of loan + interest (RM)
monthly installment = total loan with interest / (year of installment x 12)



Nova Hypermarket in your town wants to organize an annual sale. The owner of the hypermarket wants you to help him to develop a program that helps the cashier to calculate and display the payment after discount. The table for the discount is provided as follows:
Amount RM >= 5, discount 5%
Amount RM < 5, no discount

The formulas for the calculation are as follows:
Discount (RM) = Discount (%) x Amount (RM)
Payment after discount = amount (RM) – discount (RM)


SSY Co Ltd is one of the finance companies. This company wants you to develop a program which helps up in calculating the bonus for its employees. The bonus will be calculated based on the performance mark of the employee. Your program should be able to receive performance mark from the user and display the bonus to the user as well. The table for the bonus is provided as follows:
6 <= Mark <= 10 , Bonus RM2,000
< 6, Bonus RM1,000



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.