java. do it on eclipse. the same way its instructed
Second Inheritance OOP assignment
Outcome:
Student will demonstrate the ability to understand inheritance
Program Specifications:
Programming assignment: Classes and Inheritance
You are to pick your own theme for a new Parent class. You can pick from one of the following:
Person
Automobile
Animal
If you choose Person, you will create a subclass of Person called Student.
If you choose Automobile, you will create a subclass of Automobile called RaceCar
If you choose Animal, you will create a subclass of Animal called Horse
Once you pick your theme, you must use the “HAS A” question to determine the fields that you
are going to include in your classes.
For example, an Alarm Clock HAS A:
Set Hours Button Time
Set Minutes Button Time
Set Hours Button Alarm
Set Minutes Button Alarm
Alarm On-Off Button
Snooze Button
You will create UMLs for all classes.
You will WRITE JAVA code to create the classes from above. In the classes you are creating
you will include at least three fields or attributes (See sample alarm clock above).
You will have overloaded methods, and overridden methods. You will label each. You will
have a Testclass that creates at least 3 objects of each class.
Your parent and child classes need to have all necessary and required methods.
You will test your work. You will zip up the project folder (no design tool needed).
Submission Requirements:
You must follow the rules from the second assignment minus the design tool but
add the UML.
YOU CANNOT:
Use global variables
Use the word goto
Use the break command outside a case statement
plzzzzzzzzzzzzzzzzzzz Upvote...
Comment for any queries..thanks
I chose Animal Theme.
//Animal.java
public class Animal {
public int legs;
public int speed;
public String food;
// constructor animal
public Animal(int legs, int speed, String food) {
super();
this.legs = legs;
this.speed = speed;
this.food = food;
}
// method run
public void run()
{
System.out.println("Animal is running");
}
// Overloading content method
public void content(int legs, int speed)
{
System.out.println("Legs for this animal: "+legs+"\nSpeed of this animal is: "+speed);
}
// Overloading content method
public void content(int legs)
{
System.out.println("Legs for this animal: "+legs);
}
// Overloading content method
public void content(int legs, int speed, String food)
{
System.out.println("Legs for this animal: "+legs+"Speed of this animal is: "+speed+ "Food type of this animal is: "+food);
}
}
---------------------------------------------------------------------
//Horse.java
public class Horse extends Animal {
public Horse(int legs, int speed, String food) {
super(legs, speed, food);
// TODO Auto-generated constructor stub
}
@Override
public void run() {
// TODO Auto-generated method stub
System.out.println("Horse is running");
}
}
----------------------------------------------------------------------------
//Test.java
public class Test {
public static void main(String[] args) {
// TODO Auto-generated method stub
// creating Animal object
Animal a=new Animal(4,25,"Veg");
// creating horse objects
Horse h1=new Horse(4,66,"Veg");
Horse h2=new Horse(4,45,"Veg");
// creating horse object and referencing to animal
Animal h3=new Horse(4,72,"Veg");
// Calling overloaded method "content"
h1.content(h1.legs);
h1.content(h1.legs,h1.speed);
// Calling overriding method "run"
h3.run();
}
}
Sample Output in eclipse:

java. do it on eclipse. the same way its instructed Second Inheritance OOP assignment Outcome: ...
Can you please pick Automobile For this assignment. Java Programming Second Inheritance OOP assignment Outcome: Student will demonstrate the ability to use inheritance in Java programs. Program Specifications: Programming assignment: Classes and Inheritance You are to pick your own theme for a new Parent class. You can pick from one of the following: Person Automobile Animal Based on your choice: If you choose Person, you will create a subclass of Person called Student. If you choose Automobile, you will create...
What is the code for this in Java?
Assignment Inheritance Learning Objectives Declare a subclass that derives from a superclas:s ■ Demon "Declare a variable of the superclass type and assign it an instance of the subclass type strate polymorphic behavior Access the public members of the superclass type Notice how the overridden versions of the subclass type are called Notice how the subclass specific members are inaccessible "Create an array of superclass type and use a foreach loop to...
Please help me with the following question. This is for Java programming. In this assignment you are going to demonstrate the uses of inheritance and polymorphism. You will create an Animals class and a Zoo class that holds all the animals. You should create a general Animalclass where all other classes are derived from (except for the Zoo class). You should then create general classes such as Mammal, Reptile, and whatever else you choose based off of the Animalclass. For...
The purpose of this homework is to practice OOP programming covering Inheritance in java. The scenario is to design an online shopping system for a local supermarket (e.g., Europa Foods Supermarket or Wang Long Oriental Supermarket) and is mostly concentrated on the product registration system. Design and draw a UML diagram, and write the code for the following classes: ID: The identification number must start with 1 and follows with 6 numbers, e.g., “1123456”. Description, e.g. “Banana” Recommended Price per...
Please help me with the following question. This is for Java programming. In this assignment you are going to demonstrate the uses of inheritance and polymorphism. You will create an Animals class and a Zoo class that holds all the animals. You should create a general Animalclass where all other classes are derived from (except for the Zoo class). You should then create general classes such as Mammal, Reptile, and whatever else you choose based off of the Animalclass. For...
Purpose Demonstrate the ability to create and use subclasses and inheritance. This includes overriding method behaviors and using polymorphism. Assignment Create an Aircraft class that has several properties that are common to all aircraft (Ex: number of engines, seat capacity). You define the name of the Class and the actual fields. The fields MUST BE PRIVATE!!! You must define a constructor that allows you to provide at least some of the field values used for an aircraft. You must define...
Assignment Requirements
I have also attached a Class Diagram that describes the
hierarchy of the inheritance and interface behaviors . The link to
the PDF of the diagram is below
MotorVehical.pdf
Minimize File Preview
User Define Object Assignment:
Create a Intellij Project. The
Intellij project will contain three user defined
classes. The project will test two of the User Define Classes by
using the invoking each of their methods and printing the
results.
You are required to create three UML...
the first question java code eclipse app
the second question is java fx gui caculator
please fast
1. Create project called "YourFirstName_QUID'. Eg. Aliomar_202002345 2. Create two package Q1 and Q2. 3. Add your name and studentID as comments on the top of each Java source file you submit. Question 1. Bookings APP [80 Points-six parts] Implement the following hotel booking system. Use the following class diagram to understand the structure of the system's classes, their attributes operations (or methods),...
C# - Inheritance exercise
I could not firgure out why my code was not working. I was
hoping someone could do it so i can see where i went wrong.
STEP 1: Start a new C# Console Application project and rename its main class Program to ZooPark. Along with the ZooPark class, you need to create an Animal class. The ZooPark class is where you will create the animal objects and print out the details to the console. Add the...