Question

(PLEASE UPLOAD ALL PARTS TO THE QUESTION) (IE: PSEUDO CODE AND JAVA CODE TOGETHER NOT ONE...

(PLEASE UPLOAD ALL PARTS TO THE QUESTION) (IE: PSEUDO CODE AND JAVA CODE TOGETHER NOT ONE OR THE OTHER)

Design an Employee class that fields for the following pieces of information:

1) Employee name

2) Employee number

Next design a class named ProductionWorker that extends the Employee class.

The ProductionWorker class should have fields to hold the following information:

1) Shift number (an integer, such as 1, 2, or 3)

2)Hourly pay

The workday is divided into two shifts day and night. The shift field will hold an integer value representing the shift that the employee works. The day shift is "shift 1" and the night shift is "shift 2". Design the appropriate accessor and mutator methods for each class.

Once you have designed the classes, design a program that creates an object of the ProductionWorker class and prompts the user to enter data for each of the object's fields. Store data in the object and then the object's accessor methods to retrieve it and display it on screen.

(PLEASE UPLOAD ALL PARTS TO THE QUESTION) (IE: PSEUDO CODE AND JAVA CODE TOGETHER NOT ONE OR THE OTHER)

Your solution should include:

  1. Flowchart (Flowgorithm)

  2. Pseudo-code (Gaddis Pseudo-Code)

  3. Program Coded (Java Code that is converted from the Pseudo-Code)

Problem Statement

You should use either inheritance or polymorphism to obtain results in your program.  

Each set of data should be displayed in following form:

Name: John Smith
Employee Number: 12345
Shift: Day
Hourly Pay Rate: $1500

(PLEASE UPLOAD ALL PARTS TO THE QUESTION) (IE: PSEUDO CODE AND JAVA CODE TOGETHER NOT ONE OR THE OTHER)

0 0
Add a comment Improve this question Transcribed image text
Answer #1
Thanks for the question.

Below are the 3 classes you will be needing  . Also, attached the screenshot of the sample run.


Let me know if you have any doubts or if you need anything to change.

Thank You !

===========================================================================


public class Employee {

    private String employeeName;
    private int employeeNumber;

    public Employee() {
        employeeName = "";
        employeeNumber = 0;
    }

    public Employee(String employeeName, int employeeNumber) {
        this.employeeName = employeeName;
        this.employeeNumber = employeeNumber;
    }

    public int getEmployeeNumber() {
        return employeeNumber;
    }

    public String getEmployeeName() {
        return employeeName;
    }

    public void setEmployeeName(String employeeName) {
        this.employeeName = employeeName;
    }

    public void setEmployeeNumber(int employeeNumber) {
        this.employeeNumber = employeeNumber;
    }


}

=====================================================================


public class ProductionWorker extends Employee {


    private int shiftNumber;
    private double hourlyPay;

    public ProductionWorker() {
        super();
        shiftNumber = 3;
        hourlyPay = 0;
    }

    public ProductionWorker(String employeeName, int employeeNumber) {
        super(employeeName, employeeNumber);
        shiftNumber = 1;
        hourlyPay = 3;

    }

    public ProductionWorker(String employeeName, int employeeNumber, int shiftNumber, double hourlyPay) {
        super(employeeName, employeeNumber);
        this.shiftNumber = shiftNumber;
        this.hourlyPay = hourlyPay;
    }

    public String getShift() {
        return shiftNumber == 1 ? "Day" : "Night";
    }

    public double getHourlyPay() {
        return hourlyPay;
    }

    public void setShiftNumber(int shiftNumber) {
        this.shiftNumber = shiftNumber;
    }

    public void setHourlyPay(double hourlyPay) {
        this.hourlyPay = hourlyPay;
    }


}

=====================================================================


import four.Producer;

import java.util.Scanner;

public class DemoEmployee {

    public static void main(String[] args) {


        Scanner scanner = new Scanner(System.in);

        ProductionWorker pw = new ProductionWorker();

        System.out.print("Enter employee\'s name: ");
        String name = scanner.nextLine();

        System.out.print("Enter employee\'s number: ");
        int number = scanner.nextInt();

        System.out.print("Enter shift [1-3]: ");
        int shift = scanner.nextInt();

        System.out.print("Enter hourly pay rate: ");
        double rate = scanner.nextDouble();


        pw.setEmployeeName(name);
        pw.setEmployeeNumber(number);
        pw.setShiftNumber(shift);
        pw.setHourlyPay(rate);

        System.out.println("Name: "+pw.getEmployeeName());
        System.out.println("Employee Number: "+pw.getEmployeeNumber());
        System.out.println("Shift: "+pw.getShift());
        System.out.println("Hourly Pay Rate: $"+pw.getHourlyPay());

    }
}

=====================================================================

Employee.javax ProductionWorker.java DemoEmployeejava int shift = scanner.nextInt (); 23 24 System. out.print(Enter hourly p

=============================================================================

Thanks, let me know for any questions or in case you encounter any issue.


Please do give a thumbs up from your end : )

