Lab 26

Bunch of Lines

 

Objective:

 

Write a bunch of classes that will draw a bunch of lines!  Don’t worry you don’t have to write any graphics, as that part is provided in the driver.  Each line is drawn based on a math function that takes in a given x coordinate and will return its y coordinate.

 

Write an interface called Line

 

Write a class called SlopedLine

 

Write a class called ExponentialLine

 

 

Write a class called SineLine

 

 

Write a class called SawLine

 

Write a class called StaircaseLine

 

HINT: If the lines are looking weird it may be a good idea to print out each of the coordinates and observing what is going on in the method getYPoint

 

 

Example Dialog:

Lab Report Questions

  1. Draw a UML class diagram for this project
  2. Describe polymorphism

Finally:

Upload the files to the dropbox