Question: Starting from Java 1 A , use JOptionPane ( pg 9 3 ) to ask the user for the same five variables. JOptionPane only returns

Starting from Java1A, use JOptionPane (pg 93) to ask the user for the same five variables. JOptionPane only returns Strings, so you must convert them to the corresponding data type using parse (pg 96), then assign them to the variables. Though not in the book, Boolean.parseBoolean() works like the other parse methods. You must enter either true or false when getting the user response. To print the variables, use JOptionPane.showMessageDialog(). The message can span multiple lines, but a single literal (in quotes) may not. You should only have one statement to show all the results. Do not show the results individually. All Java programs must have a Class Header and a main Method Header, like Java 1A.( UNT-'24).
EX:
Name: Prince Humperdinck
Age: 29
Letter Grade: C
AIS Member: true
Desired Salary: 200000.0
Hints/Tips:
Remove the assigned values from Java 1A, then assign them using JOptionPane.
Dont forget to import the JOptionPane package at the start of the program.
Use toUpperCase()(pg 75) to convert the letter grade to uppercase (it goes after the close parenthesis of JOptionPane). Then, use charAt()(pg 74) to convert it to a char (it goes after the close parenthesis of toUpperCase).
To convert the starting salary to a double, use Double.parseDouble (pg 96) to convert the String returned from JOptionPane.
This time, you must rewrite println using JOptionPane.showMessageDialog() to display the message.
In the JOptionPane message, use
to put each piece of info on a separate line. Since each variable is on a separate line, you should use labels (as shown in the example).
Rubric
Doesnt use JOptionPane to allow the user to assign the five variables (-.6 each)
Doesnt use JOptionPane to allow the user to display the five variables (-.4 each)
Code is not formatted correctly (-.1)
Doesnt do System.exit(0) for JOptionPane (-.02)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!