import java.util.*;
public class EaStarter
{
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Enter your graduation year: ");
int gradYear = scan.nextInt();
Student stud = new Student(gradYear);
}
}
public class Student
{
public int gradYear;
public Student() {
}
public Student(int input) {
gradYear = input;
if (gradYear > 2021) {
Middle mid = new Middle();
mid.printChapel();
mid.printLunch();
} else {
Upper up = new Upper();
up.printChapel();
up.printLunch();
}
}
public void printChapel() {
}
public void printLunch(int num) {
if (num == 1)
System.out.println("You go to lunch in the Tierny Dinning Hall.");
}
}
public class Middle extends Student
{
public Middle()
{
super();
}
public void printLunch() {
super.printLunch(1);
System.out.println("You go to lunch during first block.");
}
public void printChapel()
{
System.out.println("You go to Chapel on even days.");
}
}
public class Upper extends Student
{
public Upper()
{
super();
}
public void printLunch() {
System.out.println("You go to lunch during second block.");
}
public void printChapel()
{
System.out.println("You go to Chapel on odd days.");
}
}
Be the first to 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.