Question: Practice: Two-dimensional arrays Design an algorithm that takes two locations from the user and outputs the correct points, as shown in the table above. For

 Practice: Two-dimensional arrays Design an algorithm that takes two locations from

Practice: Two-dimensional arrays

Design an algorithm that takes two locations from the user and outputs the correct points, as shown in the table above. For this problem you only need to output what is on the white lines of the table.

  1. You must declare the 2D array and give it a suitable name, but for initialization you can simply write input mySuitablyNamedArray from points table.
  2. The user enters the two locations as numbers, for example 0 would refer to Main, US, Alaksa, Canada, 1 would refer to Hawaii, etc.
  3. If points are not applicable for a pair of locations, output "NA" to the user. For this part, think of how will you handle the "-" in the table above that means not applicable. What value might best represent this in the 2D array? Recall our Sentinel Value discussion in Week 4.

This is worth 10 points.

Europe South Amaricn 1 125 7.5 625 Central Amenta South Amenca 1 25 h Amenia 2 12.5 dde Eazt

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!