In a Java languages. Write a class called Car that holds information about an au
ID: 3680744 • Letter: I
Question
In a Java languages. Write a class called Car that holds information about an automobile: Make (e.g., Chevy, Toyota, ) Model (e.g., Impala, Corolla, Uno) Year (e.g., 2012) Define a constructor to initialize these values. Define a to String method. Define a method called is Antique that returns true if the car is more than 25 years old, and false otherwise. Create a test driver called Car_Test. Accepts inputs from the keyboard for each member variable. Instantiates a Car object with the entered values. Outputs the values to the screen using println(). Determines if the car is an antique and outputs the result.
Explanation / Answer
import javax.swing.JOptionPane;
static void main(String[] args) {
boolean carAge = true;
if(carAge>25)
System.out.println("Car Age is :”);
boolean carAge = false;
else
System.out.println("Car Age is :”);
}
public class GetInputs{
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.