JAVA PROGRAM(LL)+MINDTAP (1 TERM) V2.0
JAVA PROGRAM(LL)+MINDTAP (1 TERM) V2.0
9th Edition
ISBN: 9780357616673
Author: FARRELL
Publisher: CENGAGE L
Expert Solution & Answer
Book Icon
Chapter 7, Problem 3PE

a.

Explanation of Solution

Program:

File name: “CountSpaces.java

//Define a class named CountSpaces

public class CountSpaces

{

    //Define main method

    public static void main(String[] args)

    {

        //Read a String that holds an inspirational quote

        String aString =

        "The best and most beautiful things in the world " +

"cannot be seen or even touched - they must be felt with the heart.";

        //Declare the variables and initialize the value

        int numSpaces = 0;

        int stringLength = aString...

b.

Explanation of Solution

Program:

File name: “CountSpaces2.java

//Import necessary header files

import java.util.*;

//Define a class named CountSpaces2

public class CountSpaces2

{

    //Define main method

    public static void main(String[] args)

    {

        //Create an object for the Scanner class

        Scanner in = new Scanner(System.in);

        //Declare the variables and initialize the value

        String aString;

        int stringLength;

        int numSpaces = 0;

        //Prompt the user to enter an inspirational quote

        System.out.print("Enter an inspirational quote >> ");

        aString = in.nextLine();

        //Read the length of the string

        stringLength = aString...

Blurred answer
Students have asked these similar questions
• Solve the problem (pls refer to the inserted image)
Write .php file that saves car booking and displays feedback.  There are 2 buttons, which are <Book it> <Select a date>. <Select a date> button gets an input from the user, start date and an end date. Book it button can be pressed only if the start date and ending date are chosen by the user. If successful, it books cars for specific dates, with bookings saved. Booking should be in the .json file which contains all the bookings, and have the following information: Start Date. End Date. User Email. Car ID. If the car is already booked for the selected period, a failure message should be displayed, along with a button to return to the homepage. In the booking.json file, if the Car ID and start date and end date matches, it fails Use AJAX: Save bookings and display feedback without page refresh, using a custom modal (not alert).
Write .php file with the html that saves car booking and displays feedback.  Booking should be in the .json file which contains all the bookings, and have the following information: Start Date. End Date. User Email. Car ID. There are 2 buttons, which are <Book it> <Select a date> Book it button can be pressed only if the start date and ending date are chosen by the user. If successful, book cars for specific dates, with bookings saved. If the car is already booked for the selected period, a failure message should be displayed, along with a button to return to the homepage. Use AJAX: Save bookings and display feedback without page refresh, using a custom modal (not alert). And then add an additional feature that only free dates are selectable (e.g., calendar view).
Knowledge Booster
Background pattern image
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
    EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781305480537
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
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
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT