1) Write an application class that contains several methods.
The first method should be named greeting () and should display a JOptionPane that is customized in the following ways (Figure 1):
- There should be no icon on this message box.
- The title bar on this message box should read "Welcome!"
- The message box should display "Welcome to my program!"
![1429_Write an application.png](https://secure.tutorsglobe.com/CMSImages/1429_Write%20an%20application.png)
Figure 1
The second method should be named getName() and should display a JOptionPane that is customized in the following ways (Figure 2):
- There should be a question mark icon on this message box.
- The title bar on this message box should read "Name?"
- The message box should allow the user to input his or her name.
![1898_Write an application1.png](https://secure.tutorsglobe.com/CMSImages/1898_Write%20an%20application1.png)
Figure 2
The third method should be named getAge() and should display a JOptionPane that is customized in the following ways (Figure 3):
- There should be a question mark icon on this message box.
- The title bar on this message box should read "Age?"
- The message box should allow the user to input his or her age.
![1570_Write an application2.png](https://secure.tutorsglobe.com/CMSImages/1570_Write%20an%20application2.png)
Figure 3
The fourth method should be named displayMessages() and should display JOptionPanes as follows (Figure 4, Figure 5):
- The method should first display a JOptionPane with an information icon that has "Summary" as the title bar text.
- This message box should display the user's name (X) and age (Y) in the format "X, you are Y years old!"
![494_Write an application3.png](https://secure.tutorsglobe.com/CMSImages/494_Write%20an%20application3.png)
Figure 4
- After the user closes the first message box, a second one should display that does the following:
- Displays a warning icon.
- Has "Guess What?" as the title bar text.
- Displays the message "In 10 years, you will be (correct age) years old!"
![1085_Write an application4.png](https://secure.tutorsglobe.com/CMSImages/1085_Write%20an%20application4.png)
Figure 5
- In order to accomplish this task, you will need to discover how to convert a String to an integer to perform the calculation.
Write a driver class. This class should use the main method to call four methods in the application class that will display our JOptionPanes.
Remember to write the source code for each class in a separate file which must have the same name as the class name with the extension '.java'. Remember also that by convention, class names commence with a capital letter.
As with all programs you write, you should provide a well-structured solution that is easy to read. You should use meaningful identifier names and should provide useful comments. A large portion of the marks for this assignment will be for the structure of the classes, not whether they work correctly or not.
The focus of the assignment is for you to familiarise yourself with the Java concepts introduced in this seminar (classes, instances, instance methods, constructors, method calls, JOptionPanes, etc).
It is a good idea to work in a step by step top-down manner. First define the general structure of a class with empty methods and compile the class. Once it compiles successfully, then add further detail, recompiling after every few lines. This way, the risk of getting several error messages at once is reduced.