Implements an interface having three methods eat, travel, bark
Q: Implement a superclasS Person. Make two classes, Student and Instructor, that inherit from Person. A…
A: Programming instructions: Create a class Person. In a Person class, create required variables, a…
Q: Create an abstract class DiscountPolicy. It should have a single abstract method computeDiscount…
A: Question. Create an abstract class DiscountPolicy. It should have a single abstract method…
Q: Write a complete program for the description given below. Consider a Billing class that implements…
A: Note: Since you have not provided the language to write the code so I am using Java language to…
Q: Answer the question below using this UML diagram (this same diagram is used in multiple questions).…
A: The design, organization, and behavior of a system or application are represented visually in…
Q: Create an interface Wheel with methods setWheels (int c) and getWheels () and a class Vehicle with…
A: Create an interface Wheel with methods setWheels (int c) and getWheels () and a class Vehicle with…
Q: Implements an interface having three methods eat, travel, bark in class ANIMAL having three child…
A: Program Plan: Create an interface named Animal In that interface declare methods…
Q: Create an interface MessageDecoder that has a single abstract method decode(cipherText), where…
A: File name: “MessageDecoder.java” //create an interface public interface MessageDecoder {…
Q: Java Problem A shop sells beverages. A beverage has a brand, the ingredients, a codebar number,…
A: SUMMARY: -Hence, we discussed all the points.
Q: Create a Dog and a Cat class, each of which inherit from Animal. Each class should have a…
A: Programs are a set of lines of code that give the machine instructions. To complete those tasks,…
Q: Quadrilateral, Trapezoid, Parallelogram, Rectangle and Square. Use Quadrilateral as the base class…
A: Write an inheritance hierarchy for classes Quadrilateral, Trapezoid, Parallelogram, Rectangle and…
Q: Create a Visible interface with two methods: makeVisible and makeInvisible. Both methods should…
A: Hi. check below for the answer
Q: For a parking management system, use the Observer pattern to implement this interaction using Java…
A: For a parking management system, use the Observer pattern to implement this interaction using Java…
Q: Task: Implement a class ChessPiece with properties: color, isAlive, moveCount, and position (x, y…
A: Algorithm for Chess Tower Movement:1. Create a Position class to represent x, y coordinates.2.…
Q: Write an inheritance hierarchy of three-dimensional shapes. Make a top-level shape interface that…
A: INTRODUCTION: Subclass: Classes may be derived from one another in Java, just as they can in other…
Q: Create a class Animal Create a class Cat, and a class Dog, and a class Bearded Dragon which extend…
A: We need to write a Java code for the given scenario.
Q: Imagine you have two classes: Employee (which represents being an employee) and Ninja (which…
A: Given: Imagine you have two classes: Employee (which represents being an employee) and Ninja (which…
Q: Design an interface named Colorable with a voidmethod named howToColor(). Every class of a colorable…
A: File name: Geo.java //class Definition public class Geo { // Main method public static…
Q: Define a Polygon interface that has methods area() and perimeter(). Then implement classes for…
A: I attached the working code below, Please go through that code.
Q: a class to package that represents your new drivable type. That type should be something that is…
A: Given add a class to package that represents your new drivable type. That type should be…
Q: reate an interface Employee which has the attribute: rate, and the method getSalary(). 2. Implement…
A: A Java interface is a blueprint for a class. It has static constants and abstract methods.Java…
Q: Euler's totient function, also known as phi-function ϕ(n), counts the number of integers between 1…
A: The provided Python function implements Euler's totient function, also known as the phi-function…
Q: Write in java an abstract class Student that includes the following hidden attributes: id(int),…
A: Given: Write in java an abstract class Student that includes the following hidden attributes:…
Q: Implement a class RoachPopulation that simulates the growth of a roach population. The constructor…
A: class RoachPopulation{ private int population; //The constructor takes the size of the…
Q: Using JAVA Language Consider a Billing class that implements an interface Payable having a method…
A: Solution: //java Program: //Doctor.java //class Doctorpublic class Doctor { // Declaring Instance…
Q: Write the constructor method for class Circle which is a subclass of Shape class. Class Shape has…
A: The Circle class is defined as a subclass of the Shape class using the extends keyword. The Circle…
Q: Implement the Shape hierarchy -- create an abstract class called Shape, which will be the parent…
A: Here I have different classes as per the question. Shape class contains one abstract method…
Q: n Lab 02, the Account class was defined to model a bank account. An account has the properties…
A: Java program is given below
Q: Create two subclasses for checking and saving accounts.A checking account has an overdraft limit,…
A: Actually, UML stands for Unified Modeling Language.
Implements an interface having three methods eat, travel, bark in class
ANIMAL having three child classes cat, dog and tiger.
Step by step
Solved in 3 steps with 1 images
- Create an interface Wheel with methods setWheels (int c) and getWheels () and a class Vehicle with abstract methods getColor () and getBrand (). Now, create a concrete class Taxi with additional method setDriver (String name) that inherits both Wheel and Vehicle. (Note: Concrete classes don’t have any abstract method)Design an interface named Colorable with a voidmethod named howToColor(). Every class of a colorable object must implementthe Colorable interface. Design a class named Square that extendsGeometricObject and implements Colorable. Implement howToColor todisplay the message Color all four sides. The Square class contains adata field side with getter and setter methods, and a constructor for constructinga Square with a specified side. The Square class has a private double datafield named side with its getter and setter methods. It has a no-arg constructorto create a Square with side 0, and another constructor that creates a Squarewith the specified side.Draw a UML diagram that involves Colorable, Square, and GeometricObject.Write a test program that creates an array of five GeometricObjects. For eachobject in the array, display its area and invoke its howToColor method if it iscolorable.add a class to package that represents your new drivable type. That type should be something that is capable of being driven (speeding up and slowing down) and therefore a perfect candidate for a class that implements the actions in the Drivable interface.
- Create a Visible interface with two methods: makeVisible and makeInvisible. Both methods should accept no parameters and return a boolean value. Explain how a class may implement this interface.Java Problem A shop sells beverages. A beverage has a brand, the ingredients, a codebar number, price, production date and expiration date. A beverage belongs to a company that has a name, an address, a phone number and an email. The shop employees want to check automatically the stock of beverages. All expired or sold beverages need to be eliminated. Implement the Shop, Beverage and Company classes. Implement the needed interfaces and methods for the classes. The shop has a method which specifies how many times does each ingredient appear in the whole collection of beverages. Create a main method which tests the program with relevant data based on data which is read from a file and output the beverages which are out of stock in a file.Create an abstract class DiscountPolicy. It should have a single abstractmethod computeDiscount that will return the discount for the purchase ofa given number of a single item. The method has two parameters, countand itemCost.
- Implement the Shape hierarchy -- create an abstract class called Shape, which will be the parent class to TwoDimensionalShape and ThreeDimensionalShape. The classes Circle, Square, and Triangle should inherit from TwoDimensionalShape, while Sphere, Cube, and Tetrahedron should inherit from ThreeDimensionalShape.Each TwoDimensionalShape should have the methods getArea() and getPerimeter(), which calculate the area and perimeter of the shape, respectively. Every ThreeDimensionalShape should have the methods getArea() and getVolume(), which respectively calculate the surface area and volume of the shape. Every class should have a member variable containing its dimensions -- for example, the Circle class should have a member variable describing its radius, while the Triangle class should have three member variables describing the length of each side. Note that the Tetrahedron cass should describe a regular tetrahedron, and as such, should only have one member variable.Create a Driver class…Write in java an abstract class Student that includes the following hidden attributes: id(int), name(String), major(String) and grade(double), then create setter and getter for each of them. Write two classes that inherited from Student: ItStudent and ArtStudent. The grade for ItStudent is calculated as: grade = mid*0.30 + project*0.30 + final*40 and the grade for ArtStudent is calculated as: grade = mid*0.40 + report*0.10 + final*50. Crate main class that achieve the following:a. Create an array of some Student objects from both ItStudent and ArtStudent classes.b. Sort the Student objects by grade in descending order using functions.c. Save the sorted objects into file.Using JAVA Language Consider a Billing class that implements an interface Payable having a method getTotalPaymentAmount(). Besides this, you have a Doctor class with private instance variables (docID, docName, and docFee) and a public getDoc() method, Patient class with private instance variables (pName, pID, pDisease), Medicine class with private instance variables (medID, medName, medQty, medPrice), and MedicalTest class with private instance variables (testID, testName, testPrice). Each of these classes has the toString() method to display the information of its object. The Billing class is having "Has A" relationship with the other four classes (Doctor, Patient, Medicine, and MedicalTest) mentioned above. The getPaymentAmount() method of Billing class returns the total billing amount that includes doc fee, medicine cost, and medical test fee that a patient has to pay. After implementing these classes, you are required to do the following in the driver class: Create an ArrayList of…
- Define a class name ComparableCircle that extends Circle and implements Comparable interface. Draw the UML diagram and implement the compareTo() method to compare the circles on the basis of area. Write a test class to find the larger of two instances of ComparableCircle objects.Imagine you have two classes: Employee (which represents being an employee) and Ninja (which represents being a Ninja). An Employee has both state and behaviour; a Ninja has only behaviour. You need to represent an employee who is also a ninja (a common problem in the real world). By creating only one interface and only one class (NinjaEmployee), show how you can do this without having to copy method implementation code from either of the original classes.Create a class Animal Create a class Cat, and a class Dog, and a class Bearded Dragon which extend Animal. Add to your Animal class: Member: name Methods: Public Animal (String name) //constructor public void makes Sound () with the implementation printing out a generic animal sound. Next, override (add) the makes Sound() method to your Cat and Dog class, with the implementation specific to each animal (i.e, cat says purr..). Do not override the makesSound() for your Dragon (bearded dragons don't make sounds!) Note, you'll also need a constructor in each of your subclasses which calls super(name) to initialize the common 'name' member of Animal. Next (in your test harness) create a List of different Animals ( a couple cats, a dog, a dragon... ) and add these Animals to your list. Iterate through your list & call makeSound on each. (you should observe the makeSound method called will be: cat -> from Cat class, dog-> from Dog class, bearded Dragon -> from Animal class ) EC:…