Question: Please answer using **JAVA** Linear Function Students will demonstrate knowledge of using Interfaces. You are a software engineer with the Blue Pelican Engineering Corporation. Your
Please answer using **JAVA**



Linear Function Students will demonstrate knowledge of using Interfaces. You are a software engineer with the Blue Pelican Engineering Corporation. Your immediate supervisor has need of a class called Linear Function and she knows exactly the methods that it needs to include. Not having time to write it herself, she assigns the job to you. To insure that you produce exactly the methods she wants, she is providing the interface below and requiring that you implement this interface in the Linear Function class you produce. When your project is complete, she will simply look at your class signature and if she sees implements Linear Function Methods, she will know for certain that you have implemented all the methods she originally specified in the interface; otherwise, your code would not compile. public interface LinearFunction Methods //remove "public" when implementing in a single file double getSlope(); double getYintercept(); double getRoot(); double get Yvalue (double x); I/return the y value corresponding to x double getXvalue (double y); I/return the x value corresponding to y For simplicity we will assume that the linear function's graph can never be vertical or horizontal. (This eliminates some complications with the math). In writing your methods, simply recall the y = mx + b portion of your algebra studies. The constructor of your class should allow you to pass the slope (m) and y-intercept(b) of the LinearFunction object you are instantiating. Test your LinearFunction class with the Tester class below: import java.io.*; import java.util." public class Tester public static void main(String args[]) Scanner kbReader = new Scanner(System.in); System.out.print("What is the slope of your line? "); double slope = kb Reader.nextDouble(); Test your LinearFunction class with the Tester class below: import java.io.*; import java.util.*; public class Tester { public static void main(String args[]) { Scanner kbReader = new Scanner(System.in); System.out.print("What is the slope of your line? "); double slope = kb Reader.nextDouble(); System.out.print("What is the y-intercept of your line? "); double yIntc = kbReader.nextDouble(); Linear Function line = new LinearFunction(slope, yintc); Rev.B System.out.println(" Slope of this line is: " + line.getSlope()); System.out.println("Y-intercept of this line is:" + line.getYintercept()); System.out.println("Root of this line is: " + line.getRoot()); System.out.print(" What is an x value for which you wish to solve for y?"); double x = kbReader.nextDouble(); double y Value = line.getYvalue(x); System.out.println("The y value corresponding to X=" + x + "is" + y Value); Rev.B System.out.println(" Slope of this line is: " + line.getSlope()); System.out.println("Y-intercept of this line is: " + line.getYintercept()); System.out.println("Root of this line is: " + line.getRoot()); System.out.print(" What is an x value for which you wish to solve for y? "); double x = kbReader.nextDouble(); double y Value = line.getYvalue(x); System.out.println("The y value corresponding to x =" + x + "is" + y Value); System.out.print(" What is a y value for which you wish to solve for x? "); double y = kbReader.nextDouble(); double xValue = line.getXvalue(y); System.out.println("The x value corresponding to y =" + y +" is " + xValue); } } A sample run follows (Eclipse output shown). D. Problems Javadoc Declaration Console X ** Ex Role
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
