Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

Programming Pseudocode

kumar
kumar 


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
Tags
Clarifications

Answers

Pseudocode and Java code for verifying

dianagaby2002
dianagaby2002 



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
pseudo.txt (1 K) Download Preview
:= 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) Download 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",

Screenshots
Purchase Answer