Here are the parameters:
1. Have a console menu system to:
Add an instructor
Add a student
Exit the program
2. capture all user information using the scanner class
3. Ask the user type of "person" they want to add (Instructor/Student)
4. Ask last name of instructor/student
5. Ask first name of instructor/student
6. If they are an instructor, ask them how many years they've been teaching; if they are a student, ask them how many years they've been attending school. Verify that what they input is a number using exception handling
7. Store all this information in the object/class
8. Create a person class with appropriate data members and member methods. Extend the person class into Instructor and Student, again with appropriate data members and member methods
9. Use these instructor and student classes to store the input data
10. For the instructor class gather the data in the main method and load the data using set/get methods
11. For the student class gather the data in the students constructor
12. For now echo the data back to the user using the console, but do not print any of the capture data from the class, use set/get methods to get the data from the class and print from the main method.
^ Those are the parameters for this project. I missed class last week and thus I'm a little confused. This is what I have for code so far.
Person Class
CODE
import javax.swing.*;
import java.util.*;
public static Person {
private
Scanner scanner = new Scanner(System.in);
String FirstName;
String LastName;
String Age;
int iAge;
void SetName() {
System.out.print("Please tell me your last name:");
String LastName = scanner.next();
System.out.print("Please tell me your first name:");
String Firstname = scanner.next();
System.out.print("Hello, " + FirstName + LastName);
}
}
Main
CODE
System.out.print("Please select from one of the following: \n\n");
System.out.print("\t 1. Add an Instructor \n\n \t 2. Add a Student \n\n \t 3. Exit");
then in my instructor class and student class all I have is
CODE
Public Instructor extends Person
and the same for student.
My question is, where do I go from here? In my main method, it doesn't allow me to create an integer to recognize user input for their selection ( it doesn't like scanner.nextInt(); ) and it doesn't like the import.java.util.*; either...
This post has been edited by circuspeanuts: 18 Oct, 2008 - 07:47 AM