Question
This is a Java question. I am getting the error Exception inthread main java.lang.Error: Unresolved compilation problems: //Goals: //Have user enter quantity of tests //Have
This is a Java question. I am getting the error "Exception inthread "main" java.lang.Error: Unresolved compilation problems:"
//Goals:
//Have user enter quantity of tests
//Have user enter test scores respectively
//Calculate test average
import java.util.Scanner;
public class Lab2 {
public static void main(String[] args){
int test1, test2,test3;
final int TOTAL_TESTS =3;
double average;
Scanner scan = new Scanner(System.in);
System.out.print("Enter test1score");
test1 = in.nextInt();
System.out.print("Entertest2 score");
test2 = in.nextInt();
System.out.print("Entertest3 score");
test3 = in.nextInt();
average = (test1 + test2 +test3) / (double)TOTAL_TESTS;}
}
Package Explorer X T Lab1.java Java - CSE_Lab1_JonCudo/src/Lab2.java - Eclipse - /Users/jonthancudo/Documents/workspace "Lab2.java Addition.java //Have user enter test scores respectively //Calculate test average TempConverter.java CSE_Lab1_JonCudo src (default package) Addition.java Lab1.java Lab2.java TempConverter.java JRE System Library [CDC-1.1/Founda A import java.util.Scanner; public class Lab2 { public static void main(String[] args) { int test1, test2, test3; final int TOTAL...TESTS = 3; double average; Scanner scan = new Scanner (System.in); System.out.print("Enter test1 score"); - int test1 = in.nextInt(); System.out.print("Enter test2 score"); int test2in.nextInt(); System.out.print("Enter test3 score"); int test in.nextInt(); - average (test1 + test2 + test3) (double)TOTAL_TESTS;} } Problems @Javadoc Declaration Console X Lab2 [Java Application]/Library/Java/JavaVirtual Machines/jdk1.8.0_111.jdk/Contents/Home/bin/java (Jan 13, 2017, 10:17:56 AM) Exception in thread "main" java.lang.Error: Unresolved compilation problems: The local variable test1 may not have been initialized The local variable test2 may not have been initialized The local variable test3 may not have been initialized at Lab2.main(Lab2.java:29) Task List X A Connect Mylyn Connect to your ta create a local task. Outline X B Lab2 main(String[
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started