Hello java members i got a programm to complete and im a lil bit confused.Let me explain you somethings first.I got some classes like UniversityDepartment & PolytechnicDepartment these 2 classes extends *AcademicDepartment* class.And the problem want me to do this.The AcademicDepartment can have pre-graduate program & after-graduate program.And the departments will be 2 University & Polytechnic.For a department to be polytechnic or University depending on the number of labs that have in pre-gruduate program.So if we are in pre-graduate or after-graduate program i think the user must type it from keyboard and if we are in pre-graduate we also must be asked how many labs we got to see if we are in polytechnic or university.So How i will do this?.I will give u an example of my code.
import java.io.*; public class AcademicDepartment { private String names; private String labs; private int teachers; private int graduates; private boolean studies; public void infostudies() throws IOException{ System.out.println("Enter the department you want.Press 1 for pre-graduate program or 2 for after-graduate program" ); boolean studies = ""; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); studies = br.readLine(); if (studies == 1){ System.out.println("You are in pre-graduate program"); System.out.println("Enter the number of labs"); String labs = ""; BufferedReader br1 = new BufferedReader(new InputStreamReader(System.in)); labs = br1.readLine(); if (labs > 5){ System.out.println("The department is polytechnic"); } } if (studies < 5 ){ System.out.println("The department is University"); } else { System.out.println("Wrong number try again"); } } public AcademicDepartment(String names,String labs,int teachers,int graduates){ names = new String(names); this.labs = labs; this.teachers = teachers; this.graduates = graduates; } public void printdepartmentinfo(){ System.out.println("The names are:" + names); System.out.println("The labs are:" + labs); System.out.println("The GRADUATES are:" + graduates); System.out.println("The teachers are:" + teachers); } }