import java.util.*;
class Degree2
{
Scanner in()
{ return new Scanner(System.in); }
void out(String m)
{ System.out.print(m); }
double readDouble(String m)
{
out(m);
return in().nextDouble();
}
String readString(String m)
{
out(m);
return in().nextLine();
}
void foundRoot(double a,double b,double c)
{
if(a==0)
out("Value x is: "+(-c/b)+"\n");
else
{
double data=(b*b)-(4*a*c);
if(data>=0)
{
out("Value x1 is: "+((-b-Math.sqrt(data))/(2*a))+"\n");
out("Value x2 is: "+((-b+Math.sqrt(data))/(2*a))+"\n");
}
else
out("The Degree is no root.\n");
}
}
public Degree2()
{
double a,b,c;
String ch;
do
{
a=readDouble("Enter Value A: ");
b=readDouble("Enter Value B: ");
c=readDouble("Enter Value C: ");
foundRoot(a,b,c);
ch=readString("Test again (Yes/No): ");
}while("Yes".equalsIgnoreCase(ch)|"Y".equalsIgnoreCase(ch));
}
public static void main(String[] args)
{ new Degree2(); }
}
I want to clear screen in my program. Please, do help me!!!