$20
Creating application classes is a basic skill for object-oriented software development. Your program can’t create an object without a class to work from, and it’s the class that lends an object both its attributes and its methods. Thus, the class with its attributes and methods represents the first essential step in the object-oriented programming methodology. In this Assignment, you will create an application class that contains several methods.
To complete this Assignment:
Create a class that that contains five different methods.
The first method should be named greeting() and should display a JOptionPane that is customised 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!’
Alert box with Welcome message
Figure 1
The second method should be named getFirstNumber() and should display a JOptionPane that is customised in the following ways:
There should be a question mark icon on this message box.
The title bar on this message box should read ‘First number?’
The message box should allow the user to input the first number.
The third method should be named getSecondNumber() and should display a JOptionPane that is customised in the following ways:
There should be a question mark icon on this message box.
The title bar on this message box should read ‘Second number?’
The message box should allow the user to input the second number.
The fourth method should be named swapNumber() and should display JOptionPanes as follows:
In this method, you need to swap the value of the first number with the value of the second number. You can think of some temporary variable to do the swapping. Here is an example of how swapping works:
Before swapping:
First = 10
Second = 5
After swapping:
First = 5
Second = 10
The new value of first variable shall be incremented by 100, whereas the new value of second variable shall be incremented by 50.
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 first number (X) in the format ‘The new value of first number is: X’.
The method should display another JOptionPane with an information icon that has ‘Summary’ as the title bar text.
This message box should display the second number (Y) in a similar format to the first message: ‘The new value of second number is: Y’.
In order to accomplish this task, you will need to discover how to convert a string to an integer to perform the calculation.
For all Assignments:
Before uploading, test your code to be certain that it can perform the required task