I was given a problem:
Design a TestScores class that has fields to hold three test scores. The class should have accessor and mutator methods for the test score fields, and a method that returns the average of the test scores. Demonstrate the class by writing a separate program that creates an instance of the class. The program should ask the user to enter three test scores, which are stored in the TestScores object. Then the program should display the average of the scores, as reported by the TestScores object.
The class seems to work fine, its the exe file that isnt running. I get
G:\CIS 18A\week2\Test_KagawaDavidDemo.java:12: cannot find symbol
symbol : constructor Test_KagawaDavid()
location: class Test_KagawaDavid
Test_KagawaDavid Scores = new Test_KagawaDavid();
^
G:\CIS 18A\week2\Test_KagawaDavidDemo.java:16: cannot find symbol
symbol : variable nextDouble
location: class java.util.Scanner
Scores.setTest1(input.nextDouble);
^
G:\CIS 18A\week2\Test_KagawaDavidDemo.java:19: cannot find symbol
symbol : variable nextDouble
location: class java.util.Scanner
Scores.setTest2(input.nextDouble);
^
G:\CIS 18A\week2\Test_KagawaDavidDemo.java:22: cannot find symbol
symbol : variable nextDouble
location: class java.util.Scanner
Scores.setTest3(input.nextDouble);
^
4 errors
/* This is the Class */
args) { Test_KagawaDavid Scores = new Test_KagawaDavid(); Scanner input = new Scanner(System.in); System.out.println("Enter Test1 "); Scores.setTest1(input.nextDouble); System.out.println("Enter Test2 "); Scores.setTest2(input.nextDouble); System.out.println("Enter Test3 "); Scores.setTest3(input.nextDouble); System.out.println("Average of these scores is: " + Scores.average()); JOptionPane.showMessageDialog(null,"Program Complete"); } }
What Am I doing Wrong?