Question

Part I Short Answer (50 points) 1. Write a pseudocode declaration for a String array initialized...

Part I Short Answer (50 points) 1. Write a pseudocode declaration for a String array initialized with the following strings: “Einstein”, “Newton”, “Copernicus”, and “Kepler”. 2. Assume names in an Integer array with 20 elements. Write a pseudocode algorithm a For Loop that displays each element of the array. 3. Assume the arrays numberArray1 and numberArray2 each have 100 elements. Write a pseudocode algorithm that copies the values in numberArray1 to numberArray2 . 4. Write a pseudocode algorithm for a function that accepts an Integer array as an argument and returns the total of the values in the array. 5. Write a pseudocode algorithm that uses the For Loop to display all the values in the following array: Constant Integer SIZE = 10 Declare Integer values[SIZE] = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 Part II Programming Exercise (50 points) Number Analysis Program Write a pseudocode algorithm that asks the user to enter a series of 20 numbers. The program should store the numbers in an array and then display the following data: • The lowest number in the array • The highest number in the array • The total of the numbers in the array • The average of the numbers in the array

0 0
Add a comment Improve this question Transcribed image text
Answer #1

PART -1

  1. Pseudocode for declare string array and initialize it with “Einstein”,”Newton”,”Copernicus”,”Kepler”

PSEUDOCODE

STEP-1 String[4] = {“Einstein”,”Newton”,”Copernicus”,”Kepler”}

  1. PSEUDOCODE

STEP-1       REPEAT FOR i = 1 TO 20

                             Write : names[i]

                   End of Loop

  1. PSEUDOCODE

STEP-1        REPEAT FOR i = 1 TO 100

                   numberArray2[i] = numberArray1[i]

                   End of Loop

  1. PSEUDOCODE

integer length(int arr[])

Step -1        Sum = 0

STEP-2        Repeat for I = 1 to length_of_array

                             Sum = Sum + arr[i]

                   [End of loop]

STEP-3        Return Sum

  1. PSEUDOCODE

STEP-1       REPEAT FOR i = 1 TO SIZE

                             Write : values[i]

                   End of Loop

PART – II

ALGORITHM NUMBER_ANALYSIS()

  1. Declare A[20]
  2. Set Sum := 0
  3. Repeat for i = 1 to 20

Input A[i]

              [End of loop]

  1. Set low := A[1]
  2. Set high := A[1]
  3. Repeat for i = 1 to 20

IF (low > A[i])

          low := A[i]

[End of If]

IF (high < A[i])

          high := A[i]

[End of if]

Sum := Sum + A[i]

               [End of loop]

  1. Avg := Sum/20
  2. Write : low
  3. Write : high
  4. Write : Sum
  5. Write : Avg
  6. Return

                  

Add a comment
Know the answer?
Add Answer to:
Part I Short Answer (50 points) 1. Write a pseudocode declaration for a String array initialized...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a program that performs the following operations on a one dimensional array with 50 unsigned...

    Write a program that performs the following operations on a one dimensional array with 50 unsigned integers. The main program will initialize the array, print the array values to the screen and then call a function that will determine and print the maximum and minimum values. •Declare the array and any other variables. •Use a loop to initialize the array with 50 random integer values between 0 and 99 using the rand() function. (number = rand() % 100;) •Using cout...

  • C++. Write a program that copies the contents of one array into another array but in...

    C++. Write a program that copies the contents of one array into another array but in reverse order using pointers.           - in main()                    - define 2 arrays of type int, 10 elements each                              - initialize one array with numbers 1 through 10                              - initialize all elements of the second array to 0                    - call function reverseCopy with both arrays as arguments                    - display the values of array number 2 (reversed order)           - reverseCopy...

  • programing C,already write part of code (a) Write a function print.array that receives an array of...

    programing C,already write part of code (a) Write a function print.array that receives an array of real numbers and the number of el stored in the array. This function must display the elements of the array in order with each one on a line by itself in a field width of 7 with two decimal places. (See sample output. Recall the format specifier would be "%7.21f"). (b) Sometimes we want to treat an array as a mathematical vector and compute...

  • Q1) How would you declare an array of doubles called myDoubles? Arrays can be initialized in...

    Q1) How would you declare an array of doubles called myDoubles? Arrays can be initialized in one of two ways. In one method, the array elements are placed in a list enclosed in curly braces after the array name definition. For example, the code below creates an array of ints with 3 elements: 1, 2 and 3. int[] a = {1, 2, 3, 4}; We can also initialize an array with a new construct, indicating how many elements we want...

  • In C language 1. Write a program to declare and initialize an array of size 5...

    In C language 1. Write a program to declare and initialize an array of size 5 and place odd numbers 3, 5, 7,9 and 11 in it. Declare and initialize another array of size 5 and place even numbers 4, 6, 8, 10 and 12 in it. Write a for loop to add each element and place it in a third array of the same dimensions. Display each array.

  • Q1. Write a program in Java         a. Create 2 separate arrays, of user defined values,...

    Q1. Write a program in Java         a. Create 2 separate arrays, of user defined values, of same size         b. Add these 2 arrays. ........................................................................................................................... Q2. Write a program in java (using loop) input any10 numbers from user and store in an array. Check whether each of array element is positive, negative, zero, odd or even number. ............................................................................................................................ Q3. Write a program in Java to display first 10 natural numbers. Find the sum of only odd numbers. .............................................................................................................................. Q4....

  • P3 - An Array of objects (120 points) Write a main program and declare an array...

    P3 - An Array of objects (120 points) Write a main program and declare an array of 5 RectangularCube objects [20pts). a. Use a loop to initialize an array of RectangularCube. In the body of the loop use the rand () function to generate random integers between 1 and 10 to assign to length, width and height data fields of each RectangularCube object (40pts) b. Write the function with header void printCube (RectangularCube rs) that receives an object of the...

  • ** C++ LANGUAGE ** Write a function that will implement each Fibonacci number with the help...

    ** C++ LANGUAGE ** Write a function that will implement each Fibonacci number with the help of an integer array of size 100 (elements of this array will be digits of the Fibonacci number). When the function is called to find , it will calculate all Fibonacci numbers from to using the basic formula . To add two Fibonacci numbers, the function will add elements of two arrays corresponding to and and store their sums in the array corresponding to...

  • Lab Topics • The basics of Array object Use the following Coding Guidelines • When declaring...

    Lab Topics • The basics of Array object Use the following Coding Guidelines • When declaring a variable, you usually want to initialize it. Remember you cannot initialize a number with a string. Remember variable names are case sensitive. Use tabs or spaces to indent code within blocks (code surrounded by braces). Use white space to make your program more readable. Use comments after the ending brace of classes, methods, and blocks to identify to which block it belongs. Problem...

  • C++ programming please Write a program that will display random numbers in order from low to...

    C++ programming please Write a program that will display random numbers in order from low to high. 1. Declare an integer array of size 100. Ask the user how many numbers to work with (n). It can be less than 100. 2. Generate random numbers from 10 to 50. 3. Write the random numbers to an output file named random.dat. Close the file. 4. Open random.dat for input and read the data values into your array. Pass your array to...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT