Professional Documents
Culture Documents
Assignment 1
Assignment 1
Assignment 1
LAB ASSIGNMENT 1
QUESTION 1
Write a C++ 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, y1) and (x2, y2) are ((x1+x2)/2), ((y1+y2)/2). The display produced by
your program should be :
where xxx.xx and yyy.yy denotes that the calculated value should be places in a field
wide enough for three places to the left of the decimal point and two places to the right of it.
NORMAZIAH - FSKM
CSC415
QUESTION 2
Write a program to create a customer’s bill for a company. The company sells five computer
devices which are Mouse, Keyboard, Printer, Pen drive and Speaker. The unit prices are
RM35.00 per pack, RM175.00, RM350. RM32.00 and RM105.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, sale and service tax (SST= 8%) and the total
cost after SST.
The input data consists of a set of integers representing the quantities of each items sold.
* Use constant for the unit prices and the SST rate.
NORMAZIAH - FSKM