Create an abstract class named Monster. It should contain a single abstract method, areaOfDestruction, which returns a double. Create a class named Robot that extends Monster. Implement the areaOfDestruction() method inherited from Monster, but don't add any logic yet. Just retum 0. Robot should have three private member variables, X, y, and power. Set those in the constructor.
Q: Our AbstractHashMap class maintains a load factor λ ≤ 0.5. Reimplement that class to allow the user…
A: Answer is given below .
Q: Let’s build a Player Portfolio System that has interface and abstract classes. Inheritance using…
A: In this problem, we will develop Player Portfolio System in Java language.
Q: A subclass of an abstract class must implement all of the parent class's abstract methods. Is it…
A: When an abstract class is subclassed, the subclass usually provides implementations for all of the…
Q: Consider classes A, B and C, where A is an abstract superclass, в is a concrete class that inherits…
A: As per the question statement, We need to find the correct statement for the given question…
Q: rewrite the following class code to make employeeType as an abstract class, if you know that both…
A: In C++, an abstract class is one that contains one or more than one pure virtual function (a…
Q: Given: abstract class A{ int a; int b; } class B extends A{ int a; } O cannot make class A abstract…
A: Answer 1: A- cannot make class A abstract Abstract classes can not be instantiated.
Q: Create NFL Player and NBA Player concrete classes that will extend Player abstract class. Create a…
A: Below is the code in java and sample output:
Q: 1) Write an abstract class Vehicle - Data members: numWheels - Constructor: initialize numWheels -…
A: abstract class Vehicle{ private int numWheels; public Vehicle(int numWheels) {…
Q: with an abstract method ‘fareCharged()’. $10, $15 and $20 are the fares charged by Bus, Auto and Cab…
A: Create an abstract class ‘Fares’ with an abstract method ‘fareCharged()’. $10, $15 and $20 are…
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: Create an abstract class ‘Fares’ with an abstract method ‘fareCharged()’. $10, $15 and $20 are the…
A: Note: since programming languages is not specified. we are providing solution in java. please repost…
Q: When would you utilize an abstract class? when you require a super class that shouldn't be…
A: An abstract class can be defined as a class that is not supposed to have objects of it's own. The…
Q: You only can instantiate concrete classes, not abstract ones. But you can extend abstract classes as…
A: this statement is true You can only instantiate concrete classes, not abstract ones, but you can…
Q: 1. Write the class PolynomialNode that contains the fields coef and exp of type int and an attribute…
A: The PolynomialNode class contain 3 fields namely coef,exp of type integer and next of type…
Q: Given the following classes, answer the below questions. 1. Person (abstract class) that has the…
A:
Q: Assume we have the following classes in a polymorphic relationship. Employee SalaryEmployee…
A: Here we create class Employee with variables firstname ,initial, lastname of type char array and a…
Q: Write an abstract superclass encapsulating a vehicle: A vehicle has two attributes: its owner's name…
A: According to the information given:- We have to follow instruction in order to perform…
Q: When should an abstract class be used, when should an interface be used, and when should both be…
A: According to the provided information: We need to define the use of an abstract class, interface…
Q: You can make a class abstract by declaring it with keyword abstract. An abstract class normally…
A: An abstract class is a class which can have 0 or more abstract methods An abstract class is declared…
Q: In this Assignment you will use an abstract class to define, read, store, and print questions for a…
A: The objective is to write the code of program and create a class to define, read, store, and print…
Q: In this assignment you are to implement OOP principles you learned in a single mini project. 1.…
A: PROGRAM EXPLANATION: Create an interface Measurable. Define a single abstract method in this…
Q: Given the following definitions: public abstract class Manager extends Employee { ... } public class…
A: Introduction: Class is one of the concepts in the object-oriented programming paradigm and it’s…
Q: QI. Inheritance System A/ Write the java code of the interface IComputer that contains the…
A: Here is the approach : In order to provide part C and D we need to develop the PArt A and B it is…
Q: create a uml class diagram on this code: from abc import ABC, abstractmethod class…
A: ABC implementation is not given and thus just class implementation is shown
Q: The parent class is A, and its subclasses are B and C. Now, B and C share several characteristics…
A: Introduction: Abstraction is a technique for concealing some implementation details from the user.…
Q: If you could solve please contact me to send continuation of the task
A: EXPLANATION OF THE PROGRAM: Make a Measurable interface. In this interface, define a single…
Q: 1. Can you declare a class that contains abstract methods a non-abstract class? 2. Can you declare…
A: 1. No, the abstract methods can't be declared in non abstract class, it is the same reason you can't…
Q: Write an abstract super class encapsulating a vacation: A vacation has one attribute: a destination.…
A: So lets determine the information that we have from the above question : Abstract class - Vacation ,…
Q: Use the concept of polymorphism and classes to represent the following analogy: A Transportation…
A: public class Transportation { //declaring instance variables private String model; private int…
Q: When would you be most likely to use an abstract class? when you need to derive a class from…
A: An abstract class is most likely to be used when a superclass is required that should be not be…
Q: i. When inheriting an Interface from an Interface, the newly created Interface should include all…
A: ANSWER : Option a is correct answer. Classes cannot inherit from an interface, since an interface is…
Q: To implement an interface, a concrete class must implement AT LEAST ONE method heading
A: The answer:
Q: An object can be created from an abstract class is it true or false
A: Ans : False that An object can be created from an abstract class.
Q: Which of the following are incorrect? (Choose all that apply A. You may declare a final abstract…
A: We cannot make an abstract class as final because as we know a final class cannot be subclassed and…
Q: 1. Define an interface Measurable. It has a single abstract method: double getArea(); 2. Define an…
A: PROGRAM EXPLANATION: Create an interface Measurable. Declare an abstract method in this interface.…
Q: Write an abstract class Student that includes the following hidden attributes: id(int),…
A: Please give positive ratings for my efforts. Thanks. PROGRAM import java.util.*; import…
Q: Create an abstract class named capstone with necessary abstract methods in Package 1 and define…
A: 1. create an abstract class to let the other class know.2. create base class which extends the…
Q: ds in an abstract class must be overriden and implemented classes only become useful when we create…
A: Answer is given below.
Q: Create a class called "Triangle", which is inherited from "TwoDimensionShape" abstract class. The…
A: public class Main{ public static void main (String[] args) { Triangle t1=new…
Q: A is a parent class whereas B and C are subclasses of A. Now, B and C share some common attributes…
A: Abstraction is a way to hide certain details of the implementation from the user. Both abstract…
Q: B and C are its subclasses, and A is the parent class. Now, B and C have certain similar features…
A: Abstraction is a method for concealing some implementation details from the user. Both abstract…
Q: Create a base class, cell phone and derive a class smartphone from it. In cell phone, create…
A: Abstract classes are parent classes or base classes. Abstract classes contain the common…
Q: Which of the following statements is TRUE about abstract classes in Java? A. An abstract class…
A: An abstract method is a method which has only declaration and definition is provided in some other…
Q: Write the following four classes to practice using an abstract class and polymorphism. Submit all…
A: The following points can be followed to create the mentioned four classes: Use abstract keyword to…
Q: Suppose a C++ project has classes Vehicle, Car, and Toyota, with the following 3-level inheritance…
A: Option A would not be the correct option because the call to vehicle constructor would be called the…
Q: Class A is composed of objects of class B, class B is extended by C & D. There should be a copy…
A: Explanation: A is composed of objects of class B, so it does not need a copy constructor. B is…
Q: Please answer number 1 with the subparts as they are linked altogether. 1. Create a class Vehicle.…
A: Please answer number 1 with the subparts as they are linked altogether. 1. Create a class Vehicle.a.…
Step by step
Solved in 2 steps with 1 images
- Answer the given question with a proper explanation and step-by-step solution. The base class Pet has protected fields petName, and petAge. The derived class Cat extends the Pet class and includes a private field for catBreed. Complete main() to: create a generic pet and print information using printInfo(). create a Cat pet, use printInfo() to print information, and add a statement to print the cat's breed using the getBreed() method.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)What is an abstract class? Choose only one option.(a) An object(b) A class with no methods.(c) A class with no concrete subclasses.(d) A class with at least one undefined message.(e) An interface.
- Write a generic class of Shape with the attribute of center and operation to calculate area. Inherit the classes of Circle, Triangle, and Square such that the operation to calculate area has dynamic late binding. Write these classes such that Shape is an abstract class whereas all others are concrete classesWhen would you be most likely to use an abstract class? when you need to derive a class from Object when every method in the class is concrete when you need a super class that should not be instantiated when you need a super class that can be instantiated alongside the derived classes =========== Which UML symbol represents aggregation? a filled triangle an unfilled diamond an unfilled triangle a filled diamondWrite an abstract class, it can be anything well defined from the very basics.
- Abstract classes and interfaces can both be used to specify common behavior of objects.How do you decide whether to use an interface or an abstract class? Explain youranswer.create a uml class diagram on this code: from abc import ABC, abstractmethod class GreyAnatomy(ABC):@abstractmethoddef Tvshow(self):pass class Grey(GreyAnatomy):def Tvshow(self):print("I am Derek") class Rank(Grey):def Tvshow(self):print("I am an attending") class Specialty(Rank):def Tvshow(self):print("I am an neurosurgeon doctor") G = Grey()G.Tvshow() R = Rank()R.Tvshow() S = Specialty()S.Tvshow()Write the abstract super class Transaction, and two of its subclasses, Payment and Sale (you do not need to supply any comments other than your name). I. Write an abstract superclass encapsulating a Transaction: The Transaction super class has an instance variable representing the customers name, and 3 methods: an overloaded constructor, a toString() method that returns a message including the name of the customer, and an abstract method called calculateAmount()which will be implemented in your subclasses. II. Write a non-abstract subclass that inherits from the Transaction class encapsulating a Payment: The Payment class has instance variable representing the payment amount received and 3 methods. It has an overloaded constructor, a toString() method that returns a message including customers name, the name of the class Payment, and the payment amount, an non-abstract class called calculateAmount() which returns the payment amount. III. Write a second…
- Write a class named Person with data attributes for a person’s name, address, and telephonenumber. Next, write a class named Customer that is a subclass of the Person class. TheCustomer class should have a data attribute for a customer number, and a Boolean data attributeindicating whether the customer wishes to be on a mailing list. Demonstrate an instance of theCustomer class in a simple program.Write a class named Employee which implements Comparable Interface with name and salary as data field. Add a constructor with argument name and salary. Add getter and Setter for name and salary. Add CompareTo() method for the data Name. Write a class named Manager which inherits the Employee class. Add an instance variable, named department, of type String. Add a constructor in the subclass class with arguments name, salary, department and a toString() method that prints the manager’s name, department, and salary [Hint: Add a toString( ) method in the super class as well] Create 3 objects of Manager with following arguments 1. (Zayed, 500), 2. ( Ahmed, 700) 3. ( Faisal, 600) Create an Array object Add the above 3 objects into an Array object and Sort by Name and Display Create an object Employee class with argument (Zayed, 500, IT) Display the 1. Name 2. Salary 3. Department by using tostring() method.1. Define an interface Measurable. It has a single abstract method: double getArea(); 2. Define an abstract class Shape which has two fields: type and name both of type Strin a. Provide constructor with a single input parameter: name. b. Provide accessor methods for both fields. C. Provide setter method for name. d. Provide toString() method that simply returns the "(type): (name)" e. Shape class implements Measurable interface without implementing its only abs method. 3.