Question: JAVA Descripton: I would like you to create two new classes YourCar and YourCarTrip that will help you calculate the total distance from one point

JAVA

Descripton: I would like you to create two new classes "YourCar" and "YourCarTrip" that will help you calculate the total distance from one point (point A) to a second point (point B), how long it will take you to get there, and if you need gas for the return trip. YourCarTrip is the application.

Example: Depart UHCL (point A), take a left on to Bay Area Boulevard for 3.5 miles at 30 MPH, take a left onto I45 South for 26.3 miles at 65 MPH, exit right onto 61st street, go 2.0 miles to Stewart Drive, take a right and go 4.3 miles at 45 MPH to your destination on the right (point B).

YourCar should define, at least, the instance variables that hold the number of gallons in the tank (must be input at some point), the number of miles in the trip (starts at zero), current speed (starts at zero). YourCar should also be able to change direction, change speed (increase, decrease), and determine if you need gas. Needs gas, implies you will need to calculate your fuel consumption, so assume your car averages 25 MPG at any speed.

I would like you to run two different YourCar objects at the same time to see if it is worth the time to go ten miles over the speed limit. so, your application should output, the route (changes in course), the total distance, the total time, and fuel consumption.

Hint: you can assume you know the following information. 1) the number of road segment 2) for each road segment, you have information of speed limit, length of the road segment, direction that the car is heading, the name of the road.

Description: I would like you to update the classes you created for homework3. Update "YourCar" and "YourCarTrip" such that you use a for loop to enter each leg. Your application should ask the user for the number of legs for the trip, then subsequently ask for the distance and the speed limit for each leg of the trip. The input values for speed and distance will help you calculate the time required for each leg of the trip and total distance and total time for the trip. Additionally, make sure you have enough gas to make the return trip by calculating the amount of fuel needed for the return trip (please assume the same route in return). The programmer must use a 'for' loop to implement this application. Outputs should include, but are not limited to: time to travel each leg, total time, total distance, fuel consumption and remaining fuel.

Example: Depart UHCL (point A), take Bay Area Boulevard for 3.5 miles at 30 MPH, take I45 South for 26.3 miles at 65 MPH, exit right onto 61st street and go 2.0 miles at 30 MPH, then take Stewart Drive 4.3 miles at 45 MPH to your destination (point B). You application should ask the user for the number of legs (this case four (4)) then loop through four sets of questions to gather the necessary inputs for distance and speed.

YourCar should define, at least, the instance variables that hold the number of gallons in the tank (must be input at some point), the number of miles in the trip (starts at zero), current speed (starts at zero). YourCar should have the ability (methods) to change speed (increase, decrease), calculate time, calculate distance traveled, and determine if you need gas. Needs gas, implies you will need to calculate your fuel consumption, so assume your car averages 25 MPG at any speed. You may have to ask the user for amount of fuel (gallons) at the beginning of the trip. Constraint: Your gas tank cannot hold over 10 gallons.

TO:

Description: I would like you to update the classes you created for homework4. Update "YourCar" and "YourCarTrip" such that you can use an array to store the road segment information and you read the road segment information from the array. Your application should ask the user for the number of legs for the trip, then subsequently ask for the distance and the speed limit for each leg of the trip. You store these information to an array. The input values for speed and distance will help you calculate the time required for each leg of the trip and total distance and total time for the trip. Additionally, make sure you have enough gas to make the return trip by calculating the amount of fuel needed for the return trip (please assume the same route in return). The programmer must use a loop to implement this application. Outputs should include, but are not limited to: time to travel each leg, total time, total distance, fuel consumption and remaining fuel.

TO

Update "YourCar" and "YourCarTrip" such that you can use a 2D array to store the road segment information and you read the road segment information from the 2D array. The rest requirements are the same as the previous homework.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!