//////Student Starter
/**
* Ths code finds out when you have chapel/lunch :)
*
* @Charlie
* @Alpha 3.7
*/
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 do you grad");
int grad = sc.nextInt();
String Chapel = "";
Students stud = new Students(grad);
}
}
////Students
public class Students
{
public Students(int grad)
{
if(grad > 2021){
MiddleStudents mid = new MiddleStudents();
}
else{
UpperStudents up = new UpperStudents();
}
}
public Students() {
}
}
////Middle Year
public class MiddleStudents
{
public MiddleStudents()
{
super();
System.out.println("You have chapel on even day and lunch at noon");
}
}
///Upper School
public class UpperStudents extends Students
{
public UpperStudents()
{
super();
System.out.println("You have chapel on odd days and lunch at 11:00 am");
}
}
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.