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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 00:30, Angellbatton6763
At an open or uncontrolled intersection, yield if a. your road is paved and the crossroad is not b. the cross road is paved and yours is not c. you have two or more passengers in your vehicle d. you did not yield in the last intersection
Answers: 1
image
Computers and Technology, 22.06.2019 19:00, SoccerHalo
How is the number 110 written when expanded out to place values in the base 2 (binary) number system? options: 2 x 4 + 3 x 2 + 4 x 1 1 x 2 + 1 x 2 + 0 x 2 1 x 100 + 1 x 10 + 0 x 1 1 x 4 + 1 x 2 + 0 x 1
Answers: 1
image
Computers and Technology, 22.06.2019 22:30, josephmelichar777
Write a full class definition for a class named player , and containing the following members: a data member name of type string .a data member score of type int .a member function called setname that accepts a parameter and assigns it to name . the function returns no value. a member function called setscore that accepts a parameter and assigns it to score . the function returns no value. a member function called getname that accepts no parameters and returns the value of name .a member function called getscore that accepts no parameters and returns the value of score .this is what i have, aparently this is wrong: class player{private: string name; int score; public: void player: : setname (string n){name =n; }void player: : setscore (int s){score = s; }string player: : getname (){return name; }int player: : getscore (){return score; }};
Answers: 2
image
Computers and Technology, 23.06.2019 00:00, brooklyn4932
What engine component is shown in the above figure?
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 in other subjects: