Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(PLEASE HELP ME FIX THE ERROR IN THIS PROGRAM) import java.util.Scanner; public

ID: 3584571 • Letter: #

Question

(PLEASE HELP ME FIX THE ERROR IN THIS PROGRAM) import java.util.Scanner; public class Child1 { public static void main(String [] args){ float a,b,c,d; Scanner sc = new Scanner(System.in); System.out.println("Please Enter the value of 1st number"); a = sc.nextFloat(); System.out.println("Please Enter the value of 2nd number"); b = sc.nextFloat(); System.out.println("Please Enter the value of 3rd number"); c = sc.nextFloat(); System.out.println("Please Enter the value of 4th number"); d = sc.nextFloat(); System.out.println("The Sum of 4 numbers is :"+(a+b+c+d)); System.out.println("The product of 4 numbers is :"+(a*b*c*d)); System.out.println("The product of sum of 1st 2 numbers and last 2numbers is :"+((a+b)*(c+d))); } } Main.java:2: error: class Child1 is public, should be declared in a file named Child1.java public class Child1 { ^ 1 error

Explanation / Answer

I formatted it;

Please Rate it


import java.util.Scanner;
class Child1
{
public static void main(String [] args)
{
float a,b,c,d;
Scanner sc = new Scanner(System.in);
System.out.println("Please Enter the value of 1st number");
a = sc.nextFloat();
System.out.println("Please Enter the value of 2nd number");
b = sc.nextFloat();
System.out.println("Please Enter the value of 3rd number");
c = sc.nextFloat();
System.out.println("Please Enter the value of 4th number");
d = sc.nextFloat();
System.out.println("The Sum of 4 numbers is :"+(a+b+c+d));
System.out.println("The product of 4 numbers is :"+(a*b*c*d));
System.out.println("The product of sum of 1st 2 numbers and last 2numbers is :"+((a+b)*(c+d)));
}
}