Question: Hello, experts! I need help with a coding assignment that involves the uses of characters, strings, and arrays in order for the program to run.
Hello, experts! I need help with a coding assignment that involves the uses of characters, strings, and arrays in order for the program to run. Anywhere that says "student code here" or "test your methods here" should be manipulated in order to run the program.
I have provided the steps to solve the program below:
Step 1
Define a constructor for the quiz2 class that takes three parameters that are chars, c1, c2, and c3. Initialize the class variable classArr to an array of three characters based on those parameters.
Step 2
Fill in the method called arrayToUpperCaseString that takes no parameters. This method returns a String that is the characters of the class variable classArr concatenated together into a single string, however, each character is converted to uppercase.
If we had created an classArr with the characters 'x', 'y', and 'z', then calling the arrayToUpperCaseString() on that object would return "XYZ".
Step 3
Now, write the method signature and body of the arrayToReverseString method. This method should be static because it is self-contained and doesn't depend on the class variable.
This method takes one parameter: an array of characters, called arr, and returns a String, which should be the characters of the parameter array in reverse order.
For example, if we were to pass an array that contained 'a', 'b', 'c', and 'd' to the method, the returned String would be "dcba".
Test Your Methods
Test your methods by calling them within main. You may run your program in Develop mode as many times as you would like, but you may only submit your program once.
CODE:
public class quiz2 { char [] classArr;
// Step 1 public quiz2(char c1, char c2, char c3) { // student code here }
// Step 2 public String arrayToUpperCaseString() { // student code here }
// Step 3 // student code here
public static void main(String[] args) { // test your methods here! }
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
