import java.util.Scanner;
class EvenOrOdd{
public static void main(String[] args){
System.out.println(" Enter parabolic equation in standard form");
System.out.println(" ax^2+bx+c");
Scanner henry = new Scanner(System.in);
double a,b,c,xintercept1,delta,xintercept2,ml,mv,m;
System.out.println(" Enter a - value: ");
a = henry.nextDouble();
System.out.println(" Enter b - value: ");
b = henry.nextDouble();
System.out.println(" Enter c - value: ");
c = henry.nextDouble();
delta = Math.sqrt(b * b - 4 * a * c);
xintercept1 = (-b+delta)/(2*a);
xintercept2 = (-b-delta)/(2*a);
System.out.println(" x-intercepts of the line ");
System.out.println("");
System.out.println(" [("+a+")x^2+("+b+")x+("+c+")]");
System.out.println("");
System.out.println(" are "+xintercept1+" and "+xintercept2);
ml = -b/(2*a);
mv = (4*a*c-b*B)/>/>/(4*a);
m = 2*a;
if (a>0){
System.out.println(" The minimum value is located on");
}else if (a<0){
System.out.println(" The maximum value is located on");
}
System.out.println(" ("+ml+","+mv+")");
System.out.println(" The dervative of the function is ");
System.out.println(" [("+m+")x+("+b+")]");
}
}
I don't know how to make the code repeat itself after I have read all the results.
And I need a place where java can tell if I still want the program to be continuous or not.
such as
System.out.println("Do you want to do another calculation? Y/N")
Y -------- Rerun the code(!!THE CODE ONLY, NOT THE WHOLE PROGRAM!!)
N -------- Terminate the program entirely.
Still new to JAVA, need extra help on coding still.
(Pretty easy code as many of you can tell XD)
This post has been edited by no2pencil: 17 January 2016 - 09:16 PM
Reason for edit:: Added code tags

New Topic/Question
Reply


MultiQuote








|