subject

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.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 14:00
Are segments of dna that determine traits and are passed down from parents to offspring.
Answers: 2
question
Computers and Technology, 22.06.2019 10:00
Create a word problem that involves calculating the volume and surface area of a three-dimensional object. cube: surface area 6 s2 , volume s3
Answers: 3
question
Computers and Technology, 22.06.2019 18:30
Kto rozmawia z clamentain przez krótkofalówke w the walking dead w 4 epizodzie
Answers: 1
question
Computers and Technology, 22.06.2019 20:00
How is the number 372 written when expanded out to place values in the base 8 (octal) number system? a. 2 x 4 + 3 x 2 + 4 x 1 b. 3 x 64 + 7 x 8 + 2 x 1 c. 3 x 8 + 7 x 7 + 2 x 6 d. 3 x 100 + 7 x 10 + 2 x 1
Answers: 1
You know the right answer?
Write the Java code to keep track of two arrays: a list of names and a list of secret numbers. Each...
Questions
question
Mathematics, 10.04.2020 20:58
Questions on the website: 13722362