?
Solved

How do I display weekly shift data?

Posted on 2011-10-10
12
Medium Priority
?
369 Views
Last Modified: 2012-05-12
For each shift display the following information: day, shift (i.e., day or night), names and position of employees who worked during that shift (i.e., production worker or shift supervisor), and whether the production goals were met during this shift.

Sorry for all the code, this is a huge project.

TestAll class:

import java.util.ArrayList;
import java.util.Random;
/**
 * Write a description of class TestAll here.
 *
 * @author (your name)
 * @version (a version number or a date)
 */
public class TestAll
{

    protected Random generator;
    protected ArrayList<Employee> employees;
    protected boolean metProductionGoals;
    public enum WeekDay {Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday};
    protected static String[] names = {"Ryan","Jones","Brown","Peter","Emma","Jennifer","Courtney",
    "Ross","Joe","Chandler","Ruth","Stewart","Monica","Rachel","Stewie","Chris","Meg","Louis",
    "Cleveland","Quagmire"};
    protected ArrayList<ProductionWorker> pw;
    protected ArrayList<ShiftSuperVisor> sv;
    protected ArrayList<Manager> m;
   
    /**
     * Constructor for objects of class TestAll
     */
    public TestAll()
    {
       
        pw = new ArrayList<ProductionWorker>();
        sv = new ArrayList<ShiftSuperVisor>();
        m = new ArrayList<Manager>();
       
        for(int i = 1; i <=10; i++)
        {
            pw.add(ProductionWorker.getProductionWorker());
            pw.add(Shift.getProductionGoals());
            pw.add(Shift.shiftDay());
            pw.add(Shift.getDay());
        }
        System.out.println("Production Worker " + pw);
   
        for(int j = 1; j <= 10; j++)
        {
            sv.add(ShiftSuperVisor.getShiftSuperVisor());
            sv.add(Shift.getProductionGoals());
            sv.add(Shift.shiftDay());
            sv.add(Shift.getDay());
        }
        System.out.println("Shift Super Visor " + sv);
       
        for(int k = 1; k <= 10; k++)
        {
            m.add(Manager.getManager());
            m.add(Shift.getProductionGoals());
            m.add(Shift.shiftDay());
            m.add(Shift.getDay());
        }
        System.out.println("Manager " + m);
       
    }    
   
   
}

Employee class:

import java.util.Random;
import java.text.DecimalFormat;
import java.text.NumberFormat;

public class Employee
{
    protected String eName;
    protected String eNumber;
    protected int hireYear;
    protected double weeklySalary;
    static Random generator = new Random();
    static NumberFormat strFormat = new DecimalFormat("#####.00");;

   
    public Employee(String eName, String eNumber, int hireYear, double weeklySalary)
    {
       
        this.eName = eName;
        if(validateENumber(eNumber))
        {
           this.eNumber = eNumber;
        }
        else
        {
            employeeNumber();
        }
           
       
        this.hireYear = hireYear;
       
        this.weeklySalary = weeklySalary;
       
    }
   
   
   
   public boolean validateENumber(String eNumber)
    {
        boolean validate = true;
        if(eNumber.length() < 5)
        validate = false;
        else{
        for (int i = 0; i < 3; i++)
        {
           if(!Character.isDigit(eNumber.charAt(i)))
           {
               validate = false;
            }
        }
        if (!(eNumber.charAt(3) == '-'))
            validate = false;
           
        if (!((eNumber.charAt(4) >= 65) && (eNumber.charAt(4) <=77)))
            validate = false;
           
       
    }
    return validate;
}
   
    public int getHireYear()
        {
            return hireYear;
        }
       
    public double getWeeklySalary()
        {
            return weeklySalary;
        }
       
    public void setName(String name)
        {
            eName = name;
        }
       
    public void setHireYear(int year)
        {
            hireYear = year;
        }
       
    public void setWeeeklyPay(int salary)
        {
            weeklySalary = salary;
        }
       
    public String getName()
    {
        return eName;
    }
     public String toString()
    {
        return ("\n\nName: \t" + eName + "\n   ID:     \t" + eNumber + "\n   Year Hired:\t" + hireYear +
                "\n   WeeklySalary:\t$" + strFormat.format(getWeeklySalary()));

    }
   
    public String getNumber()
    {
        return eNumber;
    }
 
   public static String employeeNumber()
    {
        int  eNumber = generator.nextInt(10)* 100 + generator.nextInt(10)* 10 + generator.nextInt(10);
        String enumS = "" + eNumber;
        while(enumS.length() < 3)
        enumS = "0" + enumS;
        String let = "" + ("ABCDEFGHIJKLM").charAt(generator.nextInt(13));
        return enumS + "-" + let;
    }

    public boolean equals(Employee other)
    {
       
       if ((eName.equals(other.getName())) && (eNumber.equals(other.getNumber())) && (hireYear == other.getHireYear()) && (weeklySalary == other.getWeeklySalary()))
            return true;
       else
            return false;

    }
   
   public double getSalary()
    {
        return weeklySalary;
    }
}

ShiftSuperVisor class:

import java.util.*;
public class ShiftSuperVisor extends Employee implements SalariedEmployee
{
    // instance variables - replace the example below with your own
    protected double yearlySalary;
    protected static double weeklySalary;
    protected Random generator;
    protected static String[] names = {"Katarina", "Amelia", "William", "Hope", "Isaac", "Hollis", "Claire", "Austin", "Noah"};
    protected int goal;
    protected static final double minYearlySalary = 40000;
    protected static final double maxYearlySalary = 80000;
    protected static final double maxWeeklySalary = 10000;
        //constructor that calls variables from Class Employee to create object ProductionWorker
    public ShiftSuperVisor(String eName,String eNumber,int hireYear, double weeklySalary)
    {
        super(eName,eNumber,hireYear,weeklySalary);
        if(super.validateENumber(eNumber))
        {

            this.eNumber = eNumber;
        }
            else
               this.eNumber =  employeeNumber();
        this.weeklySalary = weeklySalary;
    }
    /**
     * Constructor for objects of class ShiftSuperVisor
     */
    public ShiftSuperVisor(String eName,String eNumber,int hireYear,double weeklySalary, double yearlySalary, int goals)
    {
        super(eName,eNumber,hireYear,weeklySalary);
        if(super.validateENumber(eNumber))
        {
           
            this.eNumber = eNumber;
        }
            else
                this.eNumber = employeeNumber();
        this.yearlySalary = yearlySalary;
        this.goal = goals;
    }

    public double getYearlySalary()
        {
            return yearlySalary;
        }

    public void setYearlySalary(double salary)
        {
            this.yearlySalary = salary;
        }
       
    public void setGoal(int goal)
    {
        this.goal = goal;
    }
   
    public int getGoal()
    {
        return goal;
    }
   
    public String toString()
    {
        return (super.toString()+"\n YearlySalary:\t$" + strFormat.format(yearlySalary) + "\nGoals:\t" + goal);

        }

     /**
     * Equals method
     */
    public boolean equals(ShiftSuperVisor visor)
    {
        if(goal == visor.getGoal())
        if(yearlySalary == visor.getYearlySalary())
        return true;
       
        return false;
       
    }
   
    public double getSalary()
    {
        return yearlySalary;
    }
   
    public static ShiftSuperVisor getShiftSuperVisor()
    {
    Random generator = new Random();
    String name = names[generator.nextInt(names.length)];
   
    String eNumber = Employee.employeeNumber();
    int yearHired = 2011-generator.nextInt(35);
   
    double yearlySalary = minYearlySalary + generator.nextDouble()*(maxYearlySalary-minYearlySalary);
    double weeklySalary = maxWeeklySalary - generator.nextDouble()*(maxWeeklySalary);
    int goals = generator.nextInt(35) + 1;
   
    ShiftSuperVisor pw = new ShiftSuperVisor(name, eNumber, yearHired, weeklySalary, yearlySalary, goals);
    return pw;    
    }
   
    public static double computeWeeklySalary()
    {
    Random generator = new Random();
    double beforeTax =  generator.nextInt(10000);
    double afterTax = beforeTax - (beforeTax *.3);
    return afterTax;
    }
}


ProductionWorker class:

import java.util.*;
import java.text.DecimalFormat;
import java.text.NumberFormat;
public class ProductionWorker extends Employee
{
    //value of how much a production worker makes hourly
    protected double hourlySalary;
   
    protected static Random generator = new Random();;
    protected static String[] names = {"Ryan","Jones","Brown","Peter","Emma","Jennifer","Courtney", "Ross","Joe","Chandler","Ruth","Stewart","Monica","Rachel","Stewie","Chris","Meg","Louis",
    "Cleveland","Quagmire"};
    protected static final double minHourlySalary = 6.00;
    protected static final double maxHourlySalary = 50.00;
    protected static final double maxWeeklySalary = 10000;
    static  NumberFormat strFormat = new DecimalFormat("#####.00");;
   
    //constructor that calls variables from Class Employee to create object ProductionWorker
    public ProductionWorker(String eName,String eNumber,int hireYear, double weeklySalary)
    {
        super(eName,eNumber,hireYear,weeklySalary);
        if(super.validateENumber(eNumber))
        {

            this.eNumber = eNumber;
        }
            else
               this.eNumber =  employeeNumber();
        this.weeklySalary = weeklySalary;
    }

