/**
*Charlie Barton
* Finds the graduation date and tells when chapel is
* @v5.3
*/
import java.net.*;
import java.io.*;
import java.util.StringTokenizer;
import java.util.Scanner;
public class StudentStarter
{
// instance variables - replace the example below with your own
public StudentStarter()
{
Scanner sc = new Scanner(System.in);
System.out.println("What year are u graduating");
int grad = sc.nextInt();
// System.out.println ( "Enter your Full name");
// String fullName = sc.nextLine();
//int space1 = fullName.indexOf(" ");
//String fName = fullName.substring
//String fName = fullName.substring(0,1);
//String fullName1 = fullName.substring(space1 + 1);
//String mName = fullName1.substring (0,1);
// index returns 0,
//String fullName2 = mName.substring(space1 + 1);
//int space2 = fullName2.indexOf(" ");
//String lName = fullName2.substring (space2 + 2);
String Chapel = "";
Students stud = new Students(grad);
}
}
public class Students
{
public Students(int grad)
{
if(grad > 2021){
MiddleStudents mid = new MiddleStudents();
}
else{
UpperStudents up = new UpperStudents();
}
}
public Students() {
}
}
public class UpperStudents extends Students
{
public UpperStudents()
{
super();
System.out.println("You are in Upper School:chapel on odd days and noon lunch");
// System.out.println("EA username: " + fName + mName + lName);
}
}
public class MiddleStudents extends Students
{
public MiddleStudents()
{
super();
System.out.println("You are in Middle School: chapel on even day and lunch at 11:00 am");
//System.out.println("EA username: " + fName + mName + lName);
}
}
1 Response
Write a comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.