Ask Question

Write a program named DemoJobs for Harold's Home Services. The program should instantiate several Job objects and demonstrate their methods. The Job class contains four data fields

+5
Answers (1)
  1. 25 August, 19:18
    0
    public class DemoJobs {

    public static void main (String[] args) {

    Job job1 = new Job ("New York",10.5, true, false);

    Job job2 = new Job ("New Jessy",15.5, true, false);

    Job job3 = new Job ("Ohio",12.5, true, true);

    Job job4 = new Job ("Califonia",10, true, false);

    Job job5 = new Job ("Denver",30, true, true);

    System. out. println ("The Hourly pay for Job at New York is "+job1. getJobHourlyPay ());

    System. out. println ("15.5 dollar/hour job is avalaible at "+job2. getJobLocation ());

    System. out. println ("The hourly pay for a senior role at Denver is "+job5. getJobHourlyPay ());

    }

    }

    The Job class is given in the explanation section with four data fields and with a constructor as well as a setter and getter for each field.

    Explanation:

    public class Job {

    private String jobLocation;

    private double jobHourlyPay;

    private boolean isFullTime;

    private boolean isSenior;

    public Job (String jobLocation, double jobHourlyPay, boolean isFullTime, boolean isSenior) {

    this. jobLocation = jobLocation;

    this. jobHourlyPay = jobHourlyPay;

    this. isFullTime = isFullTime;

    this. isSenior = isSenior;

    }

    public String getJobLocation () {

    return jobLocation;

    }

    public void setJobLocation (String jobLocation) {

    this. jobLocation = jobLocation;

    }

    public double getJobHourlyPay () {

    return jobHourlyPay;

    }

    public void setJobHourlyPay (double jobHourlyPay) {

    this. jobHourlyPay = jobHourlyPay;

    }

    public boolean isFullTime () {

    return isFullTime;

    }

    public void setFullTime (boolean fullTime) {

    isFullTime = fullTime;

    }

    public boolean isSenior () {

    return isSenior;

    }

    public void setSenior (boolean senior) {

    isSenior = senior;

    }

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write a program named DemoJobs for Harold's Home Services. The program should instantiate several Job objects and demonstrate their ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers