In this homework, you will implement 4 classes using inheritance. Character is going to a be the superclass of 3 fictional character classes (elves, dwarves, giants, vampires, zombies, centaurs, dragons etc. ) of your choosing. Each subclass should have at least two constructors and twO extra properties of their own and getters/setters. Each subclass should also override printInfo() and quote() functions, they are all left to your imagination.
Q: Modify the class FitnessExperiment class so that it uses polymorphism to: (i) display the properties…
A: FitnessExperiment.java public class FitnessExperiment {FitnessTracker[] fitnessTrackers;public…
Q: Create the following classes based on the given declaration. Also, each class should have the…
A: Program DescriptionSince variables of vector type are to be declared we include the vector header…
Q: Our AbstractHashMap class maintains a load factor λ ≤ 0.5. Reimplement that class to allow the user…
A: Answer is given below .
Q: So, the problem is: Create a class named BloodData that includes fields that hold a blood type (the…
A: class BloodData{private String bloodType,RhFact; public BloodData(){bloodType = "O";RhFact = "+";}…
Q: The Fraction Class – Immutable Classes In this section, we’ll build another Fraction class that is…
A: I have created the fraction class as explained in the above . Created the toString() method…
Q: Consider a base class named Employee and its derived classes HourlyEmployee and PermanentEmployee…
A: #include<iostream>using namespace std; class Employee{ protected: int ID;…
Q: What does the super keyword represents and where can it be used? Give an example of a superclass and…
A: super is a keyword which is used to call the constructor of parent class or call any of the…
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: Draw an inheritance hierarchy for students at a university. Use Student as the superclass of the…
A: Parent class : Student Class extends student: UndrgraduateStudent GraduateStudent Class extends…
Q: Create a subclass of the Employee class from Question 2 named ShiftSupervisor. Add the salary and…
A: class ShiftSupervisor(Employee): def __init__(self, name, idnumber, salary, bonus):…
Q: (Implementing inheritance and apply the use of keyword super and this) Assume you have to develop a…
A: class GradedActivity{ int score; public int getScore() { return score; }…
Q: Design BDTeam class and AusTeam class which inherit from CricketTeam class so that the following…
A: Here I have created the class named BDTeam that inherits the class CricketTeam. In this class, I…
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: For this exercise, you will be completing the Account class, which simulates a regular bank account,…
A: Given, For this exercise, you will be completing the Account class, which simulates a regular bank…
Q: Create a subclass of the Employee class from Question 2 named ShiftSupervisor. Add the salary and…
A: class ShiftSupervisor(Employee): def __init__(self, name, idnumber, salary, bonus):…
Q: Suggest a simple scheme for creating a new class SafeMember that would allow us to export a…
A: Given: Suggest a simple scheme for creating a new class SafeMember that would allow us to export a…
Q: Write a class called quadratic that is derived from linear class to represents a quadratic equation…
A: The standard form of quadratic equation is cx^2+bx+a=0.Here, a, b and c are coefficients and the…
Q: Let’s analyze the game Tetris. That game had a lot of different pieces of various shapes and sizes.…
A: If I have to program one game Tetris so there are lots of logical approach to deal with it . In…
Q: Create an inheritance hierarchy of Rodent: Mouse, Gerbil, Hamster, etc. In the base class, provide…
A: As per our company guidelines, we are supposed to answer only one question per question and kindly…
Q: a new class SafeMember that would allow us to export a reference to a Member. The classes outside…
A: Suggest a simple scheme for creating a new class SafeMember that would allow us to export a…
Q: public class AClass extends BClass { Given the valid class declaration above, suppose both AClass…
A: a) AClass abc = new Bclass(); It can be done c) AClass abc = new AClass(); It can be done as class…
Q: Write an Employee class that keeps data attributes for the following pieces of information: •…
A: public class Employee { // declaring instance variables private String employeeName; private int…
Q: uggest a simple scheme for creating a new class SafeMember that would allow us to export a reference…
A: solution:
Q: What does the fox say? Ring-ding-ding-ding-dingeringeding
A: Answer is given below-
Q: Write an inheritance hierarchy of three-dimensional shapes. Make a top-level shape interface that…
A: Four shapes - cube, tetrahedron, cylinder and sphere - have been included. Since cube and…
Q: Deeper Class Design - the Square Class In this section, your job will be to write a new class that…
A: Given :- In this section, your job will be to write a new class that will adhere to the methods and…
Q: 2. Consider the BlackJackCard and PlayingCard classes. a)Do these two classes have an…
A: As per our guidelines, we are supposed to answer only 1st three parts. Kindly repost the remaining…
Q: Next, you will implement either the Cat or Dog Java class. Your class must meet all of the…
A: We need to implement either the Cat or Dog Java, class. The class must meet all the specifications…
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: I want the class, BasePlusCommissionEmployee, to contain a reference to a CommisionEmployee object.…
A: Actually, Java is an Object Oriented Programming language which is platform independent and robust…
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: Design Naruto class and MyHeroAcademia class which inherit from Anime class so that the following…
A: Coded using Python 3.
Q: If the programmer doesn't declare any constructors for an extended class, what constructors will be…
A: by bartleby guidelines i am able to do only first question.
Q: Define Employee class in package p1, with id, name and income fields. Define id and name as public,…
A: public members can be accessed in declared package as well as outside packages. So, get method for…
Q: bstract methods calculateArea() and calculateCircumference(). Both return doubles representing the…
A: In This we need to define the Shape ,Circle,Rectangle and Triangle classes as per the given…
Q: uggest a simple scheme for creating a new class SafeMember that would allow us to export a reference…
A: Scheme: Many accessor methods need to return values which are references to objects which represent…
Q: Suppose you are working on a project managing the bus fare of Dhaka metropolitan city. At this point…
A: Answer: Our instruction is answer the first three part from the first part I have done code as well…
Q: For this exercise, you will be completing the Account class, which simulates a regular bank account,…
A: LOGIC: The given problem will have below three classes: a) Account.java: A base class to hold…
Q: Consider a base class named Employee and its derived classes HourlyEmployee and PermanentEmployee…
A: Code: #include <iostream> using namespace std; // class BankAccount class BankAccount{…
Q: Implement following classes (this is inheritance hierarchy, you can ignore creating inheritance for…
A: I have added the class implementation code of c++. If you want to change anything in the code or if…
Q: Consider a class BankAccount that has • Two attributes i.e. accountID and balance and • A function…
A: Code: #include <iostream> using namespace std; // class BankAccountclass BankAccount{ //…
Q: Suppose you want to have a Tractor class that implements the Comparable interface so that you can…
A: In java if we inherit interface then use this syntax public class class_name implements…
Q: In this exercise you will debug a class hierarchy, which consists of the classes Farm, Farmer,…
A: Animal.java public class Animal { private String name;public Animal(String n){ name = n;} public…
Q: .Create a complete UML diagram which shows the relationships between the three classes, Account,…
A: Below is the solution
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: Implement the design of the CSE and EEE classes that are derived from the Department class so that…
A: Algorithm: Start Implement CSE class which inherits Department class Implement constructor which…
Q: Use the parent classes to the left to help you solve this problem. The first parent is the Person…
A:
Q: Design TomCruise class and DulquerSalman class which inherit from Actor class so that the following…
A: Here in the class Actor, I ahve defined the function named add_movie() that takes a list as input…
Trending now
This is a popular solution!
Step by step
Solved in 7 steps with 2 images
- Implement all the classes using Java programming language from the given UML Class diagram. Note: This problem requires you to submit only one class: Ball.java. Do NOT include "public static void main()" method inside all of these classes. Graders will be testing your classes, using the unit-testing framework JUnit 4. A class called Ball is designed as shown in the class diagram. The Ball class contains the following private instance variables: x, y and radius, which represent the ball's center (x, y) co-ordinates and the radius, respectively. xDelta (Δx) and yDelta (Δy), which represent the displacement (movement) per step, in the x and y direction respectively. The Ball class contains the following public methods: A constructor which accepts x, y, radius, speed, and direction as arguments. For user friendliness, user specifies speed (in pixels per step) and direction (in degrees in the range of (-180°, 180°]). For the internal operations, the speed and direction are to be…Convert the UML class diagram above into a java code with the following conditions The methods in the Pet class are abstract. Create a class called test. The main() method in the test class should create three Cat objects and two Budgie The main() method should also create indirectly an object of the Pet class. Demonstrate polymorphism in your testComputer Science There are clearly some similarities in the implementations of Taxi and Shuttle that suggest use of inheritance to represent them. Introducing inheritance is the primary task of this assessment. -The Ezcab class, The Ezcab class maintains separate lists of taxis and shuttles and destinations with destination fares (you can hardcode destination fares). It has a lookup method that searches for a taxi/shuttle with a given ID. -The Taxi and Shuttle classes share some common attributes – location and destination. They also have some common methods – getLocation, getDestination, getStatus and setDestination. -Vehicle is the superclass of both Taxi and Shuttle. This class involves placing the common fields and methods into Vehicle and removing them from Taxi and Shuttle. -Modify Taxi and Shuttle class to indicate that it is a subclass of Vehicle. You can keep the id field in Vehicle class and getId,SetId methods. -Arrange for Taxi's constructor to call the constructor of…
- Draw an inheritance hierarchy for students at a university. Use Student as the superclass of the hierarchy, then, extend Student with classes Undergraduate Student and Graduate Student. Continue to extend the hierarchy as deep (i.e., as many levels as possible). For example, Freshmen, Sophomore, Junior, and the Senior might extend Undergraduate Student and Doctoral Student and Masters Student might be subclasses of Graduate Students. After drawing the hierarchy, discuss the relationships that exist between the classes. [Note: You do not need to write any code for this exercise].Implement the following concepts by constructing suitable classes in Java -a. Constructorsb. Constructor Overloadingc. Function Overloadingd. Function Overridinge. InheritanceCreate a class Person - Field - Name, Birthdate, Contact no and Mail idMethods - Constructor, accept and displayClass Employee - Inherits the Person classFields : Emp ID, grade, basic salary, Gross Salary, HRA (House Rent Allowance), TA (TravelingAllowance), DA (Dearness Allowance)Given:Grade Basic TAA 8000 2000B 7000 1500C 6000 1000D 5000 500Calculate Gross Salary :Gross Salary = Basic + HRA (20% of Basic) + DA (50% Basic) + TAe.g if Basic = 8000TA = 2000HRA = 20% of 8000 = 1600DA = 50 % of 8000 = 4000Gross = 8000 + 2000 + 1600 + 4000 = 15600Optional : you can implement increment function in which you can change grade of an employee andrecalculate salary with new gradeQ3 Use the concept of polymorphism and classes to represent the following analog A Transportation class has the fields (model, year) with all the setters and getters. An Airplane class inherits Transportation, and it has a field number of wings (no wings) with a setter and a getter. A Car class inherits Transportation, and it has a field number of wheels (no wheels) with a setter and a getter. Al the parent and child classes have toString( ) method that prints everything. In the main program, create an array of transportations of size 6 (3 of them are airplanes and 3 are cars), and put any values you choose in the constructors. Finally run a loop through the array and print all the information, and by using the tool “instance of” if the element is an airplane, print “BINGO..AIRPLANE”, if the element is a car, print “BINGO..CAR”
- please do both parts part 1) Implement the Solvable inheritance structure strictly according to its UML diagram.Add comments stating where data fields, constructors, toString(), and other methods are (ifany). Neither method should have an empty body unless abstract methods.Note: You should implement the Solvable interface, abstract class Problem, regular classCodingProblem, and regular class MathProblem. part 2) Write a main() method inside of the CodingProblem class, having the following:1. Generate a random integer from 0 to 100.Hint: int num = (int)(Math.random()*100);2. Create a new instance of the CodingProblem class with random input, a String “Yourlucky number is: yourInputvalue” as output, algorithm, and programmingLanguage.Apply the concept of Polymorphism (means creating the object using the Problemclass name but CodingProbem’s constructer).3. Create a new instance of the MathProblem class with random input, its square(power of 2) as an output, your algorithm, and…please do both parts part 1) Implement the Solvable inheritance structure strictly according to its UML diagram.Add comments stating where data fields, constructors, toString(), and other methods are (ifany). Neither method should have an empty body unless abstract methods.Note: You should implement the Solvable interface, abstract class Problem, regular classCodingProblem, and regular class MathProblem. part 2) Write a main() method inside of the CodingProblem class, having the following:1. Generate a random integer from 0 to 100.Hint: int num = (int)(Math.random()*100);2. Create a new instance of the CodingProblem class with random input, a String “Yourlucky number is: yourInputvalue” as output, algorithm, and programmingLanguage.Apply the concept of Polymorphism (means creating the object using the Problemclass name but CodingProbem’s constructer).3. Create a new instance of the MathProblem class with random input, its square(power of 2) as an output, your algorithm, and…JAVA CODE Write a java set of classes that could be used to do simple calculations on geometricobjects. The set should include the following classes: a) Shapes ,containing abstract methods( a methods that is declared without animplementation) area and perimeter b) Rectangle, a subclass of Shape, containing a constructor (with parameters forlength and width) along with methods area and perimeter. c) Triangle, a subclass of Shape, containing a constructor (with parameters for the three sides of a triangle) along with methods area ( s = (a+b+c)/2, A = sqrt( s(s-a)(s-b)(s-c) ) ) and perimeter d) Square, a subclass of Rectangle, containing a constructor (with a parameter for thelength of a side) and methods that invoke the methods of the Rectangle class todetermine the perimeter and area of a square.
- CPSC 131: Introduction to Computer Programming IIProgram 3: Inheritance and Interface1 Description of the ProgramIn this assignment, you will make two classes, Student and Instructor, that inherit from asuperclass Person. The implementation of class Person is given. You will also need to writea test program to test the methods you write for these two classes. The implementationdetails are described as follows.Stage 1: In the first file Student.java, you should include the following additional instancevariables and methods (other than all instance variables and methods inherited from classPerson):• Private instance variables studentID, and major;• A constructor takes four inputs (name, age, studentID and major);• Two additional getter methods to return each of instance variables (accessor);• Two setter methods to change each of instance variables (mutator);• A method toString that converts a student’s information into string form. Thestring should have the format as shown in Figure 1.…CPSC 131: Introduction to Computer Programming IIProgram 3: Inheritance and Interface1 Description of the ProgramIn this assignment, you will make two classes, Student and Instructor, that inherit from asuperclass Person. The implementation of class Person is given. You will also need to writea test program to test the methods you write for these two classes. The implementationdetails are described as follows.Stage 1: In the first file Student.java, you should include the following additional instancevariables and methods (other than all instance variables and methods inherited from classPerson):• Private instance variables studentID, and major;• A constructor takes four inputs (name, age, studentID and major);• Two additional getter methods to return each of instance variables (accessor);• Two setter methods to change each of instance variables (mutator);• A method toString that converts a student’s information into string form. Thestring should have the format as shown in Figure 1.…I need help with this problem. Define objects for the Donkey Pong game, e.g. Mario, Gorilla, Cask, Map… You do not need to develop an entire game, you need to define classes, method names, and parameters used for the game in the programming language Java. The code must include inheritance, overriding a method, and overloading a method at least once. It can have multiple '.java files' such as Mario.java, Barrel.java, Kong.java, Peach.java, Ladder.java, etc. Must be very careful, with naming conventions, which affect your homework mark, including getter/setters, Capital/Small, …