Question

Rewrite following code down below using Factory Pattern. -------------------------Staff.java--------------------------- import java.util.*; public class Staff extends Employee...

Rewrite following code down below using Factory Pattern.

-------------------------Staff.java---------------------------

import java.util.*;

public class Staff extends Employee {

   private int HourlyRate;

   /**Constructor Staff which initiates the values*/

   public Staff() {

   super();

   HourlyRate=0;

   }

   /**Overloaded constructor method

   * @param ln last name

   * @param fn first name

   * @param ID Employee ID

   * @param sex Sex

   * @param hireDate Hired Date

   * @param hourlyRate Hourly rate for the work

   */

   public Staff(String ln, String fn, String ID, String sex, GregorianCalendar birthDate, int hourlyRate) {

   super(ln,fn,ID,sex,birthDate);

   HourlyRate=hourlyRate;

   }

   /** Methods which returns monthly earning of the staff*/

   public double monthlyEarnings() {

   return HourlyRate*STAFF_MONTHLY_HOURS_WORKED;

   }

   /** Returns hourly rate

   * @return hourly rate

   */

   public int hourlyrate() {

   return HourlyRate;

   }

   /** Replaces the hourly rate with new value

   * @param hourly rate

   */

   public void setHourlyRate(int hr) {

   HourlyRate=hr;

   }

   /** Returns string of the different Staff details */

   public String toString() {

   if(this instanceof Partime) {

   return super.toString();

   }

   else

   return super.toString()+"\nHourly rate: $"+hourlyrate();

}

}

----------------------TestDriver.java----------------------

import java.util.*;

public class TestDriver {

static double parttimetotal=0;

static double totalsalary=0;

static Employee employee[]=new Employee[9];

/** Main method which throws CloneNotSupportedException

* @param args

* @throws CloneNotSupportedException

*/

public static void main(String [] args)throws CloneNotSupportedException {

employee[0]=new Staff("Allen","Paita","123","M",new GregorianCalendar(59, 2,23),50);

employee[1]=new Staff("Zapata","Steven","456","F",new GregorianCalendar(64, 7, 12),35);

employee[2]=new Staff("Rios","Enrique","789","M",new GregorianCalendar(70, 6, 2),40);

employee[3]=new Faculty("Johnson", "Anne", "243", "F", new GregorianCalendar(62, 4, 27), Faculty.Level.FU,"Ph.D","Engineering",3);

employee[4]=new Faculty("Bouris","Willian","791","F",new GregorianCalendar(75, 3, 14),Faculty.Level.AO,"Ph.D","English",1);

employee[5]=new Faculty("Andrade","Christopher","623","F",new GregorianCalendar(80, 5, 22),Faculty.Level.AS,"MS","Physical Education",0);

employee[6]=new Partime("Guzman", "Augusto", "455", "F", new GregorianCalendar(77, 8, 10),35, 30);

employee[7]=new Partime("Depirro", "Martin", "678", "F", new GregorianCalendar(87, 9, 15), 30, 15);

employee[8]=new Partime("Aldaco", "Marque", "945", "M", new GregorianCalendar(88, 11, 24), 20, 35);

System.out.println("Staff:");

for(int i=0;i<3;i++) {

System.out.println(employee[i].toString());

}

System.out.println("\nFaculty:");

for(int i=3;i<6;i++) {

System.out.println(employee[i].toString());

}

System.out.println("\nPart-Time:");

for(int i=6;i<9;i++) {

System.out.println(employee[i].toString());

}

parttimetotal=totalPartTimeSal();

totalsalary=totalsal();

System.out.println("---------------------------------------------------------");

System.out.println(" The total monthly salary for all the Part-Time staff: $"+parttimetotal);

System.out.println("---------------------------------------------------------");

System.out.println(" The total monthly salary for all employees: $"+totalsalary);

System.out.println("---------------------------------------------------------");

System.out.println("Sort by ID number:");

Arrays.sort(employee,new Comparer());

int j=0;

while(j<9) {

Employee obj=(Employee)employee[j++];

System.out.println(obj.toString());

}

System.out.println("---------------------------------------------------------");

System.out.println("Sort by Last Name:");

Arrays.sort(employee);

int i=0;

while(i<9) {

Employee obj=(Employee)employee[i++];

System.out.println(obj.toString());

}

System.out.println("---------------------------------------------------------");

System.out.println("Duplicate a faculty object using clone:");

Faculty fac=new Faculty("Bouris","Willian","791","F",new GregorianCalendar(75, 3, 14),Faculty.Level.AO,"Ph.D","English",1);

Faculty fac1=(Faculty)fac.clone();

System.out.println(fac.toString()+"\nCloned Information:"+fac1.toString()+"Verified Duplication \n"+" \nOriginal Information:"+fac.toString()+"Cloned Information");

fac1.setfn("Ashish");

fac1.setln("Gare");

fac1.setbirthDate(new GregorianCalendar(1998,4,20));

fac1.setID("420");

fac1.setLevel(Faculty.Level.FU);

System.out.println(fac1.toString());

}

/** Returns the total part time salary

* @return total part time salary

*/

public static double totalPartTimeSal() {

for(int i=6;i<9;i++) {

parttimetotal+=employee[i].monthlyEarnings();

}

return parttimetotal;

}

/** Returns total salary of the employees

* @return total employees salary

*/

public static double totalsal() {

for(int i=0;i<9;i++) {

totalsalary+=employee[i].monthlyEarnings();

}

return totalsalary;

}

}

