Chapter8_Homework

docx

School

Northern Virginia Community College *

*We aren’t endorsed by this school

Course

ITP 100

Subject

Computer Science

Date

Feb 20, 2024

Type

docx

Pages

4

Report

Uploaded by DeanFlagTurtle40

Chapter 8 Homework 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”. a. Constant integer SIZE = 4 Declare String names[SIZE] = “Einstein”,”Newton”,”Copernicus”,”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. a. Contant Integer SIZE = 20 For index = 0 To Size -1 Display names[index] End For 3. Assume the arrays numberArray1 and numberArray2 each have 100 elements. Write a pseudocode algorithm that copies the values in numberArray1 to numberArray2 . a. Constant Integer SIZZE = 100 For Index = 0 To SIZE = -1 Set numberArray1[Index] = numberArray2[Index] End For 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. a. Function Integer getTot(integer array, integer arraySize) Declare Integer Index Declare Integer Total = 0 For Index = 0 to arraySize -1 Set Total = total + array(index) End For Return Total End Function 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 For Num(values) Display Num End For
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
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help