MindTapV2.0 for Farrell's Java Programming with 2021 Updates, 9th Edition [Instant Access], 1 term
MindTapV2.0 for Farrell's Java Programming with 2021 Updates, 9th Edition [Instant Access], 1 term
9th Edition
ISBN: 9780357505540
Author: Farrell; Joyce
Publisher: Cengage Learning US
bartleby

Videos

Expert Solution & Answer
Book Icon
Chapter 8, Problem 3PE

a.

Explanation of Solution

Program:

File name: “CarCareChoice.java

//Import necessary header files

import javax.swing.*;

//Define a class named CarCareChoice

public class CarCareChoice

{

    //Define a main method

    public static void main (String[] args)

    {

        //Declare a Boolean variable and initialize the value

        boolean isMatch = false;

        //Declare a list of available services

        String[] items =  { "oil change", "tire rotation",

         "battery check", "brake inspection"};

        //Declare an array of values

        int[] prices = {25, 22, 15, 5};

        //Declare the variables

        int x;

        int matchIndex = 0;

        //Prompt the user to enter a selection

        String menu = "Enter selection:";

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

        menu += "\n   " + items[x];

        //Show input dialog box

        String selection = JOptionPane...

b.

Explanation of Solution

Program:

File name: “CarCareChoice2.java

//Import necessary header files

import javax.swing.*;

//Define a class named CarCareChoice2

public class CarCareChoice2

{

    //Define a main method

    public static void main (String[] args)

    {

        //Declare a Boolean variable and initialize the value

        boolean isMatch = false;

        //Declare a list of available services

        String[] items =  { "oil change", "tire rotation",

         "battery check", "brake inspection"};

        //Declare an array of values

        int[] prices = {25, 22, 15, 5};

        //Declare the variables

        int x;

        int matchIndex = 0;

        //Prompt the user to enter a selection

        String menu = "Enter selection:";

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

            menu += "\n   " + items[x];

        //Show input dialog box

String selection = JOptionPane...

Blurred answer
Students have asked these similar questions
Design and draw a high-level "as-is" process diagram that illustrates a current process related to a product or service offered through the SSDCI.gov database.
Compare last-mile connections for connecting homes and businesses to the Internet
Explain wireless networking standards
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.
Recommended textbooks for you
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Dictionaries - Introduction to Data Structures (Episode 8); Author: NullPointer Exception;https://www.youtube.com/watch?v=j0cPnbtp1_w;License: Standard YouTube License, CC-BY