Computers and Technology

Assume the following main module is in a program that includes the binarysearch function that was shown in this chapter. why doesn't the pseudocode in the main module work?

// this program uses the binarysearch function to search for a
// name in the array. this program assumes the binarysearch
// function has already been defined.

module main()
constant integer size = 5
declare string names[size] = "zack", "james", "pam", "marc", "susan"
declare string searchname
declare integer index
display "enter a name to search for."
input searchname
set index = binarysearch(names, searchname, size)
if index ! = -1 then
display searchname, " was found."
else
display searchname, " was not found."
end if
end module

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 00:30, Thisisdifinite
Which of the following would you find on a network
Answers: 3
image
Computers and Technology, 23.06.2019 09:30, blake2001
Which of the following tasks is an audio technician most likely to perform while working on a nature documentary? (select all that apply). eliminating potentially distracting background noise adding sound effects making sure the lighting is adequate for a particular scene changing the narration to better match the mood of the documentary
Answers: 3
image
Computers and Technology, 23.06.2019 18:00, yedida
File account. java (see previous exercise) contains a definition for a simple bank account class with methods to withdraw, deposit, get the balance and account number, and return a string representation. note that the constructor for this class creates a random account number. save this class to your directory and study it to see how it works. then write the following additional code: 1. suppose the bank wants to keep track of how many accounts exist. a. declare a private static integer variable numaccounts to hold this value. like all instance and static variables, it will be initialized (to 0, since it’s an int) automatically. b. add code to the constructor to increment this variable every time an account is created. c. add a static method getnumaccounts that returns the total number of accounts. think about why this method should be static - its information is not related to any particular account. d. file testaccounts1.java contains a simple program that creates the specified number of bank accounts then uses the getnumaccounts method to find how many accounts were created. save it to your directory, then use it to test your modified account class.
Answers: 3
image
Computers and Technology, 23.06.2019 20:50, terryhgivens5349
3.11.3 quiz: comparing and analyzing function typesquestion 4 of 102 pointswhat can you say about the y-values of the two functions f(x) = 3x2-3 andg(x)=2* - 3?
Answers: 2
Do you know the correct answer?
Assume the following main module is in a program that includes the binarysearch function that was sh...

Questions in other subjects:

Konu
Biology, 16.10.2021 20:50