bartleby

Concept explainers

bartleby

Videos

Expert Solution & Answer
Book Icon
Chapter 8, Problem 9E

Explanation of Solution

 Implementation of the derived class “RegularPay”:

The implementation of the derived class “RegularPay” is given below:

  • • The “RegularPay” class is derived from the “PayCalculator” abstract class as discussed in previous question.
  • • Define the constructor.
    • ○ Call the “super” method with an argument.
  • • Define the main method,
    • ○ Create an object for the class “RegularPay”.
    • ○ Call the method with an argument and display the result.
    • ○ Change the input value and again call the method and display the result.

The creation of the abstract class “PayCalculator” is given below:

  • • Declare the “payRate” variable.
  • • Define the constructor.
    • ○ Set the value to the “payRate”.
  • • The “computePay” method is used to return the pay for a given amount of time.
  • • The “changeRate” method is used to set the new value to the pay rate.

 Program:

 Filename: “RegularPay.java”

//definition of "RegularPay" class

public class RegularPay extends PayCalculator

{

    //definition of constructor

    public RegularPay(Double rate)

    {

        //call the "super" method

        super(rate);

    }

    //definition of main method

    public static void main(String[] args)

    {

        //create an object for the class

        RegularPay x = new RegularPay(5...

Explanation of Solution

 Implementation of the derived class “HazardPay”:

The implementation of the derived class “HazardPay” is given below:

  • • The “HazardPay” class is derived from the “PayCalculator” abstract class as discussed in previous question.
  • • Define the constructor.
    • ○ Call the “super” method with an argument.
  • • Override the “computePay” method that returns the amount returned by the base class method multiplied by “1.5”.
  • • Define the main method
    • ○ Create an object for the class “HazardPay”.
    • ○ Call the method with an argument and display the result.
    • ○ Change the input value and again call the method and display the result.

The creation of the abstract class “PayCalculator” is given below:

  • • Declare the “payRate” variable.
  • • Define the constructor.
    • ○ Set the value to the “payRate”.
  • • The “computePay” method is used to return the pay for a given amount of time.
  • • The “changeRate” method is used to set the new value to the pay rate.

 Program:

 Filename: “HazardPay.java”

//definition of "HazardPay" class

public class HazardPay extends PayCalculator

{

    //definition of constructor

    public HazardPay(Double rate)

    {

        //call the "super" method

        super(rate);

    }

    // override the method

    public double computePay(double hours)

    {

        //call the "super" method

        return super.computePay(hours)* 1.5;

    }

    //definition of main method

    public static void main(String[] args)

    {

        //create an object for the class

        HazardPay x = new HazardPay(5...

Blurred answer
Students have asked these similar questions
Don't use chatgpt or any other AI
Don't use chatgpt or any other AI
Given a relation schema R = (A, B, C, D, E,G) with a set of functional dependencies F {ABCD BC → DE B→ D D→ A}. (a) Show that R is not in BCNF using the functional dependency A → BCD. (b) Show that AG is a superkey for R (c) Compute a canonical cover Fc for the set of functional dependencies F. Show your work. (d) Give a 3NF decomposition of R based on the canonical cover found in (c). Show your work. (e) Give a BCNF decomposition of R using F. Show your work.

Chapter 8 Solutions

Java: An Introduction to Problem Solving and Programming plus MyProgrammingLab with Pearson eText -- Access Card Package (7th Edition)

Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:9781305503922
Author:Patrick M. Carey
Publisher:Cengage Learning
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Introduction to Classes and Objects - Part 1 (Data Structures & Algorithms #3); Author: CS Dojo;https://www.youtube.com/watch?v=8yjkWGRlUmY;License: Standard YouTube License, CC-BY