Java Programming, Loose-leaf Version
Java Programming, Loose-leaf Version
8th Edition
ISBN: 9781337685917
Author: Joyce Farrell
Publisher: Cengage Learning
bartleby

Videos

Expert Solution & Answer
Book Icon
Chapter 7, Problem 6PE

a.

Explanation of Solution

Program:

File name: “Alphabetize.java

//Import necessary header files

import java.util.*;

//Define a class named Alphabetize

public class Alphabetize

{

    //Define main method

    public static void main(String[] args)

    {

        //Declare the variables

        String str1, str2, str3;

        //Create an object for the Scanner class

        Scanner in = new Scanner(System.in);

        //Prompt the user to enter the first string

        System.out.print("Enter first string >> ");

        str1 = in.nextLine();

        //Prompt the user to enter the second string

        System.out.print("Enter second string >> ");

        str2 = in...

b.

Explanation of Solution

Program:

File name: “Alphabetize2.java

//Import necessary header files

import java.util.*;

//Define a class named Alphabetize2

public class Alphabetize2

{

    //Define main method

    public static void main(String[] args)

    {

        //Declare the variables

        String str1, str2, str3;

        //Create an object for the Scanner class

        Scanner in = new Scanner(System.in);

        //Prompt the user to enter the first string

        System.out.print("Enter first string >> ");

        str1 = in.nextLine();

        //Prompt the user to enter the second string

        System.out.print("Enter second string >> ");

        str2 = in.nextLine();

        //Prompt the user to enter the third string

        System.out.print("Enter third string >> ");

        str3 = in.nextLine();

        //Check if the Strings were entered in alphabetical order

        if(str1.toLowerCase().compareTo(str2.toLowerCase()) < 0)

            if(str2.toLowerCase().compareTo(str3.toLowerCase()) < 0)

                //Print the result

System.out.println(str1 + " " + str2 + " " + str3);

            else

            if(str3...

Blurred answer
Students have asked these similar questions
Create a Database in JAVA OOP that saves name of the player and how many labyrinths did the player solve. Record the number of how many labyrinths did the player solve, and if he loses his life, then save this number together with his name into the database. Create a menu item, which displays a highscore table of the players for the 10 best scores. Also, create a menu item which restarts the game. public class GameGUI extends JPanel {    private final Labyrinth labyrinth;    private final Player player;    private final Dragon dragon;     private void checkGameState() {        if (player.getX() == 0 && player.getY() == labyrinth.getSize() - 1) {            JOptionPane.showMessageDialog(this, "You escaped! Congratulations!");            System.exit(0);        }         if (Math.abs(player.getX() - dragon.getX()) <= 1 &&            Math.abs(player.getY() - dragon.getY()) <= 1) {            JOptionPane.showMessageDialog(this, "The dragon caught you! Game Over.");…
Change the following code so that the player can see only the neighboring fields at a distance of 3 units.   public class GameGUI extends JPanel {    private final Labyrinth labyrinth;    private final Player player;    private final Dragon dragon;     private final ImageIcon playerIcon = new ImageIcon("data/images/player.png");    private final ImageIcon dragonIcon = new ImageIcon("data/images/dragon.png");    private final ImageIcon wallIcon = new ImageIcon("data/images/wall.png");    private final ImageIcon emptyIcon = new ImageIcon("data/images/empty.png");     public GameGUI(Labyrinth labyrinth, Player player, Dragon dragon) {        this.labyrinth = labyrinth;        this.player = player;        this.dragon = dragon;         setFocusable(true);        addKeyListener(new KeyAdapter() {            @Override            public void keyPressed(KeyEvent e) {                char move = switch (e.getKeyCode()) {                    case KeyEvent.VK_W -> 'W';                    case…
Q/ Fill in the table below with the correct answers for the network devices and components required, then draw the topology diagram for the network of this three-story building: I want a drawing Cisco Packet tracer Ground Floor: This floor will house the main server room, reception area, and a few conference rooms. The server room should contain the core network devices that will connect the entire building. The reception area and conference rooms need network access require access for mobile devices for visitors and guests with devices. First Floor: This floor is dedicated to offices with workstations, each needing reliable network connectivity for staff computers, IP phones, IP camera, and printers. Second Floor (Education Department): This floor consists of educational spaces requiring controlled internet access. Only the educational website (https://uokerbala.edu.iq) should be accessible, with all other sites restricted.. Device Media type Location floor Type of IP Static/dynamic…
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
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
C - File I/O; Author: Tutorials Point (India) Ltd.;https://www.youtube.com/watch?v=cEfuwpbGi1k;License: Standard YouTube License, CC-BY
file handling functions in c | fprintf, fscanf, fread, fwrite |; Author: Education 4u;https://www.youtube.com/watch?v=aqeXS1bJihA;License: Standard Youtube License