Question: The program should display the three names arranged in the specified sort order of their lengths. i.e. first, display the name with the least number

The program should display the three names arranged in the specified sortThe program should display the three names arranged in the specified sort order of their lengths. i.e. first, display the name with the least number of characters, and so on. We can't use arrays but I don't know how to get the compareTo or equals function to work for this problem.

import javax. swing.JOptionPane; /eeded for dialog boxes public class firstmiddlelastnames f public static void main String args) String first; first JOptionPane. showInputDialogC"Enter your first name."; // prompts user to enter their first name String middle; middle JOptionPane. showInputDialogC" Enter your middle name."); String last; last JOptionPane.showInputDialogC"Enter your last name." String order; order-J0ptionPane.showInputDialogC"Enter the sorting order, 1 for ascending and 2 for descending order."); /USE COMPARETO OR EQUALS CNOT AS A HELP NO ARRAYS

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!