     public ProductionWorker(String eName,String eNumber,int hireYear, double weeklySalary, double _hourlySalary)
    {
        super(eName, eNumber, hireYear, weeklySalary);
        this.hourlySalary = _hourlySalary;

    }

    public double getHourlySalary()
        {
            return hourlySalary;
        }

    public void setHourlySalary(double salary)
        {
            this.hourlySalary = salary;
        }


    public String toString()
    {
        return super.toString() + "\n Hourly Salary:\t$" + strFormat.format(hourlySalary);

    }

     /**
     * Equals method
     */
    public boolean equals(ProductionWorker worker)
    {
        if(hourlySalary == worker.getHourlySalary())
            return true;

        return false;
    }

    public double getSalary()
    {
        return hourlySalary;
    }
   
    public static ProductionWorker getProductionWorker()
    {
       
        String name = names[generator.nextInt(names.length)];
       
        String eNumber = Employee.employeeNumber();
        int yearHired = 2011-generator.nextInt(35);
       
        double hourlySalary = minHourlySalary + generator.nextDouble()*(maxHourlySalary-minHourlySalary);
        double weeklySalary = maxWeeklySalary - generator.nextDouble()*(maxWeeklySalary);
       
        return new ProductionWorker(name, eNumber, yearHired, weeklySalary, hourlySalary);
     }
}

SalariedEmployee interface:

public interface SalariedEmployee
{

    public double getYearlySalary();

    public double getWeeklySalary();

}

Manager class:

import java.util.*;
public class Manager extends Employee implements SalariedEmployee
{
    protected double yearlySalary;
    protected Department department;
    protected Random generator = new Random();
    protected static String[] names = {"Caitlyn", "Laine", "Liam", "Sophia", "Charlotte", "Jackson", "Ethan", "Mason"};
    protected static final double minYearlySalary = 60000;
    protected static final double maxYearlySalary = 120000;
    public enum Department{PayRoll, Production, Accounting, Research, Marketing};
   
    public Manager(String eName,String eNumber,int hireYear, double weeklySalary)
    {
        super(eName,eNumber,hireYear,weeklySalary);
        if(super.validateENumber(eNumber))
        {
            this.eNumber = eNumber;
        }
            else
               this.eNumber =  employeeNumber();
        this.weeklySalary = weeklySalary;
    }
   
    /**
     * Constructor for objects of class Manager
     */
    public Manager(String eName,String eNumber,int hireYear, double weeklySalary, double _yearlySalary, Department _department )
    {
        super(eName,eNumber,hireYear,weeklySalary);
        this.yearlySalary = _yearlySalary;
        this.department = _department;
    }
   
     public String toString()
    {
         return super.toString() + "\n YearlySalary: \t$" + strFormat.format(yearlySalary) + "\n Department: \t" + department;
    }
   
    public void setYearlySalary(double salary)
    {
        yearlySalary = salary;
    }

    public double getYearlySalary()
    {
        return yearlySalary;
    }
   
    public Department getDepartment()
    {
        return department;
    }
   
    public void setDeparment(Department department)
    {
        this.department = department;
    }
   
    public static Manager getManager()
    {
    Random generator = new Random();
    String name = names[generator.nextInt(names.length)];
   
    String eNumber = Employee.employeeNumber();
    int yearHired = 2011-generator.nextInt(35);
    double yearlySalary = minYearlySalary + generator.nextDouble()*(maxYearlySalary-minYearlySalary);
    double weeklySalary = computeWeeklySalary();
   
    Department[] dir = Department.values();
    Department department = dir[new Random().nextInt(dir.length)];
   
    Manager ms = new Manager(name, eNumber, yearHired, weeklySalary,yearlySalary,department);
    return ms;    
    }
   
    public static double computeWeeklySalary()
    {
    Random generator = new Random();
    double beforeTax =  generator.nextInt(10000);
    double afterTax = 0;
    double yearlySalary = minYearlySalary + generator.nextDouble()*(maxYearlySalary-minYearlySalary);
   
    if ((yearlySalary >= 60000) && (yearlySalary <= 80000))
        {
            afterTax = beforeTax - (beforeTax *.35);
        }
    else if ((yearlySalary >= 80001) && (yearlySalary <= 100000))
        {
            afterTax = beforeTax - (beforeTax *.425);
        }
           
    else if ((yearlySalary >= 100001) && (yearlySalary <= 120000))
        {    
            afterTax = beforeTax - (beforeTax *.495);
        }
   
    return afterTax;
    }


}

Shift class:

import java.util.Random;
import java.util.ArrayList;
import java.util.Scanner;
public class Shift
{
    private Random generator;
    private ProductionWorker prodWork;
    private Manager man;
    private ArrayList<ProductionWorker> employee;
    private ArrayList<ShiftSuperVisor> employee2;
    private ArrayList<Manager> employee3;
    private boolean shift;
    public enum WeekDay {Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday};
     private int day;
     private boolean metProductionGoals;
    /**
     * Constructor for objects of class Shift
     */
    public Shift(int day, boolean shift, boolean goals)
    {
        employee = new ArrayList<ProductionWorker>();
        employee2 = new ArrayList<ShiftSuperVisor>();
        employee3 = new ArrayList<Manager>();
       
        for(int i = 1; i <=5; i++)
        {
            employee.add(ProductionWorker.getProductionWorker());
        }
        System.out.println("Production Worker " + employee);
   
        for(int j = 1; j <= 3; j++)
        {
            employee2.add(ShiftSuperVisor.getShiftSuperVisor());
        }
        System.out.println("Shift Super Visor " + employee2);
       
        for(int k = 1; k <= 3; k++)
        {
            employee3.add(Manager.getManager());
        }
        System.out.println("Manager " + employee3);
       
        this.day = day;
       
        this.shift = shift;
        metProductionGoals = goals;
    }
   
    public ArrayList<ProductionWorker> getEmployee()
    {
        return employee;
    }
   
    public ArrayList<ShiftSuperVisor>getEmployee2()
    {
        return employee2;
    }
   
    public ArrayList<Manager>getEmployee3()
    {
        return employee3;
    }
   
    public int getDay()
    {
        return day;
    }
   
    public void setDay(int day)
    {
        this.day = day;
    }
   
    public boolean getShift()
    {
        return shift;
    }
   
   
    public boolean productionGoals()
    {
        Scanner keyboard = new Scanner(System.in);
        System.out.println("yes or no");
        String line = keyboard.nextLine();
        if(line.trim().toLowerCase().equals("no"))
        return false;
        return true;
    }
   
    public boolean getProductionGoals()
    {
        return metProductionGoals;
    }
   
    public boolean equals(Shift otherShift)
    {
       
            if(employee.equals(otherShift.getEmployee()))
            if(employee2.equals(otherShift.getEmployee2()))
            if(employee3.equals(otherShift.getEmployee3()))
                if(metProductionGoals ==(otherShift.getProductionGoals()))
                if(day == (otherShift.getDay()))
                if(shift == (otherShift.getShift()))
                return true;
       
 
    return false;
}

    /**
     * An example of a method - replace this comment with your own
     *
     * @param  y   a sample parameter for a method
     * @return     the sum of x and y
     */
  public String toString()
    {
         return ((day + " " + employee + " " + employee2 + " " + employee3 + " " + metProductionGoals));
    }
   
public boolean shiftDay()
{
Scanner keyboard = new Scanner(System.in);
System.out.println("day or night");
String line = keyboard.nextLine();
if(line.trim().toLowerCase().equals("night"))
return false;
return true;
}
     
    }

import java.util.ArrayList;
import java.util.Random;
import java.text.DecimalFormat;
import java.text.NumberFormat;

TestEmployeeProductionWorker class:

public class TestEmployeeProductionWorker
{
    // instance variables - replace the example below with your own
    protected Random generator;
    protected ArrayList<ProductionWorker> ProductionEmployees;
    protected static String[] names = {"Ryan","Jones","Brown","Peter","Emma","Jennifer","Courtney",
    "Ross","Joe","Chandler","Ruth","Stewart","Monica","Rachel","Stewie","Chris","Meg","Louis",
    "Cleveland","Quagmire"};
    protected static double minHourlySalary = 6.00;
    protected static double maxHourlySalary = 50.00;
    protected static double maxWeeklySalary = 10000.00;
    /**
     * Initializes an ArrayList of 20 employees to a reasonable but random values
     * (you may use class Random to generate the values).
     */
    public TestEmployeeProductionWorker()
    {
        ProductionEmployees = new ArrayList<ProductionWorker>();
        for(int i = 1; i <= 20; i++)
        {
            ProductionEmployees.add(getProductionWorker());  
        }
     System.out.println(ProductionEmployees);
    }
   
    public static ProductionWorker getProductionWorker()
    {

    Random generator = new Random();
    String name = names[generator.nextInt(names.length)];
    String eNumber = Employee.employeeNumber();
    int yearHired = 2011-generator.nextInt(35);
    double hourlySalary = minHourlySalary + Math.random()*(maxHourlySalary-minHourlySalary);
    double weeklySalary = maxWeeklySalary - Math.random()*(maxWeeklySalary);
    ProductionWorker pw = new ProductionWorker(name, eNumber, yearHired, hourlySalary, weeklySalary);
    return pw;    
    }
 }
0
Comment
Question by:ryanbecker24
  • 6
  • 3
  • 3
12 Comments
 
LVL 47

Expert Comment

