Java Programming (MindTap Course List)
Java Programming (MindTap Course List)
8th Edition
ISBN: 9781285856919
Author: Joyce Farrell
Publisher: Cengage Learning
bartleby

Concept explainers

Expert Solution & Answer
Book Icon
Chapter 9, Problem 1PE

a.

Explanation of Solution

Program:

File name: “StringSort.java

//Import necessary header files

import java.util.*;

import javax.swing.*;

//Define a class named StringSort

public class StringSort

{

    //Define main method

    public static void main(String[] args)

    {

        //Create an array of 15 string values

String[] values =  {"mouse", "dog", "cat", "horse", "cow",

         "moose", "tiger", "lion", "elephant", "bird", "hamster",

         "guina pig", "leopard", "aardvark", "hummingbird"};

        //Declare the variable

      ...

b.

Explanation of Solution

Program:

File name: “StringSort2.java

//Import necessary header files

import java.util.*;

import javax.swing.*;

//Define a class named StringSort2

public class StringSort2

{

    //Define main method

    public static void main(String[] args)

    {

        //Create an array of 15 string values

        String[] values = new String[15];

        //Declare the variables and initialize the values

        int x = 0;

        int count = 0;

        String word;

        final String QUIT = "zzz";

        //Declare a Boolean variable and initialize the value

        boolean didUserQuit = false;

/*For loop is executed until x exceeds the length of the given values*/

        for(x = 0; x < values.length; ++x)

            values[x] = QUIT;

        //Assign value 0 to x

        x = 0;

        //While x is less than the length of the given values

        while(x < values.length)

        {

            //Prompt the user to enter a word

word = JOptionPane.showInputDialog(null, "Enter a word or " +

            QUIT + " to quit");

            //If the user enters zzz

            if(word.equals(QUIT))

            {

                count = x;

                x = values...

Blurred answer
Students have asked these similar questions
CSE330: Discrete Mathematics 1. In the classes, we discussed three forms of floating number representations as given below, (1) Standard/General Form, (2) Normalized Form, (3) Denormalized Form. Now, let's take, ẞ = 2, m = 3, emin = -2 and emax = 3. Based on these, answer the following: (a) (b) (c) (d) What are the maximum/largest numbers that can be stored in the system by these three forms defined above? (express your answer in decimal values) What are the non-negative minimum/smallest numbers that can be stored in the system by the denormalized form? (express your answer in decimal values) How many numbers (both non-negative and negative) can be represented in the above mentioned system using the general form? Explain your answer. Find all the decimal numbers for e = 3 and e = 2 in denormalized form, plot them on a real line and prove that all the numbers are not equally spaced. Write the equally spaced sets for the number line you drew. show your answer in Don't use any Al tool pen…
3.[20 pts] Find the minimum equivalent circuit for the one shown below (show your work): DAB 0 f(A,B,C,D)
Suppose your computer is responding very slowly to information requests from the Internet. You observe that your network gateway shows high levels of network activity even though you have closed your e-mail client, Web browser, and all other programs that access the Internet. What types of malwares could cause such symptoms? What steps can you take to check whether malware has gained access to your system? What tools can you use at each step? If you identify malware, what ways might it have entered your system? How can you restore your PC to safe operation, including the special software tools you may use?
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning