EBK BUILDING JAVA PROGRAMS
EBK BUILDING JAVA PROGRAMS
4th Edition
ISBN: 9780134323718
Author: Stepp
Publisher: PEARSON CUSTOM PUB.(CONSIGNMENT)
bartleby

Videos

Expert Solution & Answer
Book Icon
Chapter 3.3, Problem 22SCP

Explanation of Solution

Program:

//Import the package

import java.util.Scanner;

//Create a class

public class NameGame

{

    //Define the method

    public static void main(String[] args)

    {

        //Create Scanner object

        Scanner inp = new Scanner(System.in);

        //Prompt the user to enter the name

        System.out.print("What is your name? ");

        //Get the name from the user

        String full_name = inp.nextLine();

        //Find the index of the space

        int space_Index = full_name.indexOf(" ");

        //Find the first name

String first_Name = full_name.substring(0, space_Index);

        //Find the last name

String last_Name = full_name.substring(space_Index + 1);

        //Call the method with the first name

        song(first_Name);

        //Call the method with the last name

        song(last_Name);

    }

    //Define the method

    public static void song(String nam)

    {

        //Find the rest of the substring

        String rest_name = nam...

Blurred answer
Students have asked these similar questions
Write the SQL code that permits to implement the tables: Student and Transcript. NB: Add the constraints on the attributes – keys and other.
Draw an ERD that will involve the entity types: Professor, Student, Department and Course. Be sure to add relationship types, key attributes, attributes and multiplicity on the ERD.
Draw an ERD that represents a book in a library system. Be sure to add relationship types, key attributes, attributes and multiplicity on the ERD.

Chapter 3 Solutions

EBK BUILDING JAVA PROGRAMS

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
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
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Java random numbers; Author: Bro code;https://www.youtube.com/watch?v=VMZLPl16P5c;License: Standard YouTube License, CC-BY