by:for_yan
ID: 36945697

These methods return boolean

Shift.getProductionGoals()
Shift.shiftDay()
Shift.getDay());

What was your intentsion when you were adding them to arraylists
conatinuing ProductionWorker, SuperViosr Manager elements ?



pw.add(Shift.getProductionGoals());
            pw.add(Shift.shiftDay());
            pw.add(Shift.getDay());

Please, explain this and we could think waht to do with it - the rest of the code seesm to complile at least
0
 

Author Comment

by:ryanbecker24
ID: 36945731
for the manager,productionworker,and shiftsupervisor to display the production goals, if its day or night, day of the week
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36945788
No you cannot do it
pw is ArrayList of ProductionWorkers
getProdcutionGoals() ireturns boolean, there is no way
you can add to ArrayList of ProductionWorkeres boolean value
Maybe you can change property of ProdctionWorker and then add instance of ProductionWorker
but you cannot add boolean
To arraylist pw you can only add instances of ProductionWorkers

The code is too big for me to undersatnd easily logic
especially when it is not working...


0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:ryanbecker24
ID: 36945845
i tried to change getProductionGoals() to int but i get a static problem
0
 
LVL 13

Expert Comment

by:Hugh McCurdy
ID: 36945885
Note: it might help if you attached your code as a file.   (File|Code|Image|Screencast)  If it's more than one file, make a zip file out of it.  Some comments might help too especially around areas that don't work.
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36945916

>i tried to change getProductionGoals() to int but i get a static problem

that's is another problem that method looks like static
but please befoer everuything like that think about the logic:


 pw = new ArrayList<ProductionWorker>();
this says tah pw is ArrayList of ProductionWorkeres
this line is fine - you are adding and element which is instance of ProductionWorker

     pw.add(ProductionWorker.getProductionWorker());


   the next lines just make no logical sense - you cannot add anyhting ele to this arraylist  - nor boolean, nor integer
the only think you can add is instance of ProductionWorker

What is it you are truying to do?

Yes you can say that say this instance of priodcution woorker has boolean property and you can set that boolean
property but when adding to ArrayLyist pw you should be adding only ProduictionWorkers

Please, explain in words what you want to do and maybe we will understabnd something


0
 
LVL 13

Expert Comment

by:Hugh McCurdy
ID: 36945955
For_yan asked What is it you are truying to do?

I agree.  It would help to have more comments in your program to tell us what you are trying to accomplish.  (Some "theoretical" background of what's in your head.)
0
 

Author Comment

by:ryanbecker24
ID: 36945972
I am trying to create a list of production workers that have a name,number,yearhired,weeklysalary,hourlysalary,if its day or night,day of week,if they met there production goals. the managers have name,number,yearhired,weeklysalary,hourlysalary,department. shiftsupervisor has name,number,yearhired,weeklysalary,hourlysalary,goals.
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36945990
So you first need to create all those folks maybe wioth constrcutors or with suvch methods like here
ProductionWorker.getProductionWorker());
ansd when it creates them it should probably randndomly(?) - it was that way in the beginning of your applucation -
 assign all thos properies - then
you add instances of those people to respcetive arraylists - but your oproperties cannot exist by itself - thery
are propertuyes of peopel and thios people can beadded to the ArraylIsts corresponding to thier postions
So no boolean no integers - only workeres are elemants of array lists
 
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36946011
This at least pworks and produce output
We need to add shifts and met goals or something
(I just removed adding boolena to people,
and with that it compiles and works) - see output

import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Random;
import java.util.Scanner;

/**
 * Write a description of class TestAll here.
 *
 * @author (your name)
 * @version (a version number or a date)
 */
public class TestAll
{

    protected Random generator;
    protected ArrayList<Employee> employees;
    protected boolean metProductionGoals;
    public enum WeekDay {Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday};
    protected static String[] names = {"Ryan","Jones","Brown","Peter","Emma","Jennifer","Courtney",
    "Ross","Joe","Chandler","Ruth","Stewart","Monica","Rachel","Stewie","Chris","Meg","Louis",
    "Cleveland","Quagmire"};
    protected ArrayList<ProductionWorker> pw;
    protected ArrayList<ShiftSuperVisor> sv;
    protected ArrayList<Manager> m;

    /**
     * Constructor for objects of class TestAll
     */
    public TestAll()
    {

        pw = new ArrayList<ProductionWorker>();
        sv = new ArrayList<ShiftSuperVisor>();
        m = new ArrayList<Manager>();

        for(int i = 1; i <=10; i++)
        {
            pw.add(ProductionWorker.getProductionWorker());
           // pw.add(Shift.getProductionGoals());
            //pw.add(Shift.shiftDay());
           // pw.add(Shift.getDay());
        }
        System.out.println("Production Worker " + pw);

        for(int j = 1; j <= 10; j++)
        {
            sv.add(ShiftSuperVisor.getShiftSuperVisor());
           // sv.add(Shift.getProductionGoals());
           // sv.add(Shift.shiftDay());
           // sv.add(Shift.getDay());
        }
        System.out.println("Shift Super Visor " + sv);

        for(int k = 1; k <= 10; k++)
        {
            m.add(Manager.getManager());
          //  m.add(Shift.getProductionGoals());
           // m.add(Shift.shiftDay());
           // m.add(Shift.getDay());
        }
        System.out.println("Manager " + m);

    }

    public static void main(String[] args) {
        new TestAll();
     }

}



 class Employee
{
    protected String eName;
    protected String eNumber;
    protected int hireYear;
    protected double weeklySalary;
    static Random generator = new Random();
    static NumberFormat strFormat = new DecimalFormat("#####.00");;


    public Employee(String eName, String eNumber, int hireYear, double weeklySalary)
    {

        this.eName = eName;
        if(validateENumber(eNumber))
        {
           this.eNumber = eNumber;
        }
        else
        {
            employeeNumber();
        }


        this.hireYear = hireYear;

        this.weeklySalary = weeklySalary;

    }



   public boolean validateENumber(String eNumber)
    {
        boolean validate = true;
        if(eNumber.length() < 5)
        validate = false;
        else{
        for (int i = 0; i < 3; i++)
        {
           if(!Character.isDigit(eNumber.charAt(i)))
           {
               validate = false;
            }
        }
        if (!(eNumber.charAt(3) == '-'))
            validate = false;

        if (!((eNumber.charAt(4) >= 65) && (eNumber.charAt(4) <=77)))
            validate = false;


    }
    return validate;
}

    public int getHireYear()
        {
            return hireYear;
        }

    public double getWeeklySalary()
        {
            return weeklySalary;
        }

    public void setName(String name)
        {
            eName = name;
        }

    public void setHireYear(int year)
        {
            hireYear = year;
        }

    public void setWeeeklyPay(int salary)
        {
            weeklySalary = salary;
        }

    public String getName()
    {
        return eName;
    }
     public String toString()
    {
        return ("\n\nName: \t" + eName + "\n   ID:     \t" + eNumber + "\n   Year Hired:\t" + hireYear +
                "\n   WeeklySalary:\t$" + strFormat.format(getWeeklySalary()));

    }

    public String getNumber()
    {
        return eNumber;
    }

   public static String employeeNumber()
    {
        int  eNumber = generator.nextInt(10)* 100 + generator.nextInt(10)* 10 + generator.nextInt(10);
        String enumS = "" + eNumber;
        while(enumS.length() < 3)
        enumS = "0" + enumS;
        String let = "" + ("ABCDEFGHIJKLM").charAt(generator.nextInt(13));
        return enumS + "-" + let;
    }

    public boolean equals(Employee other)
    {

       if ((eName.equals(other.getName())) && (eNumber.equals(other.getNumber())) && (hireYear == other.getHireYear()) && (weeklySalary == other.getWeeklySalary()))
            return true;
       else
            return false;

    }

   public double getSalary()
    {
        return weeklySalary;
    }
}


class ShiftSuperVisor extends Employee implements SalariedEmployee
{
    // instance variables - replace the example below with your own
    protected double yearlySalary;
    protected static double weeklySalary;
    protected Random generator;
    protected static String[] names = {"Katarina", "Amelia", "William", "Hope", "Isaac", "Hollis", "Claire", "Austin", "Noah"};
    protected int goal;
    protected static final double minYearlySalary = 40000;
    protected static final double maxYearlySalary = 80000;
    protected static final double maxWeeklySalary = 10000;
        //constructor that calls variables from Class Employee to create object ProductionWorker
    public ShiftSuperVisor(String eName,String eNumber,int hireYear, double weeklySalary)
    {
        super(eName,eNumber,hireYear,weeklySalary);
        if(super.validateENumber(eNumber))
        {

            this.eNumber = eNumber;
        }
            else
               this.eNumber =  employeeNumber();
        this.weeklySalary = weeklySalary;
    }
    /**
     * Constructor for objects of class ShiftSuperVisor
     */
    public ShiftSuperVisor(String eName,String eNumber,int hireYear,double weeklySalary, double yearlySalary, int goals)
    {
        super(eName,eNumber,hireYear,weeklySalary);
        if(super.validateENumber(eNumber))
        {

            this.eNumber = eNumber;
        }
            else
                this.eNumber = employeeNumber();
        this.yearlySalary = yearlySalary;
        this.goal = goals;
    }

    public double getYearlySalary()
        {
            return yearlySalary;
        }

