Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with my Java Programing homework. We are programing using the eclipse program. Here are the Instructions: Write a program to allow a

I need help with my Java Programing homework.

We are programing using the eclipse program.

Here are the Instructions:

Write a program to allow a user to enter the name of a starting city and a destination city. Output the mileage between cities and an estimate of the total number of gas stations on the way. The number of gas stations between two cities is the sum of the number of gas stations in the starting city and the number of gas stations in the destination city, all divided by 3 (since many of the stations will likely not be on the road between the two cities).

Store the mileage between 8 different cities in a 2D array of integers. Choose names of cities in Texas. Store the number of gas stations in each city in a 1D array.

Your program should first print a title showing the name of the program, version number and copyright notice with author name (insert your name as the author). Also, print a list of the cities in the database so the user knows what cities they can search.

Look up the mileage between the cities on the Internet and use the values you find in your program. You are free to create your own estimate of how many gas stations are in each city.

For example, if Houston has 100 gas stations and Beaumont has 20, then the output of your program should look something like:

City Mileage w/ Gas Stations ver. 1.0 (C) 2017 First Last

The cities in the database are:

1. Dallas (85 stations)

2. Houston (100 stations)

3. Beaumont (20 stations)

4. Austin (75 stations)

5. El Paso (44 stations)

6. Lubbock (59 stations)

7. Texarkana (37 stations)

8. Corpus Christi (39 stations)

Enter the starting city: Beaumont

Enter the destination city: Houston

Mileage: 75 miles

Estimated # of gas stations: 40

----------------------------------------------------------

Here is the pseudocode my professer gave us to help with the homework.

Again we are using Eclipse. Thanks soooo muchh

image text in transcribed

Pseudocode for City M problem (homework #6) suppose we have a 3 cities (you need 8 for your homework) all code can be in the main method main Data structures initialize this as usual Scanner input ames of the cities an array of 3 Strings with names of cities String city Mileage int distance t Austin 10, 250, 100), Beaumt 1250, 0, 75 h, Houstn 1100, 75, 0 Gas stations int []stations 200 in Austin 50 in Beaumt 400 in Houston String startCity, dstCity; Print the title lines Print ("City Mileage Print The cities in the database are Print the database of cities information for (int i 0, i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2014 Integration Services

Authors: Brian Knight, Devin Knight

1st Edition

1118850904, 9781118850909

More Books

Students also viewed these Databases questions