Question & Answer: In this program, you create a map and find the route from a source location to a destination location. You will use structure(s), po…..

In this program, you create a map and find the route from a source location to a destination location. You will use structure(s), pointer(s) and class(es) to accomplish this task Lets begin by looking at the following map The letters of the alphabet represent the locations. Each line represents a highway and each location has one exit highway and one entry highway. You may only leave a location through its exit highway and enter it through its entry highway. (For example The route from location A to D using this map is A>E>C B D Your code will implement this. First, you will begin by creating the map above in your code using class(cs), structure(s), pointer(s) and anything else you may want to use. Once you have the map, you will prompt the user to enter new names for the locations represented by A,B.C.D,E, above. Once you have accomplished that, you have created your map Next, you will prompt the user for the starting location and destination location. You will use the map to figure out and then display the route from the starting location to the destination location. You must keep track of how many times a location is chosen as a destination. You must, then, display the following menu and continue to do so until the user decides to exit the program: C- to enter another source & destination pair P- to see the most popular destination locations E to exit If the user enters P, you must display the locations from most popular (chosen the most number of times as destination) to least popular. If two or more locations have been chosen as the destination the same number of times, list them in alphabetical order. Please remember to place appropriate error checks (PLEASE INCLUDE THE FILES AND THE OUTPUT C++

In this program, you create a map and find the route from a source location to a destination location. You will use structure(s), pointer(s) and class(es) to accomplish this task. Let’s begin by looking at the following map: The letters of the alphabet represent the locations. Each line represents a highway and each location has one exit highway and one entry highway. You may only leave a location through its exit highway and enter it through its entry highway. (For example The route from location A to D using this map is A rightarrow E rightarrow C rightarrow B rightarrow D) Your code will implement this. First, you will begin by creating the map above in your code using class(es), structure(s), pointer(s) and anything else you may want to use. Once you have the map, you will prompt the user to enter new names for the locations represented by A, B, C, D, E, above. Once you have accomplished that, you have created your map. Next, you will prompt the user for the starting location and destination location. You will use the map to figure out and then display the route from the starting location to the destination location. You must keep track of how many times a location is chosen as a destination. You must, then, display the following menu and continue to do so until the user decides to exit the program: C- to enter another source & destination pair P- to see the most popular destination locations E to exit If the user enters P, you must display the locations from most popular (chosen the most number of times as destination) to least popular. If two or more locations have been chosen as the destination the same number of times, list them in alphabetical order. Please remember to place appropriate error checks.

Expert Answer

 

The given path is A->E->C->B->D->A.
User enters the start and end point.
I am implementing the code in Java but only the syntax for input will change else everything will be same. You must be capable of doing that much change I guess.

Don't use plagiarized sources. Get Your Custom Essay on
Question & Answer: In this program, you create a map and find the route from a source location to a destination location. You will use structure(s), po…..
GET AN ESSAY WRITTEN FOR YOU FROM AS LOW AS $13/PAGE
Order Essay

import java.io.*;
import java.util.*;
class solution
{
public static void main(String args[])throws IOException
{
int i,si,di;
int ar[]={0,4,2,1,3};
int ds[]={0,0,0,0,0};
Scanner sc=new Scanner(System.in);
System.out.println(“Path isnA->E->C->B->D->A”);
System.out.println(“Enter new names of locations”);
String names[]=new String[5];
for(i=0;i<5;i++)
names[i]=sc.nextLine();
System.out.println(“Path with new names :”);
System.out.println(names[0]+”->”+names[4]+”->”+names[2]+”->”+names[1]+”->”+names[3]+”->”+names[0]);
while(true)
{
System.out.println(“C-To enter new source and destination”);
System.out.println(“P-To view most popular destination”);
char ch=(sc.nextLine()).charAt(0);
if(ch==’C’)
{
System.out.println(“Enter source and destination”);
String s=sc.nextLine();
String d=sc.nextLine();
for(i=0;i<4;i++)
{
if(s.equals(names[i]))si=i;
if(d.equals(names[i]))di=i;
}
if(si<di)
for(i=si;i<=di;i++)
{
System.out.println(names[i]);
ds[i]++;
}
else
{
for(i=si;i<=4;i++)
{
System.out.println(names[i]);
ds[i]++;
}
i=0;
for(i=0;i<=di;i++)
{
System.out.println(names[i]);
ds[i]++;
}
}
}
else if(ch==’P’)
{
int mv=0;
for(i=0;i<=4;i++)
if(ds[i]>=mv)mv=i;
for(int k=i;k<=4;k++)
System.out.println(names[i]);
}
}
}
}

Grand Paper Writers
Order NOW For A 10% Discount!
Pages (550 words)
Approximate price: -

Our Advantages

Plagiarism Free Papers

All papers are written by the best professional writers to ensure 100% originality. We always provide plagiarism reports whenever we deliver completed papers.

Free Revisions

All papers by Grand Paper Writers are completed and submitted on time. This timely delivery of papers gives you time to go through the paper before the official deadline.

Title-page

As an additional service, we will provide a title page that precedes the contents of your paper. Here, you will provide your personal details.

Bibliography

We also ensure that we provide an extra page for the references or bibliographies following referencing rules.

Originality & Security

At Grandpaperwriters.com, we guarantee students for the provision of security and original work. All your personal information is handled with confidentiality and is not shared with third parties. Additionally, we ensure that we provide original content with accompanying plagiarism reports to show originality.

24/7 Customer Support

Our customer support team is always available 24/7 to provide instant responses to any queries raised by students.

Try it now!

Calculate the price of your order

We'll send you the first draft for approval by at
Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

Grandpaperwriters.com has the best professional essay writers for quality services.

Pricing

Flexible Pricing

Here, a Grandpaperwriters.com, we do not compromise on the time of our clients. We always deliver all completed papers on or before the deadlines.

Communication

Admission Help & Client-Writer Contact

Grandpaperwriters.com provides an interactive portal where students can communicate directly to their writers.

Deadlines

Paper Submission

Here, a Grandpaperwriters.com, we do not compromise on the time of our clients. We always deliver all completed papers on or before the deadlines.

Reviews

Customer Feedback

Grandpaperwriters.com appreciates feedback from our clients to help us improve the delivery of essay writing services. As such, we are constantly changing our policies to ensure maximum customer and writer satisfaction.