    public void setYearlySalary(double salary)
        {
            this.yearlySalary = salary;
        }

    public void setGoal(int goal)
    {
        this.goal = goal;
    }

    public int getGoal()
    {
        return goal;
    }

    public String toString()
    {
        return (super.toString()+"\n YearlySalary:\t$" + strFormat.format(yearlySalary) + "\nGoals:\t" + goal);

        }

     /**
     * Equals method
     */
    public boolean equals(ShiftSuperVisor visor)
    {
        if(goal == visor.getGoal())
        if(yearlySalary == visor.getYearlySalary())
        return true;

        return false;

    }

    public double getSalary()
    {
        return yearlySalary;
    }

    public static ShiftSuperVisor getShiftSuperVisor()
    {
    Random generator = new Random();
    String name = names[generator.nextInt(names.length)];

    String eNumber = Employee.employeeNumber();
    int yearHired = 2011-generator.nextInt(35);

    double yearlySalary = minYearlySalary + generator.nextDouble()*(maxYearlySalary-minYearlySalary);
    double weeklySalary = maxWeeklySalary - generator.nextDouble()*(maxWeeklySalary);
    int goals = generator.nextInt(35) + 1;

    ShiftSuperVisor pw = new ShiftSuperVisor(name, eNumber, yearHired, weeklySalary, yearlySalary, goals);
    return pw;
    }

    public static double computeWeeklySalary()
    {
    Random generator = new Random();
    double beforeTax =  generator.nextInt(10000);
    double afterTax = beforeTax - (beforeTax *.3);
    return afterTax;
    }
}



 class ProductionWorker extends Employee
{
    //value of how much a production worker makes hourly
    protected double hourlySalary;

    protected static Random generator = new Random();;
    protected static String[] names = {"Ryan","Jones","Brown","Peter","Emma","Jennifer","Courtney", "Ross","Joe","Chandler","Ruth","Stewart","Monica","Rachel","Stewie","Chris","Meg","Louis",
    "Cleveland","Quagmire"};
    protected static final double minHourlySalary = 6.00;
    protected static final double maxHourlySalary = 50.00;
    protected static final double maxWeeklySalary = 10000;
    static  NumberFormat strFormat = new DecimalFormat("#####.00");;

    //constructor that calls variables from Class Employee to create object ProductionWorker
    public ProductionWorker(String eName,String eNumber,int hireYear, double weeklySalary)
    {
        super(eName,eNumber,hireYear,weeklySalary);
        if(super.validateENumber(eNumber))
        {

            this.eNumber = eNumber;
        }
            else
               this.eNumber =  employeeNumber();
        this.weeklySalary = weeklySalary;
    }

     public ProductionWorker(String eName,String eNumber,int hireYear, double weeklySalary, double _hourlySalary)
    {
        super(eName, eNumber, hireYear, weeklySalary);
        this.hourlySalary = _hourlySalary;

    }

    public double getHourlySalary()
        {
            return hourlySalary;
        }

    public void setHourlySalary(double salary)
        {
            this.hourlySalary = salary;
        }


    public String toString()
    {
        return super.toString() + "\n Hourly Salary:\t$" + strFormat.format(hourlySalary);

    }

     /**
     * Equals method
     */
    public boolean equals(ProductionWorker worker)
    {
        if(hourlySalary == worker.getHourlySalary())
            return true;

        return false;
    }

    public double getSalary()
    {
        return hourlySalary;
    }

    public static ProductionWorker getProductionWorker()
    {

        String name = names[generator.nextInt(names.length)];

        String eNumber = Employee.employeeNumber();
        int yearHired = 2011-generator.nextInt(35);

        double hourlySalary = minHourlySalary + generator.nextDouble()*(maxHourlySalary-minHourlySalary);
        double weeklySalary = maxWeeklySalary - generator.nextDouble()*(maxWeeklySalary);

        return new ProductionWorker(name, eNumber, yearHired, weeklySalary, hourlySalary);
     }
}



 interface SalariedEmployee
{

    public double getYearlySalary();

    public double getWeeklySalary();

}

class Manager extends Employee implements SalariedEmployee
{
    protected double yearlySalary;
    protected Department department;
    protected Random generator = new Random();
    protected static String[] names = {"Caitlyn", "Laine", "Liam", "Sophia", "Charlotte", "Jackson", "Ethan", "Mason"};
    protected static final double minYearlySalary = 60000;
    protected static final double maxYearlySalary = 120000;
    public enum Department{PayRoll, Production, Accounting, Research, Marketing};

    public Manager(String eName,String eNumber,int hireYear, double weeklySalary)
    {
        super(eName,eNumber,hireYear,weeklySalary);
        if(super.validateENumber(eNumber))
        {
            this.eNumber = eNumber;
        }
            else
               this.eNumber =  employeeNumber();
        this.weeklySalary = weeklySalary;
    }

    /**
     * Constructor for objects of class Manager
     */
    public Manager(String eName,String eNumber,int hireYear, double weeklySalary, double _yearlySalary, Department _department )
    {
        super(eName,eNumber,hireYear,weeklySalary);
        this.yearlySalary = _yearlySalary;
        this.department = _department;
    }

     public String toString()
    {
         return super.toString() + "\n YearlySalary: \t$" + strFormat.format(yearlySalary) + "\n Department: \t" + department;
    }

    public void setYearlySalary(double salary)
    {
        yearlySalary = salary;
    }

    public double getYearlySalary()
    {
        return yearlySalary;
    }

    public Department getDepartment()
    {
        return department;
    }

    public void setDeparment(Department department)
    {
        this.department = department;
    }

    public static Manager getManager()
    {
    Random generator = new Random();
    String name = names[generator.nextInt(names.length)];

    String eNumber = Employee.employeeNumber();
    int yearHired = 2011-generator.nextInt(35);
    double yearlySalary = minYearlySalary + generator.nextDouble()*(maxYearlySalary-minYearlySalary);
    double weeklySalary = computeWeeklySalary();

    Department[] dir = Department.values();
    Department department = dir[new Random().nextInt(dir.length)];

    Manager ms = new Manager(name, eNumber, yearHired, weeklySalary,yearlySalary,department);
    return ms;
    }

    public static double computeWeeklySalary()
    {
    Random generator = new Random();
    double beforeTax =  generator.nextInt(10000);
    double afterTax = 0;
    double yearlySalary = minYearlySalary + generator.nextDouble()*(maxYearlySalary-minYearlySalary);

    if ((yearlySalary >= 60000) && (yearlySalary <= 80000))
        {
            afterTax = beforeTax - (beforeTax *.35);
        }
    else if ((yearlySalary >= 80001) && (yearlySalary <= 100000))
        {
            afterTax = beforeTax - (beforeTax *.425);
        }

    else if ((yearlySalary >= 100001) && (yearlySalary <= 120000))
        {
            afterTax = beforeTax - (beforeTax *.495);
        }

    return afterTax;
    }


}

class Shift
{
    private Random generator;
    private ProductionWorker prodWork;
    private Manager man;
    private ArrayList<ProductionWorker> employee;
    private ArrayList<ShiftSuperVisor> employee2;
    private ArrayList<Manager> employee3;
    private boolean shift;
    public enum WeekDay {Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday};
     private int day;
     private boolean metProductionGoals;
    /**
     * Constructor for objects of class Shift
     */
    public Shift(int day, boolean shift, boolean goals)
    {
        employee = new ArrayList<ProductionWorker>();
        employee2 = new ArrayList<ShiftSuperVisor>();
        employee3 = new ArrayList<Manager>();

        for(int i = 1; i <=5; i++)
        {
            employee.add(ProductionWorker.getProductionWorker());
        }
        System.out.println("Production Worker " + employee);

        for(int j = 1; j <= 3; j++)
        {
            employee2.add(ShiftSuperVisor.getShiftSuperVisor());
        }
        System.out.println("Shift Super Visor " + employee2);

        for(int k = 1; k <= 3; k++)
        {
            employee3.add(Manager.getManager());
        }
        System.out.println("Manager " + employee3);

        this.day = day;

        this.shift = shift;
        metProductionGoals = goals;
    }

    public ArrayList<ProductionWorker> getEmployee()
    {
        return employee;
    }

    public ArrayList<ShiftSuperVisor>getEmployee2()
    {
        return employee2;
    }

    public ArrayList<Manager>getEmployee3()
    {
        return employee3;
    }

    public int getDay()
    {
        return day;
    }

    public void setDay(int day)
    {
        this.day = day;
    }

    public boolean getShift()
    {
        return shift;
    }


    public boolean productionGoals()
    {
        Scanner keyboard = new Scanner(System.in);
        System.out.println("yes or no");
        String line = keyboard.nextLine();
        if(line.trim().toLowerCase().equals("no"))
        return false;
        return true;
    }

    public boolean getProductionGoals()
    {
        return metProductionGoals;
    }

    public boolean equals(Shift otherShift)
    {

            if(employee.equals(otherShift.getEmployee()))
            if(employee2.equals(otherShift.getEmployee2()))
            if(employee3.equals(otherShift.getEmployee3()))
                if(metProductionGoals ==(otherShift.getProductionGoals()))
                if(day == (otherShift.getDay()))
                if(shift == (otherShift.getShift()))
                return true;


    return false;
}

