This is a java program that runs on the Eclipse.
Hi, Since you have provided a question with 10 subparts, I am providing answer to first 4 subparts. For further subparts please ask seperately. Also if you find any difficulty in understanding any part of the code, feel free to comment.
Chassis.java
public interface Chassis { public final String chassis = "Chassis"; public Chassis getChassisType(); public void setChassisType(String vehicleChassis); }
Engine.java
import java.util.Date; public interface Engine { void setEngineCylinders(int engineCylinders); void setEngineManufacturedDate(Date date); void etEngineManufacturer(String manufacturer); void setEngineMake(String engineMake); void setEngineModel(String engineModel); void setDriveTrain(String driveTrain); void setEngineType(String fuel); }
VehicleChassis.java
public class VehicleChassis implements Chassis{ String chassisName; public VehicleChassis() { this.chassisName = chassis; } public VehicleChassis(String chassisName) { this.chassisName = chassisName; } @Override public Chassis getChassisType() { return new VehicleChassis(); } @Override public void setChassisType(String vehicleChassis) { chassisName = vehicleChassis; } @Override public String toString() { return "Chassis Name : " + chassisName; } public static void main(String[] args){ VehicleChassis vehicleChassis = new VehicleChassis(); VehicleChassis vehicleChassis1 = new VehicleChassis("chasis name"); System.out.println(vehicleChassis); System.out.println(vehicleChassis1); } }
VehicleFrame.java
public class VehicleFrame implements Chassis{ String vehicleFrameType; public VehicleFrame() { vehicleFrameType = "Unibody"; } public VehicleFrame(String vehicleFrameType) { this.vehicleFrameType = vehicleFrameType; } @Override public Chassis getChassisType() { return new VehicleChassis(); } @Override public void setChassisType(String vehicleChassis) { vehicleFrameType = vehicleChassis; } @Override public String toString() { return "Chassis : " + chassis + "\n" + "Vehicle Frame : " + vehicleFrameType; } public static void main(String[] args){ VehicleFrame vehicleFrame = new VehicleFrame(); System.out.println(vehicleFrame); vehicleFrame.setChassisType("Ladder Frame"); System.out.println(vehicleFrame); } }
Sample Output : VehicleChassis.java
Sample Output : VehicleFrame.java
Hope it helps!
This is a java program that runs on the Eclipse. Java Programming 2-1: Java Class Design...
JAVA Problem: Coffee Design and implement a program that manages coffees. First, implement an abstract class named Coffee. The Coffee class has three member variables: coffee type, price, and store name. The Coffee class has an abstract method name ingredient. Make sure to add all necessary setters and getters as well as other methods. The class Coffee implements an interface HowToMakeDrink. The interface has the following method: public interface HowToMakeDrink { public void prepare (); } The prepare method will...
Problem: Coffee(Java) Design and implement a program that manages coffees. First, implement an abstract class named Coffee. The Coffee class has three member variables: coffee type(does not mention the data type of the variable coffeeType), price, and store name. The Coffee class has an abstract method name ingredient. Make sure to add all necessary setters and getters as well as other methods. The class Coffee implements an interface HowToMakeDrink. The interface has the following method: public interface HowToMakeDrink { public...
In JAVA Algorithm Workbench 1. Write the first line of the definition for a Poodle class. The class should extend the Dog class. 2. Look at the following code, which is the first line of a class definition: public class Tiger extends Felis In what order will the class constructors execute? 3. Write the statement that calls a superclass constructor and passes the arguments x, y, and z. 4. A superclass has the following method: public void setValue(int v) value...
PRG/421 Week One Analyze Assignment – Analyzing a Java™Program Containing Abstract and Derived Classes 1. What is the output of the program as it is written? (Program begins on p. 2) 2. Why would a programmer choose to define a method in an abstract class (such as the Animal constructor method or the getName()method in the code example) vs. defining a method as abstract (such as the makeSound()method in the example)? /********************************************************************** * Program: PRG/421 Week 1 Analyze Assignment * Purpose: Analyze the coding for...
object oriented programming java homework question about abstracting and interfaces 2. Definition of a hierarchy of fruits is given below. • Fruit contains an abstract method getVitamin() that returns String. Fruit contains a String field color. Fruits are Apple, Banana, Strawberry and Blackberry. Apples are green, bananas are yellow, strawberries are red, blackberries are black. All these classes have zero parameter constructors. O Apple's vitamins are "A B12". 0 Banana's vitamins are "CD". O Strawberry's vitamins are “B5 E". 0...
Create a Java Project in Eclipse with the following: Include the Rectangle class supplied below. Override the toString method for Rectangle. Override the equals method for Rectangle. Implement the comparable Interface for Rectangle (Compare by area) Rectangle class: public class Rectangle { private double length; private double width; public Rectangle(double l, double w) { length = l; width = w; } public double getLength() { ...
JAVA Problem: Coffee do not use ArrayList or Case Design and implement a program that manages coffees. First, implement an abstract class named Coffee. The Coffee class has three member variables: coffee type, price, and store name. The Coffee class has an abstract method name ingredient. Make sure to add all necessary setters and getters as well as other methods. The class Coffee implements an interface HowToMakeDrink. The interface has the following method: public interface HowToMakeDrink { public void prepare ();...
The current code I have is the following: package uml; public class uml { public static void main(String[] args) { // TODO Auto-generated method stub } } class Account { private String accountID; public Account(String accountID) { this.accountID = accountID; } public String getAccountID() { return accountID; } public void setAccountID(String accountID) { this.accountID = accountID; } @Override public String toString() { return "Account [accountID=" + accountID + "]"; } } class SuppliesAccount extends Account { private...
CONVERT THIS JAVA CODE WITH THE JAVA DOC GUIDELINES WHERE APPROPRIATE. DO NOT CHANGE THE CODE. SAME CODE SHOULD BE USED FOR THE DOCUMENTATION PURPOSES. ONLY INSERT THE JAVA DOC. //Vehicle.java public class Vehicle { private String manufacturer; private int seat; private String drivetrain; private float enginesize; private float weight; //create getters for the attributes public String getmanufacturer() { return manufacturer; } public String getdrivetrain() { return drivetrain;...
********************Java Assigment******************************* 1. The following interface and classes have to do with the storage of information that may appear on a mailing label. Design and implement each of the described classes below. public interface AddrLabelInterface { String getAttnName(); String getTitle(); // Mr., Mrs., etc. String getName(); String getNameSuffix(); // e.g., Jr., III String getProfessionalSuffix(); // O.D. (doctor of optometry) String getStreet(); String getSuiteNum(); String getCity(); String getState(); String getZipCode(); } Step 1 Create an abstract AddrLabel class that implements the...