Question
I need help with this assignment, it should be on Java. 1. Define a class called RaceCar. The instance variables are horsepower, weight, zeroTo60, and
I need help with this assignment, it should be on Java.
1. Define a class called RaceCar. The instance variables are horsepower, weight, zeroTo60, and milesperGal. The value of zeroTo60 (in seconds) is determined by the formula zeroTo60 = weight/horsepower/0.7, where horsepower can range from 200 to 700 hp, and weigh can range from 1000 to 3000 pounds. Include a constructor and all accessor and mutator methods. 2. Create an application class called RaceCarApp. This class should get input from the user and then use it to create two RaceCar objects. The application should then call a method in RaceCarApp that calculates the time it takes both cars to drag race for 0.25 miles. The formula for time (in seconds) is t = sqrt(2 * distance / acceleration), where acceleration is 0.0137/zeroTo60. The application should display the time required for each car to complete the race.
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