Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1//import a scanner 2 //Create a class for a file BookIndex.java 3 //open curly bracket for the class 4 // put the main method
1//import a scanner 2 //Create a class for a file BookIndex.java 3 //open curly bracket for the class 4 // put the main method here 5 // open curly bracket for the main method 6 // Create a Scanner object 7//Print to the Screen "Enter the Title of Chapter 1: " 8 // Create a String called chOne that takes in the users Chapter Title. 9 //Print to the Screen "Enter the Title of Chapter 2: " 10 // Create a String called chTwo that takes in the users Chapter Title. 11//Print to the Screen "Enter the Title of Chapter 3: " 12 // Create a String called chThree that takes in the users Chapter Title. 13 //Print to the Screen "Enter the Title of Chapter 4: 14 // Create a String called chFour that takes in the users Chapter Title. 15//Print to the Screen "Enter the Title of Chapter 5: 16 // Create a String called chFive that takes in the users Chapter Title. 17//Create an empty String called chTitle and set it equal to " 18 // Create an int named chNum and set it equal to o 19 // Print the word "INDEX" that has 3 tabs before the word to the screen 20 // create a for loop that starts at 1 and goes 5 times 21// open curly bracket for the for loop 22 // create an if statement that executes ifi is equal to 1 23 // open curly for the if statement 24 //set chTitle equal to the String you made that stores the title of Chapter One 25 // Closing curly bracket for the if statement 26 // create an if statement that executes if iis equal to 2 27 // open curly for the if statement 28 //set chTitle equal to the String you made that stores the title of Chapter Two 29 // Closing curly bracket for the if statement 30 // create an if statement that executes ifi is equal to 3 31// open curly for the if statement 32 //set chTitle equal to the String you made that stores the title of Chapter Three 33 // Closing curly bracket for the if statement 34 // create an if statement that executes if i is equal to 4 35 // open curly for the if statement 36 //set chTitle equal to the String you made that stores the title of Chapter Four 37 // Closing curly bracket for the if statement 38 // create an if statement that executes ifi is equal to 5 39 // open curly for the if statement 40 //set chTitle equal to the String you made that stores the title of Chapter Five 41 // Closing curly bracket for the if statement 42 // Print chTitle to the screen but do not put the curser on the next line 43 //Create an integer named titleLength and set it to the character length of chTitle using the length() method 44//create a while loop and have it run while titleLength is less than 45 45//Open curly bracket for the while loop 46 //Print out a dot but do not put the curser on the next line 47 // add one to the value of titleLength 48 //closing curly bracket for the while loop 49 //Print out the equasion of i times 15 and make the curser go to the next line 50//Closing curly bracket for the for loop 51// Closing curly bracket for the main method 52// Closing curit bracket for the class BookIndex Booklndex.java 1 import java.util.Scanner; 2 public class BookIndex 3- { 4 5- 6 7 8 } Submit + Continue Save public static void main(String[] args) { }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started