Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Part 1 You will create two classes Car and RaceLane. Your main method will go in RaceLane1. 1. Define a class Car. All of the
Part 1 You will create two classes Car and RaceLane. Your main method will go in RaceLane1. 1. Define a class Car. All of the below properties/methods should be non static. ACar should have five private properties: a String for the model of the car (e.g. Toyota Camry), an int location, an int currentSpeed, a boolean movingForward, and an int maxSpeed. The idea is that the location data member stores where on a number line the Car is. Make sure the number entered is 2 0 a. b. A default constructor. A constructor that takes as input three things: A String for the model, an int maxSpeed, and an int for an initial location. It should set the model of the Car, the max speed, and initial location appropriately based on the input. The constructor should make it so that the movingForward property should always be initially set to be true. The currentSpeed should always be initially set to be 0. c. d. Write three methods called getModel(), getDirection(), and getLocation() that let you retrieve the model, movingForward, and location properties respectively
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