A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

anonymous

  • one year ago

While Leafing through Internet sites i found this program, any one can help me to solve it by Java ? http://csee.wvu.edu/~abrady/cs110/docs/cs110-hw7.pdf

  • This Question is Closed
  1. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    So it uses the abstract class Worker public abstract class Worker { private String name; private int hoursWorked; private double hourlyRate; public Worker(String name, int hoursWorked, double hourlyRate) { setName(name); setHoursWorked(hoursWorked); setHourlyRate(hourlyRate); } protected final String getName() { return name; } private final void setName(String name) { this.name = name; } protected final int getHoursWorked() { return hoursWorked; } private final void setHoursWorked(int hoursWorked) { this.hoursWorked = hoursWorked; } protected final double getHourlyRate() { return hourlyRate; } private final void setHourlyRate(double hourlyRate) { this.hourlyRate = hourlyRate; } protected abstract double getWages(); }

  2. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    and payroll.txt which is as follows: Salaried,Wilson,40,6.87 Temporary,Jones,27,4.5 Hourly,Smith,45,5.55 Salaried,Miller,30,7.33 Hourly,Walker,55,5.5 Salaried,Turner,45,8.24 Hourly,Best,35,7.99 Temporary,Johnson,8,4.99 Hourly,Struthers,42,6.49 Hourly,Monson,40,5.99

  3. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    So first let's examine the Worker class: So you have an interface class called worker, with 3 variables (name, hoursWorked, hourlyRate), a constructor method (called Worker), and 6 other methods (getter/setter methods). And finally there is an abstract method (an interface) called getWages(). A Protected method can only be called within the inheritance hierarchy. Public methods can be called from anywhere.

  4. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Next, you are given the following INSTRUCTIONS: Write a program to model three different kinds of employees in a company using inheritance and File I/O. Your program will consist of three classes that extend the class Worker and a testing class Company that reads in payroll information from a file then prints it to the screen. The Classes SalariedWorker, HourlyWorker, and TemporaryWorker: To model employees, extend the provided abstract class Worker by writing three new classes: SalariedWorker,HourlyWorker, and TemporaryWorker. //program to model three different kinds of employees public class SalariedWorker extends Worker { } public class HourlyWorker extends Worker{ } public class TemporaryWorker extends Worker{ }

  5. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    You are given the following instructions for a Company class: Your program will consist of ...a testing class Company that reads in payroll information from a file then prints it to the screen. so we need a new class called company //new Company class public class Company{ //your method to read in payroll info from a file and print it to the screen will go here } Next you are told: Create a class called Company with a main method to test your classes. So, slight alteration to the above: //new Company class public class Company{ //main method public static void main(String[] args){ //code to read in payroll info from a file and print it to the screen will go here } }

  6. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Now it says: " Implement the abstract methods as required." So here, they are talking about the getter setter methods from the Worker interface class I mentioned before. Another important thing they say is: "only write methods that override methods from either Worker or Object." which allows you to over-ride the methods in the Worker class.

  7. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.