Limited access

Upgrade to access all content for this subject

Consider the following classes.

    public abstract class ConstructionWorker 
    {
        private String name;
        private double hourlyWage;
        private int numHours;

        public ConstructionWorker(String nam, double wage, int hrs)
        {
            name = nam;
            hourlyWage = wage;
            numHours = hrs;
        }

        public double getHourlyWage()
        {
            return hourlyWage;
        }

        public int getNumHoursOnJob()
        {
            return numHours;
        }

        public String getWorkerName()
        {
            return name;
        }

        public void setHourlyWage(double newWage)
        {
            hourlyWage = newWage;
        }

        public abstract ArrayList<String> determineValidJobs();

        // other data and methods not shown
    }

    public class Roofer extends ConstructionWorker 
    {
        public Roofer(String nam, double wage, int hrs)
        {
            super(nam, wage, hrs);
        }

        public ArrayList<String> determineValidJobs()
        {
            // implementation not shown
        }

        public void setHourlyWage(double wage)
        {
            if (wage >= getHourlyWage())
                super.setHourlyWage(wage);
        }

        public void installRoof()
        {
            // Implementation not shown
        }

        // other data and methods not shown
    }

Which roofers will have an hourly wage of $12.00 after executing the following segments of code?

    ConstructionWorker jim = new Roofer("Jim", 12.00, 40);
    jim.setHourlyWage(10.00);

    ConstructionWorker katy = new Roofer("Katy", 12.00, 40);
    katy.setHourlyWage(12.00);

    ConstructionWorker fred = new Roofer("Fred", 12.00, 40);
    fred.setHourlyWage(15.00);
A

Katy only.

B

Jim and Katy only.

C

Katy and Fred only.

D

Jim and Fred only.

E

Jim, Katy, and Fred.

Select an assignment template