can someone help with the following program that stores tsud
can someone help with the following program that stores tsudents information, along with an explanation on what the moethods are doing please
Write a Java program which will store, manipulate, and print student registration information.
As part of the solution, identify the following classes:
• Student
• Admissions.
The class Student must have the following fields – Name, Address, Id number, Courses, and Date, where:
• Name is a user defined class comprising of at minimum first name and last name.
• Address is a user defined class comprising of fields - street, city, state, and zip code.
• Date is a predefined class in the java.util package
• The field Courses is a set of no more than five (5) string values representing the courses being registered for. Course names supplied are assumed to be valid and contains no blank space, for instance COP3337 is valid but not COP 3337.
• Id number a string variable that uniquely identifies a student.
The class Student must be capable of adding courses and dropping courses
The class Admissions stores and manipulates the student information (student record). Because the list of students grows dynamically, it is best to use a dynamic data structure such as the ArrayList to store the information. This class should do the following, among other possible activities:
• Add student to the list
• Remove student from the list, which would first involve locating the record in order to remove it. In order to determine which record to remove you must supply the Id number as the search argument.
You are to provide a test class that coordinates the activities of the classes outlined above, by:
• Creating student objects and adding them to the database of the Admissions object
• Manipulating student record by:
o Adding a course(s)
o Dropping a course(s)
• Removing a student from the database
• Displaying list of currently registered students
• Displaying list of all students that were dropped from the course
Display the output in a scrollable pane, and must be formatted as follows:
CURRENTLY ENROLLED
Id number: 123456
Name: Williams, John
Address: 2525 Hartsfield Road
Tallahassee, FL 33319
Date: September 5, 2009
Courses: COP3804, MATH2050, ENG3300
:
:
:
STUDENT WHO WERE DROPPED
Id number: 567890
Name: Roberts, Kay-Anne
Date: September 5, 2009
:
:
Note: Use the class GetData provided to enter the data from the keyboard.
1. import javax.swing.JOptionPane;
2.
3. class GetData
4. {
5. static double getDouble(String s)
6. {
7. return Double.parseDouble(getWord(s));
8. }
9. static int getInt(String s)
10. {
11. return Integer.parseInt(getWord(s));
12. }
13. static String getWord(String s)
14. {
15. return JOptionPane.showInputDialog(s);16. }17. }
can someone help with the following program that stores tsudents information, along with an explanation on what the moethods are doing please
Write a Java program which will store, manipulate, and print student registration information.
As part of the solution, identify the following classes:
• Student
• Admissions.
The class Student must have the following fields – Name, Address, Id number, Courses, and Date, where:
• Name is a user defined class comprising of at minimum first name and last name.
• Address is a user defined class comprising of fields - street, city, state, and zip code.
• Date is a predefined class in the java.util package
• The field Courses is a set of no more than five (5) string values representing the courses being registered for. Course names supplied are assumed to be valid and contains no blank space, for instance COP3337 is valid but not COP 3337.
• Id number a string variable that uniquely identifies a student.
The class Student must be capable of adding courses and dropping courses
The class Admissions stores and manipulates the student information (student record). Because the list of students grows dynamically, it is best to use a dynamic data structure such as the ArrayList to store the information. This class should do the following, among other possible activities:
• Add student to the list
• Remove student from the list, which would first involve locating the record in order to remove it. In order to determine which record to remove you must supply the Id number as the search argument.
You are to provide a test class that coordinates the activities of the classes outlined above, by:
• Creating student objects and adding them to the database of the Admissions object
• Manipulating student record by:
o Adding a course(s)
o Dropping a course(s)
• Removing a student from the database
• Displaying list of currently registered students
• Displaying list of all students that were dropped from the course
Display the output in a scrollable pane, and must be formatted as follows:
CURRENTLY ENROLLED
Id number: 123456
Name: Williams, John
Address: 2525 Hartsfield Road
Tallahassee, FL 33319
Date: September 5, 2009
Courses: COP3804, MATH2050, ENG3300
:
:
:
STUDENT WHO WERE DROPPED
Id number: 567890
Name: Roberts, Kay-Anne
Date: September 5, 2009
:
:
Note: Use the class GetData provided to enter the data from the keyboard.
1. import javax.swing.JOptionPane;
2.
3. class GetData
4. {
5. static double getDouble(String s)
6. {
7. return Double.parseDouble(getWord(s));
8. }
9. static int getInt(String s)
10. {
11. return Integer.parseInt(getWord(s));
12. }
13. static String getWord(String s)
14. {
15. return JOptionPane.showInputDialog(s);16. }17. }
this is the code we have so far but im kind of confused about the whole concept of a tester clas and how its used. could someone revise this code for me and just see if its correct, and if not make adjustements where needed, as well as explain the concept of the tester class and how to implement it in netbeans.
public class Person extends Test
{
// Variables
String name;
int age;
String address;
// Default Constructor
Person()
{
name = \"\";
age = 0;
address = \"\";
}
Person(String name, int age, String address)
{
this.name = name;
this.age = age;
this.address = address;
}
String getName()
{
return name;
}
public void display()
{
System.out.println(\"Name = \"+ name);
System.out.println(\"Age = \"+ age);
System.out.println(\"address = \"+ address);
}
}
public class Student extends Person
{
int studentNum, semester;
Student(String name, int age, String address, int studentNum, int semester)
{
super(name, age, address); // calls parent class’s constructor
this.studentNum = studentNum;
this.semester = semester;
//this.course = course;
}
public String getName() // name
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public int getAge() // age
{
return age;
}
public void setAge(int age)
{
this.age = age;
}
public String getAddress() // address
{
return address;
}
public void setAddress(String address)
{
this.address = address;
}
public int getStudentNum() // studentNum
{
return studentNum;
}
public void setStudentNum(int studentNum)
{
this.studentNum = studentNum;
}
public int getSemester() // semester
{
return semester;
}
public void setSemester(int semester)
{
this.semester = semester;
}
void Display() // Method Overriding
{
}
}
public class Course extends Student
{
String course;
Course(String name, int age, String address, int studentNum, int semester, String course)
{
super(name, age, address, studentNum, semester);
this.course = course;
}
public void display()
{
}
}
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
public class Test implements StudentFees
{
public static void main(String args[ ]) throws IOException
{
System.out.println(\"============\" + \"=================\");
System.out.println(\"Students \" + \"Personal Details\");
System.out.println(\"============\" + \"=================\");
String name, address, course;
int age, studentNum, semester;
List<Student> studentsList = new ArrayList<Student>(); // array list to store user input
for (int i = 0; i < 2; i++)
{
int studentNumber = (i + 1);
//System.out.println(\"\");
//System.out.println(\"Please enter \" + \"data for student \" + studentNumber);
InputStreamReader converter = new InputStreamReader(System.in);
BufferedReader in = new BufferedReader(converter);
System.out.println(\"Enter Student \"+ studentNumber + \" Name:\");
name = in.readLine();
System.out.println(\"Enter Student \" + studentNumber + \" Age (Integer):\");
age = Integer.valueOf(in.readLine());
System.out.println(\"Enter Student \" + studentNumber + \" Address:\");
address = in.readLine();
System.out.println(\"Enter Student \" + studentNumber + \" Number:\");
studentNum = Integer.valueOf(in.readLine());
System.out.println(\"Enter Student \" + studentNumber + \" Semester:\");
semester = Integer.valueOf(in.readLine());
System.out.println(\"Enter Student \" + studentNumber + \" Course:\");
course = in.readLine();
Student student = new Student(name, age, address, studentNum, studentNum);
studentsList.add(student); // add student
}
for (int j = 0; j < studentsList.size(); j++)
{
Student st = studentsList.get(j);
System.out.println(\"Information of Student : \" + (j + 1));
System.out.println(\"\");
System.out.println(\"Name: \" + st.getName() + \" - Age: \"+st.getAge() + \" - Address: \" + st.getAddress() + \" - Student Number: \" + st.getStudentNum() + \" - Semester: \" + st.getSemester() + \" - Course: \" + st.getCourse()); // print out results entered by user
System.out.println(\"\");
}
}
String course;
public String getCourse()
{
return course;
}
public void setCourse(String course)
{
this.course = course;
}
public void payFees(float fees)
{
}
}
Solution
The interesting part is in main() and the use of Scanner. This solution also uses an ArrayList to store the results, and a for-each loop to iterate through them.
import java.util.*; public class Student { private String m_name; private int m_age; private String m_course; private String m_year; private String m_section; public Student( String name, int age, String course, String year, String section ) { m_name = name; m_age = age; m_course = course; m_year = year; m_section = section; } public String getName() { return m_name; } public int getAge() { return m_age; } public String getCourse() { return m_course; } public String getYear() { return m_year; } public String getSection() { return m_section; } public String toString() { return \"name: \" + m_name + \", age: \" + m_age + \", course: \" + m_course + \", year: \" + m_year + \", section: \" + m_section; } public static void main(String[] args) { ArrayList<Student> students = new ArrayList<Student>(); Scanner input = new Scanner(System.in); int menuChoice = 4; do { System.out.println(\"\\t\\t\\tStudent Record Menu\"); System.out.println(\"\\t\\t1. Add Student\\t2. View Students\\t3. Search Student\\t4. Exit\"); try { System.out.println(\"Enter a choice: \"); menuChoice = Integer.parseInt(input.nextLine()); } catch (NumberFormatException e) { continue; } if (menuChoice==1) { System.out.println(\"Full name:\"); String name = input.nextLine(); int age = -1; do { try { System.out.println(\"Age:\"); age = Integer.parseInt(input.nextLine()); } catch (NumberFormatException e) { System.out.println(\"Enter a number!\"); continue; } } while (age <= 0); System.out.println(\"Course:\"); String course = input.nextLine(); System.out.println(\"Year:\"); String year = input.nextLine(); System.out.println(\"Section:\"); String section = input.nextLine(); Student student = new Student(name, age, course, year, section); students.add(student); } else if (menuChoice==2) { System.out.println(\"Students:\"); for (Student student : students) { System.out.println(student); } } } while (menuChoice<4); } }
We want to call nextLine() to collect an entire line of input at a time. Calling next() will return the next token, and supposing the user enters a series of nnwords (a space delimited list of tokens) it wil







