Computers and Technology

Write the Java code to keep track of two arrays: a list of names and a list of secret numbers. Each position in the name array refers to a person whose secret number is stored in the corresponding position of the secret number array. For instance, if the names array contains Alice, Charlie, and Bob and the secret numbers are 42, 111, and 12 (in those orders), then Charlie’s secret number is 111. The program should ask the user how many names will be entered, create a String array reference variable and array object of the appropriate length, then allow the user to enter enough names to fill the array. An integer array reference variable and array object should also be created with the the same size with all values initialized to 1. The secret numbers for each person will be computed by combining the results of the following methods: • A public static int method that accepts a String formal parameter, computes the square root of the String’s length, and returns the ceiling (i. e., Math. ceil) of the value. The actual parameter sent to this method must be a name from the array.
• A public static int method that accepts two Strings as formal parameters. This method computes and returns the number of consonants in common between the two Strings, ignoring upper-case and lower-case. (Hint: Count how many of each of the 19 consonants are in both Strings using two counting arrays, then check how many positions in both counting arrays are non-zero.) Should there be no Strings in common, the number one (1) is returned. One actual parameter sent to this method must be a name from the array, and the other is left up to the student.
• A public static int method that accepts one integer and one String as formal parameters. Retrieve the character in the String parameter at the position indicated by the integer parameter. The character is then cast to an integer and returned to the calling method. Should the integer be an invalid position for the given String, the number one (1) is returned. The String actual parameter sent to this method must be a name from the array, and the integer’s value is left up to the student. Include at least two ways to combine the results of each method above to produce a secret number. Allow the user to choose which combination of methods to apply. The same combination may be used for each name in a program execution. An example which multiplies the three results is given below. The names and secret numbers should then be printed using the following method: A public static void method that accepts a String array and an integer array as formal parameters and prints the values in the order given.

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 06:30, darlene93
You are consulting for a beverage distributor who is interested in determining the benefits it could achieve from implementing new information systems. what will you advise as the first step?
Answers: 1
image
Computers and Technology, 23.06.2019 09:00, vetterk1400
Design a class tictactoe that: holds the following information about the game: two-dimensional array (3 by 3), and winner. add additional variables as needed. includes the functions to perform the various operations on objects. for example, function to print the board, getting the move, checking if move is valid, determining if there is a winner after each move. add additional operations as needed. includes constructor(s). write the functions of the class, and write a program that uses the class. the program should declare an object of type tictactoe. the program will create the board and store it in the array. the program will allow two players to play the tic-tac-toe game. after every valid move update the array, check if there is a winner. if there is no winner and no tie, then print the board again to continue.
Answers: 2
image
Computers and Technology, 23.06.2019 10:00, serenityharmon1
Hey i just logged on and one of the moderators deleted a bunch of my answers to questions, even though the answers were right and the people it doesn't make sense but if anyone wants to talk about anything just message me lol (this is super random lol)
Answers: 1
image
Computers and Technology, 23.06.2019 12:00, kp2078
What type of slide show is a dynamic and eye-catching way to familiarize potential customers with what your company has to offer? a. ole b. photo album c. brochure d. office clipboard
Answers: 2
Do you know the correct answer?
Write the Java code to keep track of two arrays: a list of names and a list of secret numbers. Each...

Questions in other subjects:

Konu
Social Studies, 25.01.2021 19:00
Konu
Advanced Placement (AP), 25.01.2021 19:00
Konu
Mathematics, 25.01.2021 19:00