• Create a UML diagram of the Automobile class. • Create the Automobile.java class. It should have the instance variables, constructor(s) and methods located below. • Compile the Automobile.java class and correct any errors. • Create another file named TestAutomobile.java that contains the main method. Create several Automobile objects and test that your constructor and methods work as described.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
●
• Compile the Automobile.java class and correct any errors.
Create another file named TestAutomobile.java that contains the main method. Create several
Automobile objects and test that your constructor and methods work as described.
●
Create a UML diagram of the Automobile class.
Create the Automobile.java class. It should have the instance variables, constructor(s) and
methods located below.
Automobile Instance variables
Reminder: + indicates public, - indicates private
- make (String): The automobile make (Ford, Acura, etc).
- model (String): The automobile model (Escapade, ZDX, etc).
- power (boolean): Holds the value true if the power is on and false if the power is off. The
default value is false.
.
- gear (char): Holds the value of the gear that the automobile is in. The default value is P
(Park). Other values include D (Drive), and R (Reverse).
Automobile constructors
• One constructor that takes two parameters and sets the make and model instance variables.
.
- volume (int): Holds a value representing the loudness (0 being no sound). The default value
is 6.
Automobile methods.
+ getMake: Returns the value stored in the make instance variable.
+ getModel: Returns the value stored in the model instance variable.
+ getGear: Returns the value stored in the gear instance variable.
+ getVolume: Returns the value stored in the volume instance variable.
+ getPower: Returns the value stored in the power instance variable.
1
●
• + setGear: Sets the value stored in the gear instance variable.
+ increaseVolume: Increases the value stored in the volume instance variable by 2. The max
value is 30.
+ decreaseVolume: Decreases the value stored in the volume instance variable by 2. The
minimum value is 0.
+ setPower: Toggles the value stored in the power variable to true if the value is currently false
and changes it to false if the value is currently true.
Transcribed Image Text:● • Compile the Automobile.java class and correct any errors. Create another file named TestAutomobile.java that contains the main method. Create several Automobile objects and test that your constructor and methods work as described. ● Create a UML diagram of the Automobile class. Create the Automobile.java class. It should have the instance variables, constructor(s) and methods located below. Automobile Instance variables Reminder: + indicates public, - indicates private - make (String): The automobile make (Ford, Acura, etc). - model (String): The automobile model (Escapade, ZDX, etc). - power (boolean): Holds the value true if the power is on and false if the power is off. The default value is false. . - gear (char): Holds the value of the gear that the automobile is in. The default value is P (Park). Other values include D (Drive), and R (Reverse). Automobile constructors • One constructor that takes two parameters and sets the make and model instance variables. . - volume (int): Holds a value representing the loudness (0 being no sound). The default value is 6. Automobile methods. + getMake: Returns the value stored in the make instance variable. + getModel: Returns the value stored in the model instance variable. + getGear: Returns the value stored in the gear instance variable. + getVolume: Returns the value stored in the volume instance variable. + getPower: Returns the value stored in the power instance variable. 1 ● • + setGear: Sets the value stored in the gear instance variable. + increaseVolume: Increases the value stored in the volume instance variable by 2. The max value is 30. + decreaseVolume: Decreases the value stored in the volume instance variable by 2. The minimum value is 0. + setPower: Toggles the value stored in the power variable to true if the value is currently false and changes it to false if the value is currently true.
Expert Solution
steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
Software Development
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education