Question: 1. Create a Java project called Lab7A and create a Java class called CarMain which includes the main method Part A: a. Include a class








1. Create a Java project called Lab7A and create a Java class called CarMain which includes the main method Part A: a. Include a class called Car in the same Java file. This class has following instance variables and instance methods Instance Variables Type: String Color: String Gas per mile: double Tank capacity: double Instance Methods Display car details Calculate number of miles can be travel from the gas in the full tank and return it. Calculate the cost per mile. The method takes the cost per gallon as the input parameter and return the cost per mile b. Create two objects of Car class in main method and assign the following values to each of the instance variables Instance variables Ford Black 0.2 9.5 C2 Toyota Red 0.3 7.5 ype (String) olor (String) Gas per mile (double) ank capacity (double)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
