Ch4 Solutions
Ch4 Solutions
1. Create a GUI application to accept a string and display it in reverse order using the
substring() method.
A) Design;
Coding;
Output;
2. Create a GUI application to create random whole numbers between 2 float numbers
input by the user.
A) Design;
Coding;
Coding;
Output;
4. Create a GUI application to accept the date (as 1), month (as a number like 3 for
March) and year (as 2010) in separate text fields and display the date in the format:
dd/mm/yy. Take care of the following points while creating the application:
● Verify the date input before displaying it in the suggested format and display
error messages wherever applicable.
● The date is accepted as 1 (for the first of any month) but should be displayed as
01 in the final format.
● The year is accepted as ‘2010’ but displayed as 10 in the final format.
A) Design;
Coding;
if (month>12 || month<1){
JOptionPane.showMessageDialog(null,"Invalid month.");}