-------------Comparer.java--------------

import java.util.*;

public class Comparer implements Comparator<Employee>{

   /** Comparing two employees Id of Employee objects */

   public int compare(Employee o1, Employee o2) {

   return o1.ID().compareTo(o2.ID());

}

}

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Please let me know if you have any doubts or you want me to modify the answer. And if you find this answer useful then don't forget to rate my answer as thumps up. Thank you! :)

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.Arrays;
import java.util.Scanner;

public class Driver {

    public static void main(String[] args) throws FileNotFoundException, CloneNotSupportedException {
        Scanner inputStaff = new Scanner(new FileReader("/Users/swapnil/IdeaProjects/EmployeeFactoryPattern/src/Staff.txt"));
        Scanner inputFaculty = new Scanner(new FileReader("/Users/swapnil/IdeaProjects/EmployeeFactoryPattern/src/Faculty.txt"));
        Scanner inputPartime = new Scanner(new FileReader("/Users/swapnil/IdeaProjects/EmployeeFactoryPattern/src/Partime.txt"));

        EmployeeFactoryPattern factory = new EmployeeFactoryPattern();
        Employee[] employees = new Employee[9];
        employees[0] = factory.createEmployee(EmployeeFactoryPattern.Type.STAFF);
        employees[1] = factory.createEmployee(EmployeeFactoryPattern.Type.STAFF);
        employees[2] = factory.createEmployee(EmployeeFactoryPattern.Type.STAFF);
        employees[3] = factory.createEmployee(EmployeeFactoryPattern.Type.FACULTY);
        employees[4] = factory.createEmployee(EmployeeFactoryPattern.Type.FACULTY);
        employees[5] = factory.createEmployee(EmployeeFactoryPattern.Type.FACULTY);
        employees[6] = factory.createEmployee(EmployeeFactoryPattern.Type.PARTIME);
        employees[7] = factory.createEmployee(EmployeeFactoryPattern.Type.PARTIME);
        employees[8] = factory.createEmployee(EmployeeFactoryPattern.Type.PARTIME);

        for (Employee e : employees) {
            String type = e.getClass().getSimpleName();
            if (type.equalsIgnoreCase("Staff")) e.inputEmployee(inputStaff);
            else if (type.equalsIgnoreCase("Faculty")) e.inputEmployee(inputFaculty);
            else if (type.equalsIgnoreCase("Partime")) e.inputEmployee(inputPartime);
        }

        inputStaff.close();
        inputFaculty.close();
        inputPartime.close();

         System.out.println("Display all employee information");
        display(employees);

        System.out.println("\n" + "-----------------------------------------------------------------------------");


        double totalMonthlySalaryPartTime = 0.0;
        for (Employee e : employees) {
            if (e.getClass().getSimpleName().equalsIgnoreCase("Partime")) {
                totalMonthlySalaryPartTime = totalMonthlySalaryPartTime + e.monthlyEarning();
            }
        }
        System.out.println("Total monthly salary for all the part-time staff: $" + totalMonthlySalaryPartTime + "\n");

        System.out.println("-----------------------------------------------------------------------------");


        double totalMonthlySalary = 0.0;
        for (Employee e : employees) {
            totalMonthlySalary = totalMonthlySalary + e.monthlyEarning();
        }
        System.out.println("Total monthly salary for all employees: $" + totalMonthlySalary + "\n");

        System.out.println("-----------------------------------------------------------------------------");


        System.out.println("Display all employee information descending by employee id using interface Comparable");
        Arrays.sort(employees);
        display(employees);

        System.out.println("-----------------------------------------------------------------------------");


        System.out.println("Display all employee information ascending by last name using interface Comparator");
        Arrays.sort(employees, new NameComparator());
        display(employees);

        System.out.println("-----------------------------------------------------------------------------");


        System.out.println("Duplicate a faculty object using clone");
        System.out.println("The Faculty to be duplicated: ");
        System.out.println(employees[3].toString());
        System.out.println("\n" + "The duplicated Faculty: ");
        Faculty copyFaculty = (Faculty) employees[3].clone();
        System.out.println(copyFaculty.toString());
    }

