Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started