Question: Modify the Firm example such that it accomplishes its polymorphism using an interface called Payable.
I got an error (attached image). How can I solve it?
Firm.java:
public class Firm
{
//-----------------------------------------------------------------
// Creates a staff of employees for a firm and pays them.
//-----------------------------------------------------------------
public static void main (String[] args)
{
Staff personnel = new Staff();
personnel.payday();
}
}
Clark.java:
public class Clark implements Payable
{
public static void main (String[] args)
{
public void wages();
{
System.out.println("Wages can be paid to the clerks");
}
}
}
Payable.java:
public interface Payable {
public void wages();
}
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 4 images
- USING JAVA: Part A) Implement a superclass Appointment and subclasses Onetime, Daily, and Monthly. An Appointment has a description (for example, “See the dentist”) and a date. Write a method, occuresOn(int year, int month, int day) The check whether the appointment occurs on that date. For example, for appointment, you must check whether the day of the month matches. This fill an array of Appointment objects with a mixture of appointments. Have the user enter a date and print out all appointments that occur on that date. Part B) Improve the appointment book by giving the user the option to add new appointments. The user must specify the type of the appointment, the description, and the date.arrow_forwardPlease answer question. This is pertaining to Java programming language 3-20arrow_forwardConstructor overloading is not possible in java.True or False.arrow_forward
- USING JAVA Write these: An interface called Shape that has two methods: area and perimeter. A class Rectangle that implements Shape and has a length and a width. A class Circle that implements Shape and has a radius. For each class, write the needed constructors, getters, setters, and a toString method that stringifies the instance variables in a readable format. Supply a test program that instantiates an instance of each class and exercises each method defined for the class.arrow_forwardI got an error message that says the grid item is not abstarct. Error message: /GridItem.java:2: error: GridItem is not abstract and does not override abstract method containsPoint(int,int) in GridItempublic class GridItem { ^./Square.java:12: error: cannot find symbol return xValue >= x && ^ symbol: variable xValue location: class Square./Square.java:13: error: cannot find symbol xValue <= x + side && ^ symbol: variable xValue location: class Square ALSO THE GRIDWRITER CLASS YOU WROTE IS DIFFERENT FROM THE ONE GIVEN FOR THE HOMEWORK. PLEASE SEE BELOW public class GridWriter { private GridItem items[]; private int size; private int rows; private int columns; private static final int INITIAL_CAPACITY = 4; /**** * Create a new GridWriter. It is initially empty. It has the capacity * to store four GridItems before it will need to double its array size. * The row and column arguments are used in the display…arrow_forwardGiven the following code and instructions:Is the provided implemented correctly for said instructions?The main class Ride contains: public abstract boolean ableToRun(int numberofRuns);public abstract boolean checkRide(String[] components);public abstract double costPerPassenger(int numberOfStops);arrow_forward
- Hi, can i get assistance with this book class in Java please? The comments with the "TODO" is what I need assistance with, thank you! The author class is attached to the question in case there is any relevance for it. public class Book {private String title;private double averageRating;private String ISBN;private int numPages;// TODO: insert an appropriate collection for associating Authors and initialise within constructors public Book(){} public Book(String title, double averageRating, String isbn, int numPages){ this.title = title;this.averageRating = averageRating;this.ISBN = isbn;this.numPages = numPages;}//accessorspublic String getTitle(){return title;}public double getAverageRating(){return averageRating;}public String getISBN(){return ISBN;}public int getNumPages(){return numPages;}// TODO: provide an accessor for the book collection public String getAuthorList(){String authorList ="";// TODO: insert code to return all author names separated by commas if multiple authorsreturn…arrow_forwardFirst, you need to design, code in Java, test and document a base class, Student. The Student class will have the following information, and all of these should be defined as Private: A first name (given name) A last name (family name/surname) Student number (ID) – an integer number (of type long) The Student class will have at least the following constructors and methods: (i) two constructors - one without any parameters (the default constructor), and one with parameters to give initial values to all the instance variables of Student. (ii) only necessary set and get methods for a valid class design. (iii) a reportGrade method, which you have nothing to report here, you can just print to the screen a message “There is no grade here.”. This method will be overridden in the respective child classes. (iv) an equals method which compares two student objects and returns true if they have the same student number (ID), otherwise it returns false. You may add other…arrow_forwarda:) Define a Polygon interface that has methods area() and perimeter(). b:) Then implement classes for Triangle, Quadrilateral, Pentagon, Hexagon, and Octagon, which implement this interface, with the obvious meanings for the area() and perimeter() methods. c:) Implement classes, IsoscelesTriangle, Equilateral-Triangle, Rectangle, and Square, which have the appropriate inheritance relationships. d:) Write a simple user interface, which allows users to create polygons of the various types, input their geometric dimensions, and then output their area and perimeter. e:) For extra effort, allow users to input polygons by specifying their vertex coordinates and be able to test if two such polygons are similar. using all a to e parts develop a programarrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education