    public static void display(Employee[] array) {
        String employeeClass = array[0].getClass().getSimpleName();
        System.out.println(employeeClass);
        for (Employee e : array) {
            if (!employeeClass.equals(e.getClass().getSimpleName())) {
                employeeClass = e.getClass().getSimpleName();
                System.out.println(employeeClass);
                System.out.println("----------------------------------");
            }
            System.out.println(e.toString());
            System.out.println();
        }
    }
}
-------------------------------------------------------------------------------------------------------------------------------------------
import java.util.Scanner;

public class Education implements Cloneable{

    public Education()
    {
        degree = major = "";
        numResearch = 0;
    }
    public Education(String degree, String major, int numResearch)
    {
        this.degree = degree;
        this.major = major;
        this.numResearch = numResearch;
    }
    public Education(Education edu)
    {
        degree = edu.getDegree();
        major = edu.getMajor();
        numResearch = edu.getNumResearch();
    }

    public String getDegree()
    {
        return degree;
    }

    public String getMajor()
    {
        return major;
    }

    public int getNumResearch()
    {
        return numResearch;
    }

    public void setDegree(String d)
    {
        degree = d;
    }

    public void setMajor(String m)
    {
        major = m;
    }

    public void setNumResearch(int nr)
    {
        numResearch = nr;
    }

    public void inputEducation(Scanner input)
    {
        degree = input.next();
        major = input.nextLine();
        input.nextLine();
        numResearch = input.nextInt();
    }

    public Object clone() throws CloneNotSupportedException
    {
        return super.clone();
    }

    private String degree;
    private String major;
    private int numResearch;
}
-------------------------------------------------------------------------------------------------------------------------------------------
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Scanner;


abstract class Employee implements EmployeeInfo, Comparable, Cloneable {

    public Employee()
    {
        lastName = firstName = idNum = "";
        sex = '\u0000';
        birthDate = new GregorianCalendar();
    }

    public Employee(String lastName, String firstName, String idNum, char sex, Calendar birthDate)
    {
        this.lastName = lastName;
        this.firstName = firstName;
        this.idNum = idNum;
        this.sex = sex;
        this.birthDate = birthDate;
    }

    public String getLastName()
    {
        return lastName;
    }

    public String getFirstName()
    {
        return firstName;
    }

    public String getIDNum()
    {
        return idNum;
    }

    public char getSex()
    {
        return sex;
    }

    public Calendar getBirthDate()
    {
        return birthDate;
    }

    public void setLastName(String ln)
    {
        lastName = ln;
    }

    public void setFirstName(String fn)
    {
        firstName = fn;
    }

    public void setIDNum(String id)
    {
        idNum = id;
    }

    public void setSex(char s)
    {
        sex = s;
    }

    public void setBirthDate(Calendar bd)
    {
        birthDate = bd;
    }

    public String toString()
    {
        return    "\t" + "ID Employee number: " + idNum + "\n" +
                "\t" + "Employee name: " + firstName + " " + lastName + "\n" +
                "\t" + "Birth date: " + birthDate.get(Calendar.MONTH) + "/" + birthDate.get(Calendar.DAY_OF_MONTH) + "/" + birthDate.get(Calendar.YEAR);
    }

