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.

Even though you are encouraged to use repl.it, from this assignment and on, you

by | Feb 28, 2022 | Computer and Web Programming : C++ Programming | 0 comments

GET HELP WITH YOUR ESSAY

If you need assistance with writing your essay, our professional Essay Writing Service is here to help!

ORDER THIS OR A SIMILAR PAPER NOW

Even though you are encouraged to use repl.it, from this assignment and on, you develop your solutions in any IDE of your choice.  Please note that if you use your own IDE such as CLion or VS Code, it’s necessary to submit a fully functioning ‘makefile’, readme.md (markdown) along with your program source codes OBJECTIVES: This assignment will help you to exercise the various fundamental C++ language constructs you’ve learned in the class. If- statements/switch statements
Doubly nested loops
Functions
enum user-defined data type, converting the user entered string to an enum element
static 2D arrays:  for this assignment, you are NOT allowed to use char *.  Instead, use a static 2-D array of primitive char.
*** Please note that for this programming assignment, you do NOT need to create header files (*.h(pp)) yet.
Travel Distance Calculator (15 points) : Using a 2D static array, “distances[NUM_OF_CITIES] [NUM_OF_CITIES] of int”
[Setting up of distance table]
The number of cities in the distance grid is 15:
Atlanta, Boston, Chicago, Dallas, Denver, LA, Houston, Memphis, Miami, New York, Phoenix, Philadelphia, San Francisco, Seattle, Washington DC
Each square in a grid is set to the distance from the departure city in the first column to the arriving city in the header row.
Each square is referred to by a departure city name followed by an arrival city name for a 15 by 15 grid
For example, the value of the square, DISTANCES[DENVER, NEWYORK] of the distance grid below is 2617, phoenix to Dallas is 1422.
Use the distance table below (source:  https://www.mapcrow.info/united_states.html  (Links to an external site.)) in your program:
Here is the the link with the code with the prepopulated distance table (https://replit.com/@valleske/DistanceTable-1#main.cpp)
Write a program that asks a user to enter a departing city name at the first line and an arriving city name next line, then it looks up the distance table to retrieve and return the following information:
The distance of two cities and driving cost information based on the current gas price and car mileage efficiency entered by the user
The average distance from the departing city to all other cities.
You should define an enum type (or enum class)  for the city names and must use the enum enumerators (explicitly named constants) to specify a city name.
Here is a sample code for using enum type: enum_test – Replit (https://replit.com/@valleske/enumtest#main.cpp.)
You can use either C-string or string class for this part but string class would be simpler and easier.
The program should support at least the following three functions:
void copyDistanceTable (the2DArray of distance, number of cities)
This function takes two input parameters, but no return value.  It reads and copies the distance information from the globally declared constant distance table into the specified 2D array (the2DArray) parameter.  You declare the global distance table outside the main() function. Then you may use doubly nested loops to copy the values from the global table to the specified 2D array which is locally defined in the main() function.
Weather Alert!!  Due to a snowstorm in Colorado, I-70 has been closed so the distances from Denver to any cities west of Denver should be extended by 75 miles in the specified 2D array (the2DArray) parameter. Those cities are Los Angeles, San Francisco, and Seattle.
HINT:  You can copy and paste a pre-populated 2D distance table in this repl  (https://replit.com/@valleske/DistanceTable-1#main.cpp )to declare your own global distance 2D array.  You don’t need to type them in manually for yourself.  You may also use the example repl to learn how to declare a global 2D distance array variable in your program.
A sample code of declaring and using a 2D array:  Chapter 5 Static Arrays – Replit https://replit.com/@valleske/Chapter-5-Static-Arrays#main.cpp)  (search for  /* 2D array */)
2 input parameters
the2DArray of integers: n x n  2D static array of integers (n: 15 in this example).  Note that the 2D array must be a static array.  i.e. The array size is fixed and is known at the compilation time. You are not allowed to change the array size during the program runtime.  That means you can NOT use a dynamic array or an array of int pointers for this specific assignment.  the number of cities: the number of rows (15 in this example)
2. double getTravelCost (the2DArray of distance, theIndexOfDeparture, theIndexOfArrival)
The function takes three parameters: the 2D array of distances in integers, an enum value (the index of departure city),  and an enum value (the index of arrival city)
IMPORTANT!! The validity of ‘departure’ and ‘arrival’ city index parameters must be checked at the beginning of the function.  The valid range for both city indexes is [ATLANTA .. WASHINGTON_DC].  If the function receives a city index outside of the range, then it immediately returns ‘-1’.
Below is how the function should compute the travel cost:
First, it queries the distance between two cities from the 2-D Distance array parameter.
Next, it asks the user to enter the current gas price per gallon and the mileage per gallon (MPG) of the user’s vehicle
Then computes and returns the total gas cost of the travel between two cities using the information retrieved above
3. int getAverageDistance (the2DArray of distance, theIndexOfCity)
The function takes two parameters: the 2D array of distances (int), an enum value (the index of the city).  The validity of the city index parameters must be checked at the beginning of the function.  The valid range for both city indexes is [ATLANTA .. WASHINGTON_DC].  If the function receives a city index outside of the range, then it immediately returns ‘-1’.
It returns the average distance between the specified city and all other cities in the Distance table.
[Testing in your main() function]
In your main() function, you should test all three functions with at least 3 sets of cities as follows: Ask the user to enter the departure and arrival city names The city name in the string class should be converted to the corresponding enumerator of your city enum type.
The user can enter case-insensitive strings for the city names.  (e.g., Boston == boston == bOsToN)
Your program should keep asking the user to enter a valid city name if the entered name is not in the set of the city names in the Distance Table.
Display the travel cost for the specified pair of cities
In addition, Get the average distance for all cities and find the city with the smallest average distance. 1. Write a function, string getClosetCity(the2DArray of distance, theIndexOfCity), which returns the closest city from the specified city.
The returned value must in the following format.
A string concatenating city name + distance
For example, for Denver city, it may return “Phoenix [942] miles”
2. Write a function, string getFarthestCity(the2DArray of distance, theIndexOfCity), which returns the farthest city from the specified city.
The returned value must in the following format.
A string concatenating city name + distance
For example, for Denver city, it may return “Boston [2,838] miles”
3. Write a function, string getClosestTwoCities(the2DArray of distance), which returns the closest two cities in the entire table.  You must write doubly nested loops to traverse the 2D table.
The returned value must in the following format.
A string concatenating city names + distance
For example, it may return “Boston/Houston [2,579] miles”  (This is an incorrect example for output sample purpose only)
4. Write a function, string getFarthestTwoCities(the2DArray of distance), which returns the farthest two cities in the entire table.  You must write doubly nested loops to traverse the 2D table.
The returned value may be in the following format.
A string concatenating city names + distance
For example, it should return “Boston/Houston [2,579] miles”  (This is an incorrect example for output sample purpose only)

ORDER THIS OR A SIMILAR PAPER NOW

Our Services

Top quality papers

We always make sure that writers follow all your instructions precisely. You can choose your academic level: high school, college/university, or professional, and we will assign a writer who has a respective degree.

Professional writers

We have hired a team of professionals who provide expert academic help. Most of them are native speakers and PhD holders who are able to take care of any assignment you need help with.

 

Free Revision

If you feel that we missed something, send the order for a free revision. You will have 10 days to send the order for revision after you receive the final paper. You can either do it on your own after signing in to your personal account or by contacting our support team.

On Time Delivery

All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.

24/7 Support

Our support agents are available 24/7 and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

Original

We use several checkers to make sure that all papers you receive are plagiarism-free. Our editors carefully go through all sources and in-text citations. We also promise full confidentiality in all our services.

 

Pediatric Care

Customer satisfaction has always been one of our basic concerns. If you don’t feel satisfied with our delivered work, you can request for a refund.

 

Authentic Source

We assure you that your document will be thoroughly checked for plagiarism and grammatical errors as we use highly authentic and licit sources.

 

Our confidential essay writing service protects your privacy

We cherish your trust and do our best to protect you. Anything that you share with our private essay writing service is never misused as the access to your personal data is very limited. Your payment details and credit card number also fall under strict protection when you buy a custom essay online from us.

    Meet Our Team

    Wondering who’s working behind the scenes of our professional essay writing service? We have over 700 amazing people on our team including developers, QA engineers, designers, managers, HR specialists, marketers, essay writers, and many more. See who takes care of the orders you place.

     

    Super writers

    There are 400+ essay writers from all over the world on our team who go through a 3-step hiring process. We call them super-writers because most of them have master’s degrees; therefore, they know the ins and outs of the discipline in which they specialize.

     

    WOW-support

    Our extra-fast and caring support assistants answer your questions 24/7 and resolve any of your troubles. Our team was even nominated for the 2019 Best Quality Management Team Award by the European Contact Centre & Customer Service.

    If you are looking for a reputable and cheapest college essay writing service or homework help websites for college students to write your essay for you or do your homework, you are at the right place. We have more than 1000 essay writers who can help you write your essays for you. Just fill the order form above to submit your instructions and get an online essay helper or essay writer who can “write my essay for me”. Once you do, you will be happy that you used our essay services instead of any other online essay writing service.

    Talk To Us

    Need any help? Feel free to Send Us a Note

    Email:  support@eliteacademicessays.com