Finaltestcsc186 (2019275786)
Finaltestcsc186 (2019275786)
2019275786
Question1
int i = 0;
String info = null;
while(info = ss.readLine()) != null){
i++;
}
}
System.out.println("This are the total of student that register subject CTU551 which is about
" + count);
System.out.println();
for(int a=0;a<enrolls.length;a++)
{
if(enrolls[a].getCourse() == "CSC240" && enrolls[a].getProgram() == "CTU551" )
{
pw.println(enrolll[a].getStudentID());
pw.println(enrolll[a].getStudentName());
}
}
za.close();
pp.close();
}
catch(IOException ioe){
System.out.println("THE conflict issue : " + ioe.getMessage());
}
}
QUESTION 2
a)
1)
//superclass
courseRegisteration
//subclass
onlineClass
11)
TypeGraduate
111)
calculateFee because that are the method that already provided by the superclass.
b)
public class onlineClasses extends courseRegistration
{
public String programCode;
if(getStudentType() = 1)
price = 1600 – (1600*0.4);
else
price = 2100 –(2100*0.3);
else if(getProgramCode().equalsIgnoreCase(“ENG”)
if(getStudentType() = 1)
price = 1600 – (1600*0.35);
else
price = 2100 –(2100*0.25);
return price;
C)
Import java.util.Scanner ;
QUESTION 3
a)
public SchoolTeacher( String n , String ic , String sub , int yos,string grade){
super(n,ic,sub,yos);
this.grade = grade; }
return salary ;}
}
11)
public double calcSalary(){
int salary = 0 ;
if(super.getYos()<=2)
salary = 1300+ot*15;
else if(super.getYos()<=5)
salary = 1900+ot*15;
else if(super.getYos()>5)
salary = 2100+ot*15;
return salary;
}
C 1)
Teacher teach [] = new Teacher [20];
11)
for ( int box = 0; box < 20 ;box++){
if(teach[box].getYos()>10);
System.out.print(toString());
}
111)
import java.util.*;
public class onlineClassApp
{
public static void main (String []args)
{
Scan sc = new Scanner (System.in);
onlineClasses[] online = new onlineClass[100];
int i=0;
for (int i=0;i<online_length;i++)
{
System.out.println ("Please enter the Student ID: ");
String id = sc.next();
return fee;
}
online[i].toString();
System.out.println("Total fee that are collected for undergraduate
students from the engineering program
1v)
for(int box = 0 ; box <teach.length ;box++){
if(teach[box] instance of SchoolTeacher){
SchoolTeacher st = (SchoolTeacher)teach[box];
if(st.getGrade().equals("DG44")
System.out.println("The Name: "+st[box].getName());
System.out.println("Their Salary :"+st[box].getSalary());
}//if
}
}
int countxo= 0;
for(int box = 0 ; box <teach.length;box++){
if(teach[box] instance of KindergartenTeacher){
KindergartenTeacher kt = (KindergartenTeacher)teach[box];
countox += kt[box].getox();
}
}
System.out.print("Total overtime hours that are done by the teachers was about "
+ countOT );