    public int compareTo(Object otherEmployee)
    {
        return -idNum.compareTo(((Employee)otherEmployee).idNum);
    }

    public Object clone() throws CloneNotSupportedException
    {
        return super.clone();
    }

    abstract public double monthlyEarning();

    public void inputEmployee(Scanner input)
    {
        lastName = input.next();
        firstName = input.next();
        idNum = input.next();
        sex = input.next().toUpperCase().charAt(0);
        String bDay = input.next();
        birthDate = new GregorianCalendar(Integer.parseInt(bDay.substring(bDay.lastIndexOf("/")+1)), Integer.parseInt(bDay.substring(0, bDay.indexOf("/"))), Integer.parseInt(bDay.substring(bDay.indexOf("/")+1, bDay.lastIndexOf("/"))));
    }

    private String lastName;
    private String firstName;
    private String idNum;
    private char sex;
    private Calendar birthDate;
}


-------------------------------------------------------------------------------------------------------------------------------------------
public class EmployeeFactoryPattern implements Factory{
    public Employee createEmployee(Type type)
    {
        Employee e = null;
        switch(type)
        {
            case FACULTY:
                e = new Faculty();
                break;
            case STAFF:
                e = new Staff();
                break;
            case PARTIME:
                e = new Partime();
                break;
        }
        return e;
    }
}


-------------------------------------------------------------------------------------------------------------------------------------------
public interface EmployeeInfo {

    double FACULTY_MONTHLY_SALARY = 6000.00;
    int STAFF_MONTHLY_HOURS_WORKED = 160;

}


-------------------------------------------------------------------------------------------------------------------------------------------
public interface Factory {
    public enum Type{FACULTY, STAFF, PARTIME};
    Employee createEmployee(Type type);
}


-------------------------------------------------------------------------------------------------------------------------------------------
import java.util.Calendar;
import java.util.Scanner;


public class Faculty extends Employee implements Cloneable{

    public Faculty()
    {
        super();
        education = new Education();
    }

    public Faculty(String lastName, String firstName, String idNum, char sex, Calendar birthDate, Level level, Education education)
    {
        super(lastName, firstName, idNum, sex, birthDate);
        this.level = level;
        this.education = new Education(education);
    }
    public Level getLevel()
    {
        return level;
    }
    public Education getEducation()
    {
        return education;
    }

    public void setLevel(Level l)
    {
        level = l;
    }

    public void setEducation(Education edu)
    {
        education = edu;
    }

    public double monthlyEarning()
    {
        switch(level)
        {
            case AS:   return FACULTY_MONTHLY_SALARY;
            case AO:   return 1.5 * FACULTY_MONTHLY_SALARY;
            case FU:   return 2.0 * FACULTY_MONTHLY_SALARY;
        }
        return 0.0;
    }

    public void inputEmployee(Scanner input)
    {
        super.inputEmployee(input);
        level = Level.valueOf(input.next().toUpperCase());
        education.inputEducation(input);
    }

    public String toString()
    {
        return super.toString() +
                "\n" + "\t" + level.getStrLevel() +
                "\n" + "\t" + "Monthly Salary: $" + Double.toString(monthlyEarning());
    }


    public Object clone() throws CloneNotSupportedException
    {
        Faculty copyFaculty = (Faculty) super.clone();
        education = (Education) education.clone();
        copyFaculty.setEducation(education);
        return copyFaculty;
    }


    public enum Level
    {
        AS("Assistant Professor"), AO("Associate Professor"), FU("Full Professor");

        private String typeProfessor;

        private Level(String str)
        {
            typeProfessor = str;
        }

        private String getStrLevel()
        {
            return typeProfessor;
        }
    }

    private Level level;
    private Education education;
}
-------------------------------------------------------------------------------------------------------------------------------------------
import java.util.Comparator;
public class NameComparator implements Comparator{
    public int compare(Object o1, Object o2)
    {
        Employee e1 = (Employee)o1;
        Employee e2 = (Employee)o2;

        return e1.getLastName().compareTo(e2.getLastName());
    }
}


-------------------------------------------------------------------------------------------------------------------------------------------
import java.util.Calendar;
import java.util.Scanner;


