Answer:
Here is the program fulfilling all the requirements given:
import javax.swing.JOptionPane;
public class SuperPower{
public static void main(String[] args) {
String power;
power = JOptionPane.showInputDialog("What is your super power?");
power = power.toUpperCase();
JOptionPane.showMessageDialog(null, power);} }
Step-by-step explanation:
Does the file include a public class called "SuperPower"
See the statement:
public class SuperPower
Does the class include a public method called "main"? Is the "main" method static?
See the statement:
public static void main(String[] args)
Does the main method have a String assignment statement that uses "JOptionPane.showInputDialog"
See the statement:
power = JOptionPane.showInputDialog("What is your super power?");
Does the main method have a statement that uses "JOptionPane.showMessageDialog"?
See the statement:
JOptionPane.showMessageDialog(null, power);
Does the program convert the String from "JOptionPane.showInputDialog" using the "toUpperCase" method?
See the statement:
power = power.toUpperCase();
Does the submission include a screenshot that shows an Input dialog that asks, "What is your superpower?" Does the submission include a screenshot that shows a Message dialog stating " TO THE RESCUE!", where "" is the input converted to upper case?
See the attached screenshots
If the program does not let you enter an exclamation mark after "to the rescue" then you can alter the code as follows:
import javax.swing.JOptionPane;
public class SuperPower{
public static void main(String[] args) {
String power;
power = JOptionPane.showInputDialog("What is your super power?");
power = power.toUpperCase();
JOptionPane.showMessageDialog( null, power+"!");} } // here just add an exclamation mark which will add ! after the string stored in power