Question: //What is wrong with this two files: import java.util.Scanner; public class TestScore1{ public static void main(String[] args) { int test1; int test2; int test3; double

//What is wrong with this two files:

import java.util.Scanner; public class TestScore1{ public static void main(String[] args) { int test1; int test2; int test3; double average; Scanner keyboard = new Scanner(System.in); testScoreAverage = new Average ();

System.out.print("Enter first test score "); testScoreAverage.settest1 = keyboard.nextint(); System.out.print("Enter second test score "); testScoreAverage.settest2 = keyboard.nextint(); System.out.print("Enter third test score "); testScoreAverage.settest3 = keyboard.nextint();

System.out.println("Average score " + getAverage()); } }

//Second one

class Average{ private int test1; private int test2; private int test3; private double average;

public void setTest1(int t1) { test1 = t1; } public void setTest2(int t2) { test2 = t2; } public void setTest3(int t3) { test3 = t3; }

public int getTest1() { return test1; } public int getTest2() { return test2; } public int getTest3() { return test3; }

public double getAverage() { return (test1+test2+test3)/3 ; } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!