Write a program that prints a poem of your choice. If you don’t have a favorite poem, search the Internet for “Emily Dickinson” or “e e cummings”
E1.15 Type in and run the following program. Then modify it to show the message “Hello, your name!”.
import javax.swing.JOptionPane;public class DialogViewer
{
public static void main(String[] args)
{
JOptionPane.showMessageDialog(null, “Hello, World!”);
}
}
E1.16 Type in and run the following program. Then modify it to print “Hello, name!”, displaying the name that the user typed in.
import javax.swing.JOptionPane;public class DialogViewer
{
public static void main(String[] args)
{
String name = JOptionPane.showInputDialog(“What is your name?”);
System.out.println(name);
}
}
E1.17 (OPTIONAL) Modify the program from Exercise E1.16 so that the dialog continues with the message “My name is Hal! What would you like me to do?” Discard the user’s input and display a message such as
I’m sorry, Dave. I’m afraid I can’t do that.
Replace Dave with the name that was provided by the user.
Solution:
Looking for help with your homework?
Grab a 30% Discount and Get your paper done!