    /**
     * An example of a method - replace this comment with your own
     *
    // * @param  y   a sample parameter for a method
     * @return     the sum of x and y
     */
  public String toString()
    {
         return ((day + " " + employee + " " + employee2 + " " + employee3 + " " + metProductionGoals));
    }

public boolean shiftDay()
{
Scanner keyboard = new Scanner(System.in);
System.out.println("day or night");
String line = keyboard.nextLine();
if(line.trim().toLowerCase().equals("night"))
return false;
return true;
}

    }



 class TestEmployeeProductionWorker
{
    // instance variables - replace the example below with your own
    protected Random generator;
    protected ArrayList<ProductionWorker> ProductionEmployees;
    protected static String[] names = {"Ryan","Jones","Brown","Peter","Emma","Jennifer","Courtney",
    "Ross","Joe","Chandler","Ruth","Stewart","Monica","Rachel","Stewie","Chris","Meg","Louis",
    "Cleveland","Quagmire"};
    protected static double minHourlySalary = 6.00;
    protected static double maxHourlySalary = 50.00;
    protected static double maxWeeklySalary = 10000.00;
    /**
     * Initializes an ArrayList of 20 employees to a reasonable but random values
     * (you may use class Random to generate the values).
     */
    public TestEmployeeProductionWorker()
    {
        ProductionEmployees = new ArrayList<ProductionWorker>();
        for(int i = 1; i <= 20; i++)
        {
            ProductionEmployees.add(getProductionWorker());
        }
     System.out.println(ProductionEmployees);
    }

    public static ProductionWorker getProductionWorker()
    {

    Random generator = new Random();
    String name = names[generator.nextInt(names.length)];
    String eNumber = Employee.employeeNumber();
    int yearHired = 2011-generator.nextInt(35);
    double hourlySalary = minHourlySalary + Math.random()*(maxHourlySalary-minHourlySalary);
    double weeklySalary = maxWeeklySalary - Math.random()*(maxWeeklySalary);
    ProductionWorker pw = new ProductionWorker(name, eNumber, yearHired, hourlySalary, weeklySalary);
    return pw;
    }
 }

Open in new window



Production Worker [

Name: 	Meg
   ID:     	524-E
   Year Hired:	1988
   WeeklySalary:	$9470.21
 Hourly Salary:	$17.94, 

Name: 	Ruth
   ID:     	724-H
   Year Hired:	1977
   WeeklySalary:	$5291.17
 Hourly Salary:	$25.90, 

Name: 	Stewart
   ID:     	902-I
   Year Hired:	1990
   WeeklySalary:	$7361.63
 Hourly Salary:	$32.74, 

Name: 	Ruth
   ID:     	664-E
   Year Hired:	1983
   WeeklySalary:	$7772.68
 Hourly Salary:	$12.82, 

Name: 	Courtney
   ID:     	906-F
   Year Hired:	1992
   WeeklySalary:	$4951.66
 Hourly Salary:	$29.15, 

Name: 	Cleveland
   ID:     	752-K
   Year Hired:	1978
   WeeklySalary:	$2541.34
 Hourly Salary:	$48.00, 

Name: 	Quagmire
   ID:     	549-C
   Year Hired:	2008
   WeeklySalary:	$521.62
 Hourly Salary:	$44.33, 

Name: 	Ryan
   ID:     	131-K
   Year Hired:	2008
   WeeklySalary:	$5476.07
 Hourly Salary:	$25.59, 

Name: 	Meg
   ID:     	238-D
   Year Hired:	2011
   WeeklySalary:	$7042.55
 Hourly Salary:	$40.83, 

Name: 	Joe
   ID:     	866-H
   Year Hired:	1994
   WeeklySalary:	$1042.26
 Hourly Salary:	$24.26]
Shift Super Visor [

Name: 	William
   ID:     	823-H
   Year Hired:	1986
   WeeklySalary:	$4441.36
 YearlySalary:	$61833.74
Goals:	10, 

Name: 	Claire
   ID:     	561-K
   Year Hired:	1991
   WeeklySalary:	$8071.05
 YearlySalary:	$74314.02
Goals:	31, 

Name: 	Amelia
   ID:     	517-H
   Year Hired:	1987
   WeeklySalary:	$6870.02
 YearlySalary:	$59114.45
Goals:	13, 

Name: 	Noah
   ID:     	517-D
   Year Hired:	1984
   WeeklySalary:	$3399.49
 YearlySalary:	$72129.84
Goals:	15, 

Name: 	Isaac
   ID:     	459-D
   Year Hired:	1982
   WeeklySalary:	$2445.37
 YearlySalary:	$72054.27
Goals:	8, 

Name: 	Isaac
   ID:     	108-I
   Year Hired:	2008
   WeeklySalary:	$1516.34
 YearlySalary:	$44618.78
Goals:	10, 

Name: 	Noah
   ID:     	532-B
   Year Hired:	2010
   WeeklySalary:	$4867.20
 YearlySalary:	$71482.40
Goals:	4, 

Name: 	Amelia
   ID:     	048-M
   Year Hired:	1995
   WeeklySalary:	$4133.30
 YearlySalary:	$40960.02
Goals:	29, 

Name: 	Austin
   ID:     	259-G
   Year Hired:	2005
   WeeklySalary:	$4471.34
 YearlySalary:	$73464.87
Goals:	6, 

Name: 	Isaac
   ID:     	001-A
   Year Hired:	2001
   WeeklySalary:	$3092.65
 YearlySalary:	$55253.13
Goals:	30]
Manager [

Name: 	Caitlyn
   ID:     	628-C
   Year Hired:	2004
   WeeklySalary:	$905.46
 YearlySalary: 	$93418.90
 Department: 	Marketing, 

Name: 	Mason
   ID:     	702-H
   Year Hired:	1987
   WeeklySalary:	$5139.92
 YearlySalary: 	$96679.29
 Department: 	Research, 

Name: 	Laine
   ID:     	258-H
   Year Hired:	2007
   WeeklySalary:	$4882.15
 YearlySalary: 	$94523.28
 Department: 	Research, 

Name: 	Sophia
   ID:     	977-D
   Year Hired:	1988
   WeeklySalary:	$948.75
 YearlySalary: 	$61562.96
 Department: 	PayRoll, 

Name: 	Liam
   ID:     	481-I
   Year Hired:	1995
   WeeklySalary:	$83.83
 YearlySalary: 	$80221.32
 Department: 	PayRoll, 

Name: 	Ethan
   ID:     	665-K
   Year Hired:	2009
   WeeklySalary:	$700.70
 YearlySalary: 	$115002.03
 Department: 	Marketing, 

Name: 	Sophia
   ID:     	384-M
   Year Hired:	1986
   WeeklySalary:	$6330.35
 YearlySalary: 	$98009.96
 Department: 	PayRoll, 

Name: 	Jackson
   ID:     	826-I
   Year Hired:	1981
   WeeklySalary:	$5484.05
 YearlySalary: 	$118841.85
 Department: 	Accounting, 

Name: 	Laine
   ID:     	255-H
   Year Hired:	1995
   WeeklySalary:	$4.04
 YearlySalary: 	$60571.28
 Department: 	Accounting, 

Name: 	Jackson
   ID:     	812-D
   Year Hired:	1995
   WeeklySalary:	$3393.65
 YearlySalary: 	$118430.95
 Department: 	Accounting]

Open in new window

0
 
LVL 13

Expert Comment

by:Hugh McCurdy
ID: 36946305
I'm not going to add to for_yan's code because it is working to the point that the program runs.  

What I suggest is you integrate for_yan's code in your program.  Then make the changes he suggested.  If you get stuck at that point, please post your entire code as an attached file (a zip file is fine) and then ask the new question.
0
 
LVL 47

Accepted Solution

by:
for_yan earned 2000 total points
ID: 36947047



added some stuff about shifts - it will
ask if the shift met goals and if it is day or night.
The rest of info for the shift would be
generated randomly.

Try to execute it - it will be easier to understand, then let me know
what questions you have.




import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Random;
import java.util.Scanner;

/**
 * Write a description of class TestAll here.
 *
 * @author (your name)
 * @version (a version number or a date)
 */
public class TestAll
{

    protected Random generator;
    protected ArrayList<Employee> employees;
    protected boolean metProductionGoals;
    public enum WeekDay {Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday};
    protected static String[] names = {"Ryan","Jones","Brown","Peter","Emma","Jennifer","Courtney",
    "Ross","Joe","Chandler","Ruth","Stewart","Monica","Rachel","Stewie","Chris","Meg","Louis",
    "Cleveland","Quagmire"};
    protected ArrayList<ProductionWorker> pw;
    protected ArrayList<ShiftSuperVisor> sv;
    protected ArrayList<Manager> m;
    protected ArrayList<Shift>shifts;

