Question: In this lab, you complete a partially written Java program that includes built - in functions that convert strings to all uppercase or all lowercase.
In this lab, you complete a partially written Java program that includes builtin functions that convert strings to all uppercase or all lowercase. The program prompts the user to enter any string. To end the program, the user can enter done. For each string entered, call the builtin functions lower and upper The program should call these functions using a string object, followed by a dot followed by the name of the function. Both of these functions return a string with the string changed to uppercase or lowercase. Here is an example:
sample "This is a String." result sample.lower result sample.upper
The source code file provided for this lab includes the necessary variable initializations and the necessary input and output statements. Comments are included in the file to help you write the remainder of the program.
An example of the program is shown below:
Enter lowercase characters: adventure ADVENTURE Enter uppercase characters: ADVENTURE adventure
import javax.swing.;
public class ChangeCase
public static void mainString args
String sample;
String result;
sample JOptionPane.showInputDialogEnter a string or done when you want to quit.";
whilesamplecompareTodone
Call toLowerCase method here and print the result.
System.out.printlnLowercase: result;
Call toUpperCase method here and print the result.
System.out.printlnUppercase: result;
sample JOptionPane.showInputDialogEnter a string or done when you want to quit.";
System.exit;
End of main method.
En
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
