String Comparison V

Learning Outcomes
Utilize Java syntax in fundamental programming algorithms (a)
Recognize and apply the various input and output devices in programming (c)
Recognize and apply the various control structures (b)
Recognize an apply the basic debugging strategies in programming (c)
With this lab you gain further experience with fundamental Java constructs including variables,
assignment statements, comparing String objects, Scanner class, JOptionPane class.
0. Create an Eclipse Java project. The name of the project must be lab05_<your
FirstNameLastName>. For example, my project would be named, lab05_PeterNg.
1. Create a class named Order3Strings added to the project
2. Make sure you have a comment block at the beginning of each Java class to containing the following
* <your name>
* CS 160–02/03/04, Spring 2018 (Note: Write only your section nos.)
* Lab 5
In this exercise you
solve Programming Challenge 7, p 186 (189 in Edition 5) of your textbook
learn and practice the confirm dialog of the JOptionPane class
learn and practice and additional use of a Scanner object for the sake of splitting texts
Additional requirements are detailed as follows.
1. (2pt) Open a JOptionPane confirm dialog as shown on Figure 1 below. Follow the template
exactly. The syntax is similar to the other dialogs:

JOptionPane.showConfirmDialog(null, <ask for a choice here>,
<title line here>, JOptionPane.YES_NO_OPTION);
Note that by clicking one of the buttons this method returns an integer number which is one of
the two named constants
JOptionPane.YES_OPTION or JOptionPane.NO_OPTION

Leave a Reply

Your email address will not be published. Required fields are marked *