    /**
     * Constructor for objects of class TestAll
     */
    public TestAll()
    {

        pw = new ArrayList<ProductionWorker>();
        sv = new ArrayList<ShiftSuperVisor>();
        m = new ArrayList<Manager>();
        shifts = new ArrayList<Shift>();

        for(int i = 1; i <=10; i++)
        {
            pw.add(ProductionWorker.getProductionWorker());
           // pw.add(Shift.getProductionGoals());
            //pw.add(Shift.shiftDay());
           // pw.add(Shift.getDay());
        }
        System.out.println("Production Worker " + pw);

        for(int j = 1; j <= 10; j++)
        {
            sv.add(ShiftSuperVisor.getShiftSuperVisor());
           // sv.add(Shift.getProductionGoals());
           // sv.add(Shift.shiftDay());
           // sv.add(Shift.getDay());
        }
        System.out.println("Shift Super Visor " + sv);

        for(int k = 1; k <= 10; k++)
        {
            m.add(Manager.getManager());
          //  m.add(Shift.getProductionGoals());
           // m.add(Shift.shiftDay());
           // m.add(Shift.getDay());
        }
        System.out.println("Manager " + m);

             System.out.println(" ");

                System.out.println(" ");

                System.out.println(" ");

             System.out.println("Enter parameters for shifts 1-3: ");


        for(int l=0; l<3; l++) {
            shifts.add(new Shift());
        }
                System.out.println("--------------------------------------------------Shifts------------------------------------------------- ");
                       int count = 1;
         for(Shift sft : shifts) {
             System.out.println("Shift no. " + count + "-------------------:");
               System.out.println(sft);
                System.out.println("--------------------------");
             count++;


         }
    }



    public static void main(String[] args) {
        new TestAll();
     }

}



 class Employee
{
    protected String eName;
    protected String eNumber;
    protected int hireYear;
    protected double weeklySalary;
    static Random generator = new Random();
    static NumberFormat strFormat = new DecimalFormat("#####.00");;


    public Employee(String eName, String eNumber, int hireYear, double weeklySalary)
    {

        this.eName = eName;
        if(validateENumber(eNumber))
        {
           this.eNumber = eNumber;
        }
        else
        {
            employeeNumber();
        }


        this.hireYear = hireYear;

        this.weeklySalary = weeklySalary;

    }



   public boolean validateENumber(String eNumber)
    {
        boolean validate = true;
        if(eNumber.length() < 5)
        validate = false;
        else{
        for (int i = 0; i < 3; i++)
        {
           if(!Character.isDigit(eNumber.charAt(i)))
           {
               validate = false;
            }
        }
        if (!(eNumber.charAt(3) == '-'))
            validate = false;

        if (!((eNumber.charAt(4) >= 65) && (eNumber.charAt(4) <=77)))
            validate = false;


    }
    return validate;
}

    public int getHireYear()
        {
            return hireYear;
        }

    public double getWeeklySalary()
        {
            return weeklySalary;
        }

    public void setName(String name)
        {
            eName = name;
        }

    public void setHireYear(int year)
        {
            hireYear = year;
        }

    public void setWeeeklyPay(int salary)
        {
            weeklySalary = salary;
        }

    public String getName()
    {
        return eName;
    }
     public String toString()
    {
        return ("\n\nName: \t" + eName + "\n   ID:     \t" + eNumber + "\n   Year Hired:\t" + hireYear +
                "\n   WeeklySalary:\t$" + strFormat.format(getWeeklySalary()));

    }

    public String getNumber()
    {
        return eNumber;
    }

   public static String employeeNumber()
    {
        int  eNumber = generator.nextInt(10)* 100 + generator.nextInt(10)* 10 + generator.nextInt(10);
        String enumS = "" + eNumber;
        while(enumS.length() < 3)
        enumS = "0" + enumS;
        String let = "" + ("ABCDEFGHIJKLM").charAt(generator.nextInt(13));
        return enumS + "-" + let;
    }

    public boolean equals(Employee other)
    {

       if ((eName.equals(other.getName())) && (eNumber.equals(other.getNumber())) && (hireYear == other.getHireYear()) && (weeklySalary == other.getWeeklySalary()))
            return true;
       else
            return false;

    }

   public double getSalary()
    {
        return weeklySalary;
    }
}


class ShiftSuperVisor extends Employee implements SalariedEmployee
{
    // instance variables - replace the example below with your own
    protected double yearlySalary;
    protected static double weeklySalary;
    protected Random generator;
    protected static String[] names = {"Katarina", "Amelia", "William", "Hope", "Isaac", "Hollis", "Claire", "Austin", "Noah"};
    protected int goal;
    protected static final double minYearlySalary = 40000;
    protected static final double maxYearlySalary = 80000;
    protected static final double maxWeeklySalary = 10000;
        //constructor that calls variables from Class Employee to create object ProductionWorker
    public ShiftSuperVisor(String eName,String eNumber,int hireYear, double weeklySalary)
    {
        super(eName,eNumber,hireYear,weeklySalary);
        if(super.validateENumber(eNumber))
        {

            this.eNumber = eNumber;
        }
            else
               this.eNumber =  employeeNumber();
        this.weeklySalary = weeklySalary;
    }
    /**
     * Constructor for objects of class ShiftSuperVisor
     */
    public ShiftSuperVisor(String eName,String eNumber,int hireYear,double weeklySalary, double yearlySalary, int goals)
    {
        super(eName,eNumber,hireYear,weeklySalary);
        if(super.validateENumber(eNumber))
        {

            this.eNumber = eNumber;
        }
            else
                this.eNumber = employeeNumber();
        this.yearlySalary = yearlySalary;
        this.goal = goals;
    }

    public double getYearlySalary()
        {
            return yearlySalary;
        }

    public void setYearlySalary(double salary)
        {
            this.yearlySalary = salary;
        }

    public void setGoal(int goal)
    {
        this.goal = goal;
    }

    public int getGoal()
    {
        return goal;
    }

    public String toString()
    {
        return (super.toString()+"\n YearlySalary:\t$" + strFormat.format(yearlySalary) + "\nGoals:\t" + goal);

        }

     /**
     * Equals method
     */
    public boolean equals(ShiftSuperVisor visor)
    {
        if(goal == visor.getGoal())
        if(yearlySalary == visor.getYearlySalary())
        return true;

        return false;

    }

    public double getSalary()
    {
        return yearlySalary;
    }

    public static ShiftSuperVisor getShiftSuperVisor()
    {
    Random generator = new Random();
    String name = names[generator.nextInt(names.length)];

    String eNumber = Employee.employeeNumber();
    int yearHired = 2011-generator.nextInt(35);

    double yearlySalary = minYearlySalary + generator.nextDouble()*(maxYearlySalary-minYearlySalary);
    double weeklySalary = maxWeeklySalary - generator.nextDouble()*(maxWeeklySalary);
    int goals = generator.nextInt(35) + 1;

    ShiftSuperVisor pw = new ShiftSuperVisor(name, eNumber, yearHired, weeklySalary, yearlySalary, goals);
    return pw;
    }

    public static double computeWeeklySalary()
    {
    Random generator = new Random();
    double beforeTax =  generator.nextInt(10000);
    double afterTax = beforeTax - (beforeTax *.3);
    return afterTax;
    }
}



 class ProductionWorker extends Employee
{
    //value of how much a production worker makes hourly
    protected double hourlySalary;

    protected static Random generator = new Random();;
    protected static String[] names = {"Ryan","Jones","Brown","Peter","Emma","Jennifer","Courtney", "Ross","Joe","Chandler","Ruth","Stewart","Monica","Rachel","Stewie","Chris","Meg","Louis",
    "Cleveland","Quagmire"};
    protected static final double minHourlySalary = 6.00;
    protected static final double maxHourlySalary = 50.00;
    protected static final double maxWeeklySalary = 10000;
    static  NumberFormat strFormat = new DecimalFormat("#####.00");;

    //constructor that calls variables from Class Employee to create object ProductionWorker
    public ProductionWorker(String eName,String eNumber,int hireYear, double weeklySalary)
    {
        super(eName,eNumber,hireYear,weeklySalary);
        if(super.validateENumber(eNumber))
        {

            this.eNumber = eNumber;
        }
            else
               this.eNumber =  employeeNumber();
        this.weeklySalary = weeklySalary;
    }

     public ProductionWorker(String eName,String eNumber,int hireYear, double weeklySalary, double _hourlySalary)
    {
        super(eName, eNumber, hireYear, weeklySalary);
        this.hourlySalary = _hourlySalary;

    }

    public double getHourlySalary()
        {
            return hourlySalary;
        }

    public void setHourlySalary(double salary)
        {
            this.hourlySalary = salary;
        }


    public String toString()
    {
        return super.toString() + "\n Hourly Salary:\t$" + strFormat.format(hourlySalary);

    }

     /**
     * Equals method
     */
    public boolean equals(ProductionWorker worker)
    {
        if(hourlySalary == worker.getHourlySalary())
            return true;

        return false;
    }

    public double getSalary()
    {
        return hourlySalary;
    }

    public static ProductionWorker getProductionWorker()
    {

        String name = names[generator.nextInt(names.length)];

        String eNumber = Employee.employeeNumber();
        int yearHired = 2011-generator.nextInt(35);

        double hourlySalary = minHourlySalary + generator.nextDouble()*(maxHourlySalary-minHourlySalary);
        double weeklySalary = maxWeeklySalary - generator.nextDouble()*(maxWeeklySalary);

        return new ProductionWorker(name, eNumber, yearHired, weeklySalary, hourlySalary);
     }
}



 interface SalariedEmployee
{

    public double getYearlySalary();

    public double getWeeklySalary();

}

class Manager extends Employee implements SalariedEmployee
{
    protected double yearlySalary;
    protected Department department;
    protected Random generator = new Random();
    protected static String[] names = {"Caitlyn", "Laine", "Liam", "Sophia", "Charlotte", "Jackson", "Ethan", "Mason"};
    protected static final double minYearlySalary = 60000;
    protected static final double maxYearlySalary = 120000;
    public enum Department{PayRoll, Production, Accounting, Research, Marketing};