public class Partime extends Staff{

    public Partime()
    {
        super();
        hoursWorkedPW = 0;
    }
    public Partime(String lastName, String firstName, String idNum, char sex, Calendar birthDate, double hourlyRate, int hoursWorkedPW)
    {
        super(lastName, firstName, idNum, sex, birthDate, hourlyRate);
        this.hoursWorkedPW = hoursWorkedPW;
    }

    public int getHoursWorkedPW()
    {
        return hoursWorkedPW;
    }

    public void setHoursWorkedPW(int hours)
    {
        hoursWorkedPW = hours;
    }

    public double monthlyEarning()
    {
        return super.getHourlyRate() * hoursWorkedPW * 4;
    }

    public void inputEmployee(Scanner input)
    {
        super.inputEmployee(input);
        hoursWorkedPW = input.nextInt();
    }

    public String toString()
    {
        return "\t" + "ID Employee number: " + getIDNum() + "\n" +
                "\t" + "Employee name: " + getFirstName() + " " + getLastName() + "\n" +
                "\t" + "Birth date: " + getBirthDate().get(Calendar.MONTH) + "/" + getBirthDate().get(Calendar.DAY_OF_MONTH) + "/" + getBirthDate().get(Calendar.YEAR) + "\n" +
                "\t" + "Hours works per month: " + hoursWorkedPW * 4 + "\n" +
                "\t" + "Monthly Salary: $" + Double.toString(monthlyEarning());
    }

    private int hoursWorkedPW;
}
-------------------------------------------------------------------------------------------------------------------------------------------
import java.util.Calendar;
import java.util.Scanner;


public class Staff extends Employee{

    public Staff()
    {
        super();
        hourlyRate = 0.0;
    }
    public Staff(String lastName, String firstName, String idNum, char sex, Calendar birthDate, double hourlyRate)
    {
        super(lastName, firstName, idNum, sex, birthDate);
        this.hourlyRate = hourlyRate;
    }
    public double getHourlyRate()
    {
        return hourlyRate;
    }

    public void setHourlyRate(double hr)
    {
        hourlyRate = hr;
    }

    public double monthlyEarning()
    {
        return hourlyRate * STAFF_MONTHLY_HOURS_WORKED;
    }

    public void inputEmployee(Scanner input)
    {
        super.inputEmployee(input);
        hourlyRate = input.nextDouble();
    }

    public String toString()
    {
        return super.toString() + "\n" +
                "\t" + "Full Time" + "\n" +
                "\t" + "Monthly Salary: $" + Double.toString(monthlyEarning());
    }

    private double hourlyRate;
}

