lab7 - 2 Point-slope form(you know the line's slope and one...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
ECC 3101- Computer Programming Lab Sheet 7- function 1. Write a program for an automatic teller machine that dispenses money. The user should enter the amount desired (a multiple of RM10) and the machine dispenses this amount using the least number of bills. The bills dispensed are 50s, 20s and 10s. Write a function that determines how many each kind of bill to dispense. 2. The table below summarizes three commonly used mathematical models of nonvertical straight lines. Mode Equation Given Two-point form m=((y 2 -y 1 ) / (x 2 -x 1 )) (x 1 ,y 1 ), (x 2 ,y 2 ) Point-slope form y-y 1 = m(x-x 1 ) m, (x 1 ,y 1 ) Slope intercept form y=mx +b m,b Design and implement a program that permits the user to convert either two-point form or point-slope form into slope-intercept form. Your program should interact with the user as follow: Select the form that you would like to convert to slope-intercept form: 1) Two-point form (you know two points on the line)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 2) Point-slope form (you know the line's slope and one point) => 2 Enter the slope=> 4.2 Enter the x-y coordinates of the point separated by a space=>1 1 Point-slope form y – 1.00 = 4.20(x-1.00) Slope-intercept form y = 4.20x – 3.20 Do another conversion (Y or N)=> Y 3. The electric company charges according to the following rate schedule: 9 cents per kilowatt-hour (kwh) for the first 300 kwh 8 cents per kwh for the next 300 kwh (up to 600 kwh) 6 cents per kwh for the next 400 kwh (up to 1000 kwh) 9 cents per kwh for all electricity used over 1000 kwh Write a function to compute the total charge for each customer. Write a main function to call the charge calculation function and should print out the ID no of customer, the total kilowatt-hours used and the total charges....
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online