Question: I'm taking an Introduction to Algorithm class and having problems accurately applying logic to my coding. I'm going to post the assignment and what I

I'm taking an Introduction to Algorithm class and having problems accurately applying logic to my coding.

I'm going to post the assignment and what I have so far, if someone could help me out and post either the rest of the code or just the entire thing in general that would be amazing. I'm at the point I'm just trying to pass the class.

EGR 281 -

Project 11

due Wednesday, November 14 by 6:00 PM

According to Internal Revenue Service beginning on Jan. 1,

2018, the standard mileage rates for the use of a car (also

vans, pickups or panel trucks) will be 54.5 cents per mile

for business miles driven.

Write a Travel Mileage Reimbursement Calculator program

called

TMRcalculator

that uses an array to calculate the

distance between the cities based on the chart below. You

should ask the user to enter the number of cities visited

this trip. You should then ask the user for a starting point

city then you should ask the user to enter the next

destination city until the all the cities have been visited.

After you supply an appropriate prompt, you should have the

user enter numbers instead of typing city names for example

Enter 1 for Boston, 2 for Chicago, 3 for Dallas, etc. Your

program should look up the distance between the cities and

display this to the user. Finally, with appropriate

information the program will display the total amount of

travel mileage and the correct travel mileage reimbursement.

Hint: This requires a 10 by 10 integer array do not include

the city names in your integer array. You should have a

separate String array for the city names.

Boston Chicago Dallas Reno Los Angeles Miami New Orleans Toronto Vancouver Washington DC
Boston 0 1004 1753 2751 3017 1520 1507 609 3155 448
Chicago 1004 0 921 1780 2048 1397 919 515 2176 709
Dallas 1753 921 0 1230 1399 1343 517 1435 2234 1307
Reno 2751 1780 1230 0 272 2750 1732 2251 1322 2420
Los Angeles 3017 2048 1399 272 0 2716 1858 2523 1278 2646
Miami 1520 1397 1343 2750 2716 0 860 1494 3447 1057
New Orleans 1507 919 517 1732 1858 860 0 1307 2734 1099
Toronto 609 515 1435 2251 2523 1494 1307 0 2820 571
Vancouver 3155 2176 2234 1322 1278 3447 2734 2820 0 2887
WashingtonDC 448 709 1307 2420 2646 1057 1099 571 2887 0

Dont forget to include your name, the project number, the

due date, the current date and a short description of the

program comments at the top of your program file. Also be

sure to use good variable names.

Please send your .class and .java files to the dropbox.

Also turn in a printed copy of your code.

-----

What I have:

/*Leanna Scott

* project 11

* due: 11-14

* a program that calculates mileage and tells you how much you should be reimbursed.

*/

package mtc.egru281.projecteleven;

public class TMRcalculator {

private int[][] miles = { { 0 , 1004 , 1753, 2752 , 3017 , 1520 , 1507 , 609 , 3155 , 448},

{1004 , 0 , 921 , 1780 , 2048 , 1397 , 919 , 515 , 2176, 709},

{1753 , 921 , 0 , 1230 , 1399 , 1343 , 517 , 1435 , 2234, 1307},

{2752 , 1780 , 1230 , 0 , 272 , 2570 , 1732 , 2251 , 1322 , 2420},

{3017 , 2048 , 11399 , 272 , 0 , 2716 , 1858 , 2523 , 1278 , 2646},

{1520 , 1397 , 1343 , 2570 , 2716 , 0 , 860 , 1494 , 3447 , 1057},

{1507 , 919 , 517 , 1732 , 1858 , 860 , 0 , 1307 , 2734 , 1099},

{609 , 515 , 1435 , 2251 , 2523 , 1494 , 1307 , 0 , 2820 , 571},

{315 , 2176 , 2234 , 1322 , 1278 , 3447 , 2734 , 2820 , 0 , 2887},

{448 , 1709 , 11307 , 12420 , 12646 , 11057 , 11099 , 1571 , 12887 , 10}};

private String [] cities = { "Boston" , "Chicago" , "Dallas" , "Reno" , "Los Angeles" , "Miami" , "New Orleans" , "Toronto" , "Vancouver" , "Washington DC"};

//private String [] cities2 = {"Boston" , "Chicago" , "Dallas" , "Reno" , "Los Angeles" , "Miami" , "New Orleans" , "Toronto" , "Vancouver" , "Washington DC"};

private int [] citiesTraveledTo;

private int numberOfCities;

public TMRcalculator() {

this.numberOfCities = 0;

}//ending bracket of constructor

}//ending bracket of TMRcalculator

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!