Add a comment
Know the answer?
Add Answer to:
(PLEASE UPLOAD ALL PARTS TO THE QUESTION) (IE: PSEUDO CODE AND JAVA CODE TOGETHER NOT ONE...
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
  • (PLEASE UPLOAD ALL PARTS TO THE QUESTION) (IE: PSEUDO CODE AND JAVA CODE TOGETHER NOT ONE...

    (PLEASE UPLOAD ALL PARTS TO THE QUESTION) (IE: PSEUDO CODE AND JAVA CODE TOGETHER NOT ONE OR THE OTHER) Design an Employee class that fields for the following pieces of information: 1) Employee name 2) Employee number Next design a class named ProductionWorker that extends the Employee class. The ProductionWorker class should have fields to hold the following information: 1) Shift number (an integer, such as 1, 2, or 3) 2)Hourly pay The workday is divided into two shifts day...

  • JAVA HELP Design a class named Employee. The class should keep the following information in fields:...

    JAVA HELP Design a class named Employee. The class should keep the following information in fields: Employee name Employee number in the format XXX–L, where each X is a digit within the range 0–9 and the L is a letter within the range A–M. Hire date then, Write one or more constructors and the appropriate accessor and mutator methods for the class. Next, write a class named ProductionWorker that extends the Employee class. The ProductionWorker class should have fields to...

  • Design a class named Employee. The class should keep the following information in

    WRITE IN C++ ONLY PLEASE. IM USING VISUAL STUDIO CODE.1. Employee and ProductionWorker ClassesDesign a class named Employee. The class should keep the following information in• Employee name• Employee number• Hire dateWrite one or more constructors and the appropriate accessor and mutator functions for the class.Next, write a class named ProductionWorker that is derived from the Employee class. The ProductionWorker class should have member variables to hold the following information:• Shift (an integer)• Hourly pay rate (a double )The workday...

  • Employee and ProductionWorker Classes DONE IN C# PLEASE Create an Employee class that has properties for...

    Employee and ProductionWorker Classes DONE IN C# PLEASE Create an Employee class that has properties for the following data: • Employee name • Employee number Next, create a class named ProductionWorker that is derived from the Employee class. The ProductionWorker class should have properties to hold the following data: • Shift number (an integer, such as 1, 2, or 3) • Hourly pay rate The workday is divided into two shifts: day and night. The Shift property will hold an...

  • C++ Lab 9B Inheritance Class Production Worker Create a project C2010Lab9b; add a source file Lab...

    C++ Lab 9B Inheritance Class Production Worker Create a project C2010Lab9b; add a source file Lab9b.cpp to the project. Copy and paste the code is listed below: Next, write a class named ProductionWorker that is derived from the Employee class. The ProductionWorker class should have member variables to hold the following information: Shift (an integer) Hourly pay rate (a double) // Specification file for the ProductionWorker Class #ifndef PRODUCTION_WORKER_H #define PRODUCTION_WORKER_H #include "Employee.h" #include <string> using namespace std; class ProductionWorker...

  • Create the Python code for a program adhering to the following specifications. Write an Employee class...

    Create the Python code for a program adhering to the following specifications. Write an Employee class that keeps data attributes for the following pieces of information: - Employee Name (a string) - Employee Number (a string) Make sure to create all the accessor, mutator, and __str__ methods for the object. Next, write a class named ProductionWorker that is a subclass of the Employee class. The ProductionWorker class should keep data attributes for the following information: - Shift number (an integer,...

  • PLEASE UPLOAD or Write a simple PSEUDO CODE AND JAVA CODE for this program WITH COMMENTS...

    PLEASE UPLOAD or Write a simple PSEUDO CODE AND JAVA CODE for this program WITH COMMENTS IN BOTH TELLING WHAT EACH PART DOES. (I NEED BOTH CODES NOT JUST ONE OR THE OTHER) Problem Statement A golf club has a small tournament consisting of five golfers every weekend. The club president has asked you to design a program that does the following: Reads player’s names and their scores from the keyboard for each of the five golfers and simulates writing...

  • Please answer the following question with Java Modify the Employee and ProductionWorker classes provided below so...

    Please answer the following question with Java Modify the Employee and ProductionWorker classes provided below so they throw exceptions when the following errors occur. - The Employee class should throw an exception named InvalidEmployeeNumber when it receives an employee number that is less than 0 or greater than 9999. - The ProductionWorker class should throw an exception named InvalidShift when it receives an invalid shift. - The ProductionWorker class should thrown anexception named InvalidPayRate when it receives a negative number...

  • java code Write a class called FractionObject that represents a fraction with an integer numerator and...

    java code Write a class called FractionObject that represents a fraction with an integer numerator and denominator as fields. A Fraction Object object should have the following methods: A constructor with int numerator, int denominator as parameters - Constructs a new fraction object to represent the ratio (numerator/denominator). The denominator cannot be 0, so output a message if O is passed and set the numerator and denominator to 1. A constructor with no parameters - Constructs a new FractionObject to...

  • write in java and please code the four classes with the requirements instructed You will be...

    write in java and please code the four classes with the requirements instructed You will be writing a multiclass user management system using the java. Create a program that implements a minimum of four classes. The classes must include: 1. Employee Class with the attributes of Employee ID, First Name, Middle Initial, Last Name, Date of Employment. 2. Employee Type Class that has two instances of EmployeeType objects: salaried and hourly. Each object will have methods that calculates employees payrol...

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