WHAT IS WRONG WITH THIS PROGRAM, I KEEP GETTING THIS ERROR: Main.java:5: class F
ID: 3527456 • Letter: W
Question
WHAT IS WRONG WITH THIS PROGRAM, I KEEP GETTING THIS ERROR:
Main.java:5: class FourNumStat is public, should be declared in a file named FourNumStat.java public class FourNumStat {
//with small function, no arrray
import java.util.Scanner;
public class FourNumStat {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
double a,b,c,d;
double min,max;
System.out.print("Enter four values: ");
a=input.nextDouble();
b=input.nextDouble();
c=input.nextDouble();
d=input.nextDouble();
min=a;max=a;
if(AIsSmallerThanB(b,min)){min=b;}
if(AIsSmallerThanB(c,min)){min=c;}
if(AIsSmallerThanB(d,min)){min=d;}
if(AIsSmallerThanB(max,b)){max=b;}
if(AIsSmallerThanB(max,c)){max=c;}
if(AIsSmallerThanB(max,d)){max=d;}
System.out.println("The smallest of the four values is "+min);
System.out.println("The largest of the four values is "+max);
input.close();
}//end main
public static boolean AIsSmallerThanB(double a, double b){
//returns if a is smaller than b
if(a<b)
return true;
else
return false;
}
}//end class
Explanation / Answer
please do rate :) it is working fine in my compiler ...
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.