Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.text.*;
- import java.util.Scanner;
- public class Runner
- {
- public static void main(String [] args){
- Student s = null;
- Faculty f = new Faculty();
- Scanner sc = new Scanner(System.in);
- System.out.println("Type S for Student or F for faculty: ");
- String in = sc.next();
- sc.nextLine();
- System.out.println("Enter Full Name: ");
- String name = sc.nextLine();
- System.out.println("Enter dob MM-DD-YYYY: ");
- String dob = sc.nextLine();
- if(in.equalsIgnoreCase("s")) {
- System.out.println("Enter Grad Year: ");
- int grad = sc.nextInt();
- //initialize the Student object
- s = new Student(grad, name, dob);
- //update Student class so that
- //createUsername and age methods called from constructor
- // print username and age to the screen
- System.out.println("Your EA username: " + s.createUsername());
- System.out.println("Your age: " + s.getAge() + " years old");
- } else {
- //user the setter methods to set name and DOB
- f.setName(name);
- f.setDOB(dob);
- // call createUsername and getAge from here
- System.out.println("Your EA faculty username: " + f.createUsername());
- System.out.println("Your age: " + f.getAge() + " years old");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement