Question

This is a java program that runs on the Eclipse.

Java Programming 2-1: Java Class Design Interfaces Practice Activities Lesson objectives: Model business problems using Java classes Make classes immutable User Interfaces Vocabulary: Identify the vocabulary word for each definition below. A specialized method that creates an instance of a class. A keyword that qualifies a variable as a constant and prevents a method from being overridden in a subclass. A class that it cant be overridden by a subclass, in fact it cant be subclassed. Defines constants and methods without implementation Try it/Solve It: 1. Create an interface named Chassis. Add the following to the interface: A public constant string named chassis with a value of Chassis. The definition of a public getChassis Type method that returns an instance of Chassis. The definition of a public setChassisType that accepts a string named vehicleChassis and returns a void. 2. Create an interface Engine with the following list of public method definitions that return a void: setEnginecylinders (int enginecylinders) setEngineManufacturedDate (Date date) setEngine Manufacturer (String manufacturer) set. EngineMake String engineMake setEngine Model (String engineModel); set DriveTrain (String driveTrain) setEngine Type (String fuel)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Vocabulary: Identify the vocabulary word for each definition below. Constructor final final class A specialized method that c

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

C:\Program Files Javaljdk1.8.0_1011binljava Chassis Name: Chassis Chassis Name : chasis name Process finished with e xit code

Sample Output : VehicleFrame.java

C:\Program Files\Javaljdk1.8.0 1011binljava Chassis: Chassis Vehicle Frame:Unibody ChassisChassis Vehicle Frame Ladder Fram

Hope it helps!

Add a comment
Know the answer?
Add Answer to:
This is a java program that runs on the Eclipse. Java Programming 2-1: Java Class Design...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • JAVA Problem:  Coffee    Design and implement a program that manages coffees. First, implement an abstract class...

    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...

    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....

    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...

    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...

    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...

    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....

    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...

    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....

    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...

    ********************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...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT