Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

completed in Java Eclipse tests. Provide a constructor that sets on parameter values. Ove test score is assumed to be in ber (1 through 3)

completed in Java Eclipse image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
tests. Provide a constructor that sets on parameter values. Ove test score is assumed to be in ber (1 through 3) and the score. Also uctor that sets all instance values based eter values. Overload the constructor such the assumed to be initially zero. Provide a method two parameters: the test num- called setTestScore that accepts two parameters: the ugh 3) and the score. Also provide a method called getTestScore that accepts the test number and returns riate score. Provide a method called average that com. putes and returns the average test score for this student. Modify the toString method such that the test scores and average included in the description of the student. Modify the driver class main method to exercise the new Student methods. appropriate score. Provide a me project in called Assignment05. Call this program StudentTester (this will contain the main method). Create two other classes called Student and Address, respectively (there will be no main method within these classes). You are to use GUIs for your input into the program. Your program may print to console however. Specifically you are to use option panes from the swing class, so you will have to import the javax.swing package into your program to do this. You are to use the class NumberFormat for formatting numbers so you should import this class too. First thing you should do, open the file called studentTester from Files/AssignmentDatafiles and bopy it into the program you created above (i.e. you will overwrite it). Do the same for the files called Student and Address import for number formatting import java.text.Decimal Format: public class student private String firstName, lastName: private Address homeaddress, schoolAddress: add instance fields for the three test scores private int testi, test2, test3 public student (string first String last, Address borte, Address School, incl, int 2, int (3) firstName= first; lastName last home Address home schoolAddress School 7/set test scores to be parameter } // end constructor student public Student (String first, String last, Address home, Address school) firstName u first; lastName = last; homeAddresshome, schoolAddress = school; ) // set test scores to be zero // end overloaded constructor Student public void setTestscore (int testNumber, int score) 1 11 end method setTest Score public int getTestscore(int testNumber) int test score; return -1; // to be taken out 1 1/ end method getTestscore public double getAverage () double average; // calculate average test score } return -1; // to be taken out // end method getAverage public String tostring() string result: 7 declare type of format for formating numbers Decinal Format fmt = new Decimal Format("0. ##"); // build up string for display / add information about the test scores return ""; // to be taken out; // end method tosuring } // end class Student import javax.swing W for GUIs using swing public class StudentTester { @param args public static void main(String[] args) W declare local variables to be used in program String street, town, state, zipCode Textil String firstName, lastName, testScore.Text; String testScore2 Text, test score 3 Texts int zipCode, test Scorel, test Score2, test Score3; Address school = new Address 0800 Lancaster Ave", "Villanova", "PA 19085); //enter student information via W option panes W prompt and read in first // name and last name of student // prompt and read in three test scores of // student and convert each to an integer W 2 instantiate an object about student's home address // instantiate an object about student (home and // school address and test scores) V print out into about student using option pane W replace test score two with another value // now update test score number two // show in option pane that a new score for test // two has taken place // print out info about student using option pane JOption Pane.showMessageDialog (null, "This program was written by Dr. Castaneda" + " End of program."); // end method main } } // end class Student Tester public class Address { // declare instance fields to be be used in the address private String streetAddress, city, state; private int ZipCode; public Address (String street, String town, String st, int zip) streetAddress = street; city = town; state = gt; zipCode = zip; // end constructor Address public String toString() String result; result = streetAddress + " "; result += city + ", " + state + " " + zipCode; return result; // end method toString } // end class Address

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application Development And Administration

Authors: Mannino Michael

5th Edition

0983332401, 978-0983332404

More Books

Students also viewed these Databases questions