Add a comment
Know the answer?
Add Answer to:
Rewrite following code down below using Factory Pattern. -------------------------Staff.java--------------------------- import java.util.*; public class Staff extends Employee...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • departmentstore: package departmentstorepkg; import java.util.ArrayList; public class DepartmentStore {    private static final int DEFAULT_SIZE =...

    departmentstore: package departmentstorepkg; import java.util.ArrayList; public class DepartmentStore {    private static final int DEFAULT_SIZE = 10; private StaffMember [] myEmployees; private int myNumberEmployees; private String myFileName; private StaffMember[] employee; public DepartmentStore (String filename){ myFileName = filename; myEmployees = employee;    } public String toString(){ return this.getClass().toString() + ": " + myFileName; } public void addEmployee(Employee emp){ } /** * prints out all the employees in the array list held in this class */ public void print(){ for(int i =...

  • In the processLineOfData method, write the code to handle case "H" of the switch statement such...

    In the processLineOfData method, write the code to handle case "H" of the switch statement such that: • An HourlyEmployee object is created using the firstName, lastName, rate, and hours local variables. Notice that rate and hours need to be converted from String to double. You may use parseDouble method of the Double class as follows: Double.parseDouble(rate) Call the parsePaychecks method in this class passing the Hourly Employee object created in the previous step and the checks variable. Call the...

  • Cant figure out how to fix error Code- import java.io.File; import java.io.IOException; import java.util.*; public class Program8 {    public static void main(String[] args)throws IOException{       ...

    Cant figure out how to fix error Code- import java.io.File; import java.io.IOException; import java.util.*; public class Program8 {    public static void main(String[] args)throws IOException{        File prg8 = new File("program8.txt");        Scanner reader = new Scanner(prg8);        String cName = "";        int cID = 0;        double bill = 0.0;        String email = "";        double nExempt = 0.0;        String tExempt = "";        int x = 0;        int j = 1;        while(reader.hasNextInt()) {            x = reader.nextInt();}        Customers c1 [] = new Customers [x];        for (int...

  • 0.Use Factory Design Method 1. Implement an interface called EmployeeInfo with the following constant variables: FACULTY_MONTHLY_SALARY...

    0.Use Factory Design Method 1. Implement an interface called EmployeeInfo with the following constant variables: FACULTY_MONTHLY_SALARY = 6000.00 STAFF_MONTHLY_HOURS_WORKED = 160 2. Implement an abstract class Employee with the following requirements: Attributes last name (String) first name (String) ID number (String) Sex - M or F Birth date - Use the Calendar Java class to create a date object Default argument constructor and argument constructors. Public methods toString - returning a string with the following format: ID Employee number :_________...

  • Must be written in java. Modularize the following code. //CIS 183 Lab 4 //Joseph Yousef import...

    Must be written in java. Modularize the following code. //CIS 183 Lab 4 //Joseph Yousef import java.util.*; public class SalaryCalc { public static void main(String [] args) { Scanner input = new Scanner(System.in); int sentinelValue = 1; //initializes sentinelValue value to 1 to be used in while loop while (sentinelValue == 1) { System.out.println("Enter 1 to enter employee, or enter 2 to end process: ");    sentinelValue = input.nextInt(); input.nextLine(); System.out.println("enter employee name: "); String employeeName = input.nextLine(); System.out.println("enter day...

  • P1 is below package p6_linkedList; import java.util.*; public class LinkedList { public Node header; public LinkedList()...

    P1 is below package p6_linkedList; import java.util.*; public class LinkedList { public Node header; public LinkedList() { header = null; } public final Node Search(int key) { Node current = header; while (current != null && current.item != key) { current = current.link; } return current; } public final void Append(int newItem) { Node newNode = new Node(newItem); newNode.link = header; header = newNode; } public final Node Remove() { Node x = header; if (header != null) { header...

  • In the Employee class, add an implementation for the calculatePension() method declared in the interface. Calculate...

    In the Employee class, add an implementation for the calculatePension() method declared in the interface. Calculate the pension to date as the equivalent of a monthly salary for every year in service. 4) Print the calculated pension for all employees. ************** I added the interface and I implemented the interface with Employee class but, I don't know how can i call the method in main class ************ import java.io.*; public class ManagerTest { public static void main(String[] args) { InputStreamReader...

  • In the processLineOfData, write the code to handle case "H" of the switch statement such that:...

    In the processLineOfData, write the code to handle case "H" of the switch statement such that: An HourlyEmployee object is created using the firstName, lastName, rate, and hours local variables. Notice that rate and hours need to be converted from String to double. You may use parseDouble method of the Double class as follows:               Double.parseDouble(rate) Call the parsePaychecks method in this class passing the HourlyEmployee object created in the previous step and the checks variable. Call the findDepartment method...

  • Priority Queue Demo import java.util.*; public class PriorityQueueDemo {    public static void main(String[] args) {...

    Priority Queue Demo import java.util.*; public class PriorityQueueDemo {    public static void main(String[] args) {        //TODO 1: Create a priority queue of Strings and assign it to variable queue1               //TODO 2: Add Oklahoma, Indiana, Georgia, Texas to queue1                      System.out.println("Priority queue using Comparable:");        //TODO 3: remove from queue1 all the strings one by one        // with the "smaller" strings (higher priority) ahead of "bigger"...

  • Provide comments for this code explaining what each line of code does import java.util.*; public class...

    Provide comments for this code explaining what each line of code does import java.util.*; public class Chpt8_Project {    public static void main(String[] args)       {        Scanner sc=new Scanner(System.in);        int [][]courses=new int [10][2];        for(int i=0;i<10;i++)        {            while(true)            {                System.out.print("Enter classes and graduation year for student "+(i+1)+":");                courses[i][0]=sc.nextInt();                courses[i][1]=sc.nextInt();                if(courses[i][0]>=1...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT