Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedThe 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database Design With Microcomputer Applications

Authors: Glenn A. Jackson

1st Edition

0137718411, 978-0137718412

More Books

Students also viewed these Databases questions

Question

Coordinating privacy office meetings.

Answered: 1 week ago

Question

Determine the amplitude and period of each function.

Answered: 1 week ago

Question

6. The cost of the training creates a need to show that it works.

Answered: 1 week ago