I have two files, one holds the code i want to send to another file how do i do this?
This is the code I have for the main file:
This is the code im trying to import
Sorry there is so much code.
This is the code I have for the main file:
Code:
package testingclasses;
public class TestingClasses {
public static void main(String[] args) {
//code needs to be imported here.
}
}
Code:
package testingclasses;
import java.util.Scanner;
public class linearFunction {
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
System.out.println("You have Chosen the Linear Function Solving!");
System.out.println("This part of the program is going to ask you for three things, first it is going to ask");
System.out.println("you for your coefficient, then it is going to ask you for your constant,");
System.out.println("then it is going to ask you for three numbers that are going to substitute for x.");
System.out.println();
System.out.println("Okay here we go!");
System.out.println("What is your coefficient?");
double coef = scan.nextDouble();
System.out.println("");
System.out.println("What is your constant?");
double constant = scan.nextDouble();
System.out.println("What are your three constants?");
double a = scan.nextDouble();
double b = scan.nextDouble();
double c = scan.nextDouble();
System.out.println("");
System.out.println("Your function should look like this, y=" + coef + "(x)" + "+" + constant);
System.out.println("**************************************************************************");
System.out.println("Your Functions with the x substitutes should look like this...");
String function1 = "f(x)=" + coef + "(" + a + ")" + "+" + constant;
String function2 = "f(x)=" + coef + "(" + b + ")" + "+" + constant;
String function3 = "f(x)=" + coef + "(" + c + ")" + "+" + constant;
System.out.println("Function 1 => " + function1);
System.out.println("Function 2 => " + function2);
System.out.println("Function 2 => " + function3);
System.out.println("**************************************************************************");
System.out.println("Your funstion's answers should look like this.");
System.out.println("**************************************************************************");
double one = coef * a + constant;
double two = coef * b + constant;
double three = coef * c + constant;
System.out.println("Answer Function 1 =>" + one );
System.out.println("Answer Function 2 =>" + two );
System.out.println("Answer Function 3 =>" + three );
System.out.println("**************************************************************************");
System.out.println("Your Funstion table should look like this,");
System.out.println("**************************************************************************");
System.out.println("X | Y");
System.out.println(a + "|" + one);
System.out.println(b + "|" + two);
System.out.println(c + "|" + three);
System.out.println("**************************************************************************");
System.out.println();
System.out.println("This is other important info");
System.out.println("**************************************************************************");
System.out.println("Slope = " + coef );
System.out.println("Y-intercept = " + constant );
System.out.println("**************************************************************************");
}
}
Comment