    public Manager(String eName,String eNumber,int hireYear, double weeklySalary)
    {
        super(eName,eNumber,hireYear,weeklySalary);
        if(super.validateENumber(eNumber))
        {
            this.eNumber = eNumber;
        }
            else
               this.eNumber =  employeeNumber();
        this.weeklySalary = weeklySalary;
    }

    /**
     * Constructor for objects of class Manager
     */
    public Manager(String eName,String eNumber,int hireYear, double weeklySalary, double _yearlySalary, Department _department )
    {
        super(eName,eNumber,hireYear,weeklySalary);
        this.yearlySalary = _yearlySalary;
        this.department = _department;
    }

     public String toString()
    {
         return super.toString() + "\n YearlySalary: \t$" + strFormat.format(yearlySalary) + "\n Department: \t" + department;
    }

    public void setYearlySalary(double salary)
    {
        yearlySalary = salary;
    }

    public double getYearlySalary()
    {
        return yearlySalary;
    }

    public Department getDepartment()
    {
        return department;
    }

    public void setDeparment(Department department)
    {
        this.department = department;
    }

    public static Manager getManager()
    {
    Random generator = new Random();
    String name = names[generator.nextInt(names.length)];

    String eNumber = Employee.employeeNumber();
    int yearHired = 2011-generator.nextInt(35);
    double yearlySalary = minYearlySalary + generator.nextDouble()*(maxYearlySalary-minYearlySalary);
    double weeklySalary = computeWeeklySalary();

    Department[] dir = Department.values();
    Department department = dir[new Random().nextInt(dir.length)];

    Manager ms = new Manager(name, eNumber, yearHired, weeklySalary,yearlySalary,department);
    return ms;
    }

    public static double computeWeeklySalary()
    {
    Random generator = new Random();
    double beforeTax =  generator.nextInt(10000);
    double afterTax = 0;
    double yearlySalary = minYearlySalary + generator.nextDouble()*(maxYearlySalary-minYearlySalary);

    if ((yearlySalary >= 60000) && (yearlySalary <= 80000))
        {
            afterTax = beforeTax - (beforeTax *.35);
        }
    else if ((yearlySalary >= 80001) && (yearlySalary <= 100000))
        {
            afterTax = beforeTax - (beforeTax *.425);
        }

    else if ((yearlySalary >= 100001) && (yearlySalary <= 120000))
        {
            afterTax = beforeTax - (beforeTax *.495);
        }

    return afterTax;
    }


}

class Shift
{
    private Random generator;
    private ProductionWorker prodWork;
    private Manager man;
    private ArrayList<ProductionWorker> employee;
    private ArrayList<ShiftSuperVisor> employee2;
    private ArrayList<Manager> employee3;
    private boolean shift;
    public enum WeekDay {Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday};
     private WeekDay day0;
    int day;
     private boolean metProductionGoals;
    String shiftDay0;
    /**
     * Constructor for objects of class Shift
     */
   // public Shift(int day, boolean shift, boolean goals)
     public Shift()
    {
        employee = new ArrayList<ProductionWorker>();
        employee2 = new ArrayList<ShiftSuperVisor>();
        employee3 = new ArrayList<Manager>();

        for(int i = 1; i <=5; i++)
        {
            employee.add(ProductionWorker.getProductionWorker());
        }
    //    System.out.println("Production Worker " + employee);

        for(int j = 1; j <= 3; j++)
        {
            employee2.add(ShiftSuperVisor.getShiftSuperVisor());
        }
      //  System.out.println("Shift Super Visor " + employee2);

        for(int k = 1; k <= 3; k++)
        {
            employee3.add(Manager.getManager());
        }
        //System.out.println("Manager " + employee3);

       // this.day = day;

        this.shift = shift;
        metProductionGoals = productionGoals();
        WeekDay[] days = WeekDay.values();
        this.day0 = days[(new Random()).nextInt(days.length)];

        shiftDay0 = shiftDay();
        
    }

    public ArrayList<ProductionWorker> getEmployee()
    {
        return employee;
    }

    public ArrayList<ShiftSuperVisor>getEmployee2()
    {
        return employee2;
    }

    public ArrayList<Manager>getEmployee3()
    {
        return employee3;
    }

    public int getDay()
    {
        return day;
    }

    public void setDay(int day)
    {
        this.day = day;
    }

    public boolean getShift()
    {
        return shift;
    }


    public boolean productionGoals()
    {
        Scanner keyboard = new Scanner(System.in);
        System.out.println("met goals? yes or no");
        String line = keyboard.nextLine();
        if(line.trim().toLowerCase().equals("no"))
        return false;
        return true;
    }

    public boolean getProductionGoals()
    {
        return metProductionGoals;
    }

    public boolean equals(Shift otherShift)
    {

            if(employee.equals(otherShift.getEmployee()))
            if(employee2.equals(otherShift.getEmployee2()))
            if(employee3.equals(otherShift.getEmployee3()))
                if(metProductionGoals ==(otherShift.getProductionGoals()))
                if(day == (otherShift.getDay()))
                if(shift == (otherShift.getShift()))
                return true;


    return false;
}

    /**
     * An example of a method - replace this comment with your own
     *
    // * @param  y   a sample parameter for a method
     * @return     the sum of x and y
     */
  public String toString()
    {
         return ((day0 + " " + shiftDay0  + " " + employee + " " + employee2 + " " + employee3 + " " + (metProductionGoals ? " met goals " : " did not meet goals ")));
    }

public String shiftDay()
{
Scanner keyboard = new Scanner(System.in);
System.out.println("day or night");
String line = keyboard.nextLine();
if(line.trim().toLowerCase().equals("night"))
return "night";
else return "day";
}

    }



 class TestEmployeeProductionWorker
{
    // instance variables - replace the example below with your own
    protected Random generator;
    protected ArrayList<ProductionWorker> ProductionEmployees;
    protected static String[] names = {"Ryan","Jones","Brown","Peter","Emma","Jennifer","Courtney",
    "Ross","Joe","Chandler","Ruth","Stewart","Monica","Rachel","Stewie","Chris","Meg","Louis",
    "Cleveland","Quagmire"};
    protected static double minHourlySalary = 6.00;
    protected static double maxHourlySalary = 50.00;
    protected static double maxWeeklySalary = 10000.00;
    /**
     * Initializes an ArrayList of 20 employees to a reasonable but random values
     * (you may use class Random to generate the values).
     */
    public TestEmployeeProductionWorker()
    {
        ProductionEmployees = new ArrayList<ProductionWorker>();
        for(int i = 1; i <= 20; i++)
        {
            ProductionEmployees.add(getProductionWorker());
        }
     System.out.println(ProductionEmployees);
    }

    public static ProductionWorker getProductionWorker()
    {

    Random generator = new Random();
    String name = names[generator.nextInt(names.length)];
    String eNumber = Employee.employeeNumber();
    int yearHired = 2011-generator.nextInt(35);
    double hourlySalary = minHourlySalary + Math.random()*(maxHourlySalary-minHourlySalary);
    double weeklySalary = maxWeeklySalary - Math.random()*(maxWeeklySalary);
    ProductionWorker pw = new ProductionWorker(name, eNumber, yearHired, hourlySalary, weeklySalary);
    return pw;
    }
 }

Open in new window



Output:
Production Worker [

Name: 	Joe
   ID:     	410-L
   Year Hired:	1984
   WeeklySalary:	$5700.83
 Hourly Salary:	$13.80, 

Name: 	Ryan
   ID:     	961-G
   Year Hired:	1986
   WeeklySalary:	$3842.05
 Hourly Salary:	$19.43, 

Name: 	Monica
   ID:     	251-J
   Year Hired:	1979
   WeeklySalary:	$648.55
 Hourly Salary:	$31.57, 

Name: 	Stewie
   ID:     	426-F
   Year Hired:	1989
   WeeklySalary:	$9183.56
 Hourly Salary:	$33.39, 

Name: 	Rachel
   ID:     	535-F
   Year Hired:	2004
   WeeklySalary:	$5088.68
 Hourly Salary:	$49.11, 

Name: 	Stewie
   ID:     	893-G
   Year Hired:	2009
   WeeklySalary:	$1105.04
 Hourly Salary:	$35.00, 

Name: 	Stewart
   ID:     	328-E
   Year Hired:	1986
   WeeklySalary:	$335.40
 Hourly Salary:	$28.34, 

Name: 	Quagmire
   ID:     	335-M
   Year Hired:	1978
   WeeklySalary:	$4954.05
 Hourly Salary:	$44.14, 

Name: 	Brown
   ID:     	412-K
   Year Hired:	2002
   WeeklySalary:	$5524.95
 Hourly Salary:	$43.80, 

Name: 	Stewart
   ID:     	846-E
   Year Hired:	1988
   WeeklySalary:	$8564.57
 Hourly Salary:	$38.08]
