Question: Import it into Eclipse. Finish the code so the output looks like the output below. Do the coding in Eclipse and Java. starting code main
Import it into Eclipse. Finish the code so the output looks like the output below. Do the coding in Eclipse and Java.
starting code main code
static String States[] = new String[50];
static String Capitals[] = new String[50];
static int MyNumbers[] = new int[10];
static Student AllStudents[] = new Student[10];
static int totalstudents = 0;
static Student pupil = null;
public static void LoadStates() {
States[0] = "Alabama";
Capitals[0] = "Montgomery";
States[1] = "Alaska";
Capitals[1] = "Juneau";
States[2] = "Arizona";
Capitals[2] = "Phoenix";
States[3] = "Arkansas";
Capitals[3] = "Little Rock";
States[4] = "California";
Capitals[4] = "Sacramento";
States[5] = "Colorado";
Capitals[5] = "Denver";
States[6] = "Connecticut";
Capitals[6] = "Hartford";
States[7] = "Delaware";
Capitals[7] = "Dover";
States[8] = "Florida";
Capitals[8] = "Tallahassee";
States[9] = "Georgia";
Capitals[9] = "Atlanta";
States[10] = "Hawaii";
Capitals[10] = "Honolulu";
States[11] = "Idaho";
Capitals[11] = "Boise";
States[12] = "Illinois";
Capitals[12] = "Springfield";
States[13] = "Indiana";
Capitals[13] = "Indianapolis";
States[14] = "Iowa";
Capitals[14] = "Des Moines";
States[15] = "Kansas";
Capitals[15] = "Topeka";
States[16] = "Kentucky";
Capitals[16] = "Frankfort";
States[17] = "Louisiana";
Capitals[17] = "Baton Rouge";
States[18] = "Maine";
Capitals[18] = "Augusta";
States[19] = "Maryland";
Capitals[19] = "Annapolis";
States[20] = "Massachusetts";
Capitals[20] = "Boston";
States[21] = "Michigan";
Capitals[21] = "Lansing";
States[22] = "Minnesota";
Capitals[22] = "St. Paul";
States[23] = "Mississippi";
Capitals[23] = "Jackson";
States[24] = "Missouri";
Capitals[24] = "Jefferson City";
States[25] = "Montana";
Capitals[25] = "Helena";
States[26] = "Nebraska";
Capitals[26] = "Lincoln";
States[27] = "Nevada";
Capitals[27] = "Carson City";
States[28] = "New Hampshire";
Capitals[28] = "Concord";
States[29] = "New Jersey";
Capitals[29] = "Trenton";
States[30] = "New Mexico";
Capitals[30] = "Santa Fe";
States[31] = "New York";
Capitals[31] = "Albany";
States[32] = "North Carolina";
Capitals[32] = "Raleigh";
States[33] = "North Dakota";
Capitals[33] = "Bismarck";
States[34] = "Ohio";
Capitals[34] = "Columbus";
States[35] = "Oklahoma";
Capitals[35] = "Oklahoma City";
States[36] = "Oregon";
Capitals[36] = "Salem";
States[37] = "Pennsylvania";
Capitals[37] = "Harrisburg";
States[38] = "Rhode Island";
Capitals[38] = "Providence";
States[39] = "South Carolina";
Capitals[39] = "Columbia";
States[40] = "South Dakota";
Capitals[40] = "Pierre";
States[41] = "Tennessee";
Capitals[41] = "Nashville";
States[42] = "Texas";
Capitals[42] = "Austin";
States[43] = "Utah";
Capitals[43] = "Salt Lake City";
States[44] = "Vermont";
Capitals[44] = "Montpelier";
States[45] = "Virginia";
Capitals[45] = "Richmond";
States[46] = "Washington";
Capitals[46] = "Olympia";
States[47] = "West Virginia";
Capitals[47] = "Charleston";
States[48] = "Wisconsin";
Capitals[48] = "Madison";
States[49] = "Wyoming";
Capitals[49] = "Cheyenne";
}
public static void LoadMyNumbers() {
Random rand = new Random();
int min = 0;
for (int i = 0; i MyNumbers[i] = rand.nextInt((100 - min) + 1) + min;
}
}
public static void PrintMyNumbers() {
String s = "print array of numbers";
// fill in code here
JOptionPane.showMessageDialog(null, s);
}
public static void SearchStates() {
String inputstring1 = "Press Cancel to finish - What is the Capital of: ";
String finalinputstring = "";
String correctoutputmsg = "";
String outputmsg = "search states";
String msg = "";
String caps = "";
String Answer = "X";
int countright = 0;
Boolean keepgoing = true;
int row = 0;
while (keepgoing) {
// fill in code here
keepgoing = false;
}
JOptionPane.showMessageDialog(null, outputmsg);
}
public static int Sum(int N) {
int total = 0;
// fill in code here
return total;
}
public static void Average() {
String outputmsg = "The average of ";
int x = 0, y = 0, z = 0;
double ave;
// fill in code here
String Answer = JOptionPane.showInputDialog("What is X?");
x = Integer.parseInt(Answer);
Answer = JOptionPane.showInputDialog("What is Y?");
y = Integer.parseInt(Answer);
Answer = JOptionPane.showInputDialog("What is Z?");
z = Integer.parseInt(Answer);
JOptionPane.showMessageDialog(null, outputmsg);
}
public static void AddStudents() {
//you do not need to edit this code in this method
AllStudents[totalstudents] = new Student("Dr. Roger Webster", totalstudents, 60, 12);
totalstudents++;
AllStudents[totalstudents] = new Student("John Smith", totalstudents, 45, 12);
totalstudents++;
AllStudents[totalstudents] = new Student("Susan Smith", totalstudents, 45, 12);
totalstudents++;
AllStudents[totalstudents] = new Student("Tom Brady", totalstudents, 100, 25);
totalstudents++;
}
public static void PrintAllStudents() {
String outputmsg = "print each student here..";
// fill in code here
for (int i = 0; i
JOptionPane.showMessageDialog(null, outputmsg);
}
}
public static void main(String[] args) {
// fill in code
String outputmsg = " ";
double average = 0;
int N = 0;
// code a Java method/function called Sum that reads in an integer n
// returns the sum of the numbers from 1 to n. For example, if the
// user enters 5, the code will add up the numbers 1+2+3+4+5 and return the
// value 15. You will need an input dialog box for N.
// if the user types 7 for N then the loop needs to add up all nums from 1 to N
String Answer = JOptionPane.showInputDialog("What is N?");
int total = Sum(N);
outputmsg = "The sum of " + N + " is: " + total;
JOptionPane.showMessageDialog(null, outputmsg);
// Write a Java program piece that asks the user for three integers called x,
// y,z
// then outputs the average of these values.
// The output value should be a double value, not an integer.
Average();
// Write a Java method/function that will print out the all the
// integers in the array called int MyNumbers[] = new int[10];
LoadMyNumbers();
PrintMyNumbers();
// a Java method/function called PrintAllStudents() that
// prints out all the students in the array:
// Student AllStudents[] = new Student[10];
AddStudents();
PrintAllStudents();
// ur code Java method/function called SearchStates that shows the user
// a state and then asks the user to type in the capital. It tells you if you
// are
// correct. For example, if the user enters Boston for Massachusetts,
// the code will pop up yes you are correct, else it says you are wrong and
// shows the correct answer.
LoadStates();
SearchStates();
}
}
student.java
// the private data members
private int idNumber;
private int hours;
private int points;
private String name = "";
// Constructor default
Student(String Name) {
idNumber = 0;
points = 0;
hours = 0;
name = Name;
}
// Constructor 2
Student(String Name, int in_idNumber, int in_points, int in_hours) {
idNumber = in_idNumber;
points = in_points;
hours = in_hours;
name = Name;
}
// end of constructor added in part c
// the public get and set methods
public void setIDnumber(int number) {
idNumber = number;
}
public String getName() {
return name;
}
public int getIDnumber() {
return idNumber;
}
public void setHours(int number) {
hours = number;
}
public int getHours() {
return hours;
}
public void setPoints(int number) {
points = number;
}
public int getPoints() {
return points;
}
public double getGradePoint() {
return (points * 1.0 / hours);
}
}
output
ARISTOT Input What is N ? 7 Cancel OK
Step by Step Solution
3.32 Rating (155 Votes )
There are 3 Steps involved in it
public class Student private data members private int idNumber private int hours private int points ... View full answer
Get step-by-step solutions from verified subject matter experts
