Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java programming help needed Question 41 20 pts Define an interface called Shape that requires methods to get x and y, and a method to

Java programming help needed

image text in transcribed
Question 41 20 pts Define an interface called Shape that requires methods to get x and y, and a method to calculate the area. Call these methods getX(), getYO, and getArea(). Write a class called MyRectangle that implements the Shape interface and contains: . The double data fields X, y, length, and width with get and set methods. A no-arg constructor that creates a default rectangle with 0 for both x and y, and 1 for both the length and width. A constructor that creates a rectangle with the specified X, y, length and width. A method getX() that returns the x location value of the rectangle. A method getY() that returns the y location value of the rectangle. A method getArea() that returns the area of the rectangle. B I U A . A . L E B B B E X' X E - & Vx & GT 12pt Paragraph 0 words Question 42 20 pts Design a class named Person. A person has a name and a phone attribute. Now, design a subclass named Employee (child class of Person). An employee has the inherited attributes plus a salary attribute. Create Staff as a subclass of Employee. A staff has the inherited attributes plus a title attribute. Remember to use the appropriate access types for the attributes. Only write the attributes and constructors. Constructors are required! For time, do not create the behaviors, getters or setters. I will assume that you would have created them given more time. Demonstrate that you can set up the inheritance relationship, including passing the information from the child constructor to the parent constructor. B I U A . A . I E B B B E X' X E . & Vx & GT 12pt Paragraph

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions