In pseudocode, declare a 1-dimensional array of Strings named City that will hold up to 10 cities. Then write a “for” loop that would prompt a user to input a City name for each of the 10 cities.
In pseudocode, declare an array to hold up to 5 Integers. Then write a loop that inputs a number for each of the array elements. Finally, provide the pseudocode that would calculate and print the average of those 5 integers.
In pseudocode, declare a 2-dimensional array of integers that would store the multiplication table of up to 10x10. (100 elements total need to be stored) Use a nested repetition loop of your choice to store each of the values. Be sure to walk through your code and make sure it is properly calculating each of the elements.
What applications can you think of that would be good candidates to use a 2-dimensional array? Be specific and explain exactly how you envision the array could be used?
Attachments
No attachments uploaded
Tags
Clarifications
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'cramshark'; // required: replace example with your forum shortname
var disqus_identifier = '/production/317';
/* * * DON'T EDIT BELOW THIS LINE * * */
(function () {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
Please enable JavaScript to view the comments powered by Disqus.

int sum:= 0;//used in calculating the average of numbers

double avg;//will store the average

int count := 0;/*counts the numbers(you know there are 5, but i use it for general purpose)*/

type vector = City[1...10] of string;

type vector = numbers[1..5] of integer;

type matrix = _2d[11][11] of integer;

for i:=0 to length(City)-1{

......... Attachments
No screenshots uploaded

double avg;//will store the average

int count := 0;/*counts the numbers(you know there are 5, but i use it for general purpose)*/

type vector = City[1...10] of string;

type vector = numbers[1..5] of integer;

type matrix = _2d[11][11] of integer;

for i:=0 to length(City)-1{

......... Attachments

pseudo.txt (1 K)
Preview

J_code_to_verify.java (1 K) Preview

Screenshots
:= 0;/*counts the numbers(you know there are 5, but i use it for general purpose)*/
type vector = City[1...10] of string;
type vector = numbers[1..5] of integer;
type matrix = _2d[11][11] of integer;
for i:=0 to length(City)-1{
writeln("City name (");
writeln(i);

J_code_to_verify.java (1 K) Preview

sc.nextLine();
}
System.out.println("\n\n");
for(int i=0; i<numbers.length; i++){
System.out.println("Number [" + i + "]= ");
numbers[i] = sc.nextInt();
}
for(int i=0; i<numbers.length; i++){
count++;
sum = sum + numbers[i];
}
/*"avg" is a double, and "sum",