Shift Super Visor [

Name: 	Austin
   ID:     	009-M
   Year Hired:	2004
   WeeklySalary:	$1483.16
 YearlySalary:	$60161.16
Goals:	18, 

Name: 	Hope
   ID:     	330-L
   Year Hired:	2003
   WeeklySalary:	$3221.26
 YearlySalary:	$72837.50
Goals:	5, 

Name: 	Noah
   ID:     	452-L
   Year Hired:	2003
   WeeklySalary:	$8770.59
 YearlySalary:	$52723.42
Goals:	21, 

Name: 	Isaac
   ID:     	898-D
   Year Hired:	2008
   WeeklySalary:	$8363.34
 YearlySalary:	$47451.36
Goals:	32, 

Name: 	Noah
   ID:     	716-H
   Year Hired:	1977
   WeeklySalary:	$1362.83
 YearlySalary:	$58697.03
Goals:	23, 

Name: 	Isaac
   ID:     	418-G
   Year Hired:	2001
   WeeklySalary:	$2102.19
 YearlySalary:	$50864.35
Goals:	11, 

Name: 	William
   ID:     	420-J
   Year Hired:	2003
   WeeklySalary:	$3794.21
 YearlySalary:	$71213.31
Goals:	29, 

Name: 	William
   ID:     	748-I
   Year Hired:	2004
   WeeklySalary:	$4853.51
 YearlySalary:	$43644.37
Goals:	12, 

Name: 	Austin
   ID:     	401-E
   Year Hired:	1979
   WeeklySalary:	$6143.17
 YearlySalary:	$57712.32
Goals:	28, 

Name: 	William
   ID:     	712-K
   Year Hired:	2001
   WeeklySalary:	$3980.10
 YearlySalary:	$61624.41
Goals:	15]
Manager [

Name: 	Charlotte
   ID:     	301-M
   Year Hired:	2009
   WeeklySalary:	$1113.52
 YearlySalary: 	$71064.29
 Department: 	Marketing, 

Name: 	Charlotte
   ID:     	641-G
   Year Hired:	2000
   WeeklySalary:	$3105.24
 YearlySalary: 	$86786.84
 Department: 	Accounting, 

Name: 	Liam
   ID:     	566-H
   Year Hired:	2006
   WeeklySalary:	$3873.78
 YearlySalary: 	$113519.55
 Department: 	Marketing, 

Name: 	Ethan
   ID:     	757-B
   Year Hired:	2007
   WeeklySalary:	$4104.14
 YearlySalary: 	$65567.97
 Department: 	Research, 

Name: 	Caitlyn
   ID:     	821-J
   Year Hired:	1998
   WeeklySalary:	$4259.68
 YearlySalary: 	$96526.38
 Department: 	Production, 

Name: 	Ethan
   ID:     	732-B
   Year Hired:	2007
   WeeklySalary:	$948.35
 YearlySalary: 	$64308.25
 Department: 	Accounting, 

Name: 	Liam
   ID:     	365-K
   Year Hired:	1980
   WeeklySalary:	$3578.94
 YearlySalary: 	$119447.46
 Department: 	PayRoll, 

Name: 	Charlotte
   ID:     	089-B
   Year Hired:	2003
   WeeklySalary:	$4223.70
 YearlySalary: 	$99114.20
 Department: 	Production, 

Name: 	Sophia
   ID:     	488-I
   Year Hired:	2011
   WeeklySalary:	$5037.88
 YearlySalary: 	$98750.55
 Department: 	Research, 

Name: 	Mason
   ID:     	038-D
   Year Hired:	2006
   WeeklySalary:	$5036.36
 YearlySalary: 	$117817.53
 Department: 	Accounting]
 
 
 
Enter parameters for shifts 1-3: 
met goals? yes or no
no
day or night
day
met goals? yes or no
yes
day or night
night
met goals? yes or no
yes
day or night
night
--------------------------------------------------Shifts------------------------------------------------- 
Shift no. 1-------------------:
Sunday day [

Name: 	Joe
   ID:     	531-K
   Year Hired:	1996
   WeeklySalary:	$2963.38
 Hourly Salary:	$34.23, 

Name: 	Emma
   ID:     	894-A
   Year Hired:	1977
   WeeklySalary:	$9758.57
 Hourly Salary:	$25.37, 

Name: 	Rachel
   ID:     	031-L
   Year Hired:	1980
   WeeklySalary:	$1410.36
 Hourly Salary:	$44.59, 

Name: 	Joe
   ID:     	063-B
   Year Hired:	1982
   WeeklySalary:	$332.28
 Hourly Salary:	$8.47, 

Name: 	Meg
   ID:     	292-G
   Year Hired:	1993
   WeeklySalary:	$6595.15
 Hourly Salary:	$32.05] [

Name: 	William
   ID:     	952-F
   Year Hired:	1989
   WeeklySalary:	$7268.71
 YearlySalary:	$75475.37
Goals:	35, 

Name: 	Amelia
   ID:     	503-J
   Year Hired:	1999
   WeeklySalary:	$4842.82
 YearlySalary:	$63948.66
Goals:	26, 

Name: 	Hope
   ID:     	217-C
   Year Hired:	1982
   WeeklySalary:	$2811.38
 YearlySalary:	$77890.16
Goals:	9] [

Name: 	Charlotte
   ID:     	408-K
   Year Hired:	2002
   WeeklySalary:	$3989.00
 YearlySalary: 	$62655.91
 Department: 	Research, 

Name: 	Laine
   ID:     	047-D
   Year Hired:	1982
   WeeklySalary:	$208.56
 YearlySalary: 	$75753.49
 Department: 	Marketing, 

Name: 	Charlotte
   ID:     	930-C
   Year Hired:	1998
   WeeklySalary:	$4899.00
 YearlySalary: 	$77954.91
 Department: 	Marketing]  did not meet goals 
--------------------------
Shift no. 2-------------------:
Wednesday night [

Name: 	Jennifer
   ID:     	638-C
   Year Hired:	2000
   WeeklySalary:	$2922.38
 Hourly Salary:	$26.65, 

Name: 	Ruth
   ID:     	149-J
   Year Hired:	1990
   WeeklySalary:	$3908.45
 Hourly Salary:	$14.40, 

Name: 	Rachel
   ID:     	201-D
   Year Hired:	2002
   WeeklySalary:	$8162.87
 Hourly Salary:	$27.72, 

Name: 	Jones
   ID:     	700-F
   Year Hired:	2011
   WeeklySalary:	$7279.97
 Hourly Salary:	$40.41, 

Name: 	Chris
   ID:     	276-J
   Year Hired:	1990
   WeeklySalary:	$2878.21
 Hourly Salary:	$27.79] [

Name: 	Noah
   ID:     	429-I
   Year Hired:	2000
   WeeklySalary:	$7290.51
 YearlySalary:	$77628.17
Goals:	27, 

Name: 	Hollis
   ID:     	466-B
   Year Hired:	1993
   WeeklySalary:	$2978.19
 YearlySalary:	$72530.10
Goals:	28, 

Name: 	Amelia
   ID:     	174-I
   Year Hired:	1992
   WeeklySalary:	$7465.50
 YearlySalary:	$64749.39
Goals:	35] [

Name: 	Liam
   ID:     	898-M
   Year Hired:	1978
   WeeklySalary:	$3419.00
 YearlySalary: 	$105103.93
 Department: 	Accounting, 

Name: 	Mason
   ID:     	818-J
   Year Hired:	1981
   WeeklySalary:	$2861.33
 YearlySalary: 	$89473.21
 Department: 	PayRoll, 

Name: 	Charlotte
   ID:     	615-I
   Year Hired:	2000
   WeeklySalary:	$3264.28
 YearlySalary: 	$118900.02
 Department: 	Marketing]  met goals 
--------------------------
Shift no. 3-------------------:
Friday night [

Name: 	Peter
   ID:     	103-B
   Year Hired:	1992
   WeeklySalary:	$7327.62
 Hourly Salary:	$8.14, 

Name: 	Jennifer
   ID:     	098-B
   Year Hired:	1997
   WeeklySalary:	$9570.78
 Hourly Salary:	$45.54, 

Name: 	Louis
   ID:     	775-B
   Year Hired:	2004
   WeeklySalary:	$3949.08
 Hourly Salary:	$42.71, 

Name: 	Quagmire
   ID:     	864-G
   Year Hired:	2001
   WeeklySalary:	$2164.38
 Hourly Salary:	$14.37, 

Name: 	Stewart
   ID:     	555-F
   Year Hired:	2010
   WeeklySalary:	$524.31
 Hourly Salary:	$38.18] [

Name: 	Hollis
   ID:     	118-G
   Year Hired:	1977
   WeeklySalary:	$7343.41
 YearlySalary:	$68010.01
Goals:	21, 

Name: 	William
   ID:     	868-M
   Year Hired:	1993
   WeeklySalary:	$1625.13
 YearlySalary:	$76475.49
Goals:	19, 

Name: 	Amelia
   ID:     	887-I
   Year Hired:	2008
   WeeklySalary:	$1524.72
 YearlySalary:	$65077.17
Goals:	33] [

Name: 	Laine
   ID:     	680-C
   Year Hired:	2007
   WeeklySalary:	$4218.78
 YearlySalary: 	$100851.63
 Department: 	Accounting, 

Name: 	Sophia
   ID:     	961-B
   Year Hired:	1987
   WeeklySalary:	$5138.25
 YearlySalary: 	$64160.21
 Department: 	Production, 

Name: 	Mason
   ID:     	475-H
   Year Hired:	1984
   WeeklySalary:	$1645.80
 YearlySalary: 	$109875.41
 Department: 	Accounting]  met goals 
--------------------------

Open in new window

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses
Course of the Month15 days, 13 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question