Java: An Introduction to Problem Solving and Programming (7th Edition)
7th Edition
ISBN: 9780133766264
Author: Walter Savitch
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 2, Problem 12E
What does the Java code
Scanner keyboard = new Scanner(System.in);
keyboard.useDelimiter("y");
System.out.println("Enter a String.");
String a = keyboard.next ();
String b = keyboard.next ();
System.out.println("a is" + a)’
System.out.println ("b is" + b);
display when the keyboard input is
By theprickingof my thumbs
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Write a program that opens a window that contains a button. The button is labled with "0" (zero).
With every click on the button, the number in its label increments by 1.(use Java)
Please write the Java code for a Time class:
Leave comments as explaination for how the code work, and finish the code.
Code:
import java.util.Scanner;
class Main
{
publicstaticvoid main(String args[])
{
Scanner scan = new Scanner(System.in);
String timeString;
int numMeetings;
System.out.print("What time is it now? ");
timeString = scan.nextLine();
Time.setCurTime(timeString);
System.out.print("Current time: ");
Time.showCurTime();
System.out.println();
System.out.print("How many meetings do/did you have today? ");
numMeetings = scan.nextInt();
scan.nextLine(); // dispose of newline character
}
}
/* Sample Output:
What time is it now? 15:45
Current time: 15:45
How many meetings do/did you have today? 5
What time is meeting #1? 16:00
What time is meeting #2? 16:50
What time is meeting #3? 9:00
What time is meeting #4? 10:00
What time is meeting #5? 15:00
Here are the times for your meetings that are later today:
16:00
16:50
Your last meeting of the day is at 16:50
What…
Create a program that creates a loop that prints out the numbers 1 to 100, butreplaces multiples of 3 with the word “Java”, multiples of 5 with the word“Programming”, and multiples of both with the word “JavaProgramming”.
IN JAVA
Chapter 2 Solutions
Java: An Introduction to Problem Solving and Programming (7th Edition)
Ch. 2.1 - Prob. 1STQCh. 2.1 - Can a Java program have two different variables...Ch. 2.1 - Prob. 3STQCh. 2.1 - Give the declaration for two variables of type...Ch. 2.1 - Write the declaration for two variables called...Ch. 2.1 - What is the normal spelling convention for named...Ch. 2.1 - Prob. 7STQCh. 2.1 - Prob. 8STQCh. 2.1 - Prob. 9STQCh. 2.1 - Prob. 10STQ
Ch. 2.1 - Prob. 11STQCh. 2.1 - In the Programming Tip entitled Type Casting a...Ch. 2.1 - What is the output produced by the following lines...Ch. 2.1 - What is the output produced by the following lines...Ch. 2.1 - Prob. 15STQCh. 2.1 - Prob. 16STQCh. 2.1 - Consider the following statement from the program...Ch. 2.1 - Prob. 18STQCh. 2.2 - Prob. 19STQCh. 2.2 - What output is produced by the following...Ch. 2.2 - What output is produced by the following...Ch. 2.2 - What output is produced by the following...Ch. 2.2 - What output is produced by the following...Ch. 2.2 - What output is produced by the following...Ch. 2.2 - What is the value of the expression sl.equals(s2)...Ch. 2.2 - What is the value of the expression s1.equals (s2)...Ch. 2.3 - Write Java statements that will cause the...Ch. 2.3 - What is the difference between the methods...Ch. 2.3 - Write a complete Java program that reads a line of...Ch. 2.3 - Write a complete Java program that reads one line...Ch. 2.3 - What output is produced by the following...Ch. 2.4 - Prob. 32STQCh. 2.4 - What is the output produced by the following Java...Ch. 2.4 - Although it is kind of silly, state legislatures...Ch. 2.5 - Prob. 35STQCh. 2.5 - Give a Java statement that will display a dialog...Ch. 2.5 - Give a Java statement that, when executed, will...Ch. 2.5 - Prob. 38STQCh. 2.5 - Write a complete Java program that produces a...Ch. 2.5 - Write a complete Java program that behaves as...Ch. 2 - Write a program that demonstrates the approximate...Ch. 2 - Write a program that demonstrates type casting of...Ch. 2 - Write a program that demonstrates the operator %...Ch. 2 - If u = 2, v = 3, w = 5, x = 7, and y = 11, what is...Ch. 2 - What changes to the ChangeMaker program in Listing...Ch. 2 - If the int variable x contains 10, what will the...Ch. 2 - Write some Java statements that use the String...Ch. 2 - Prob. 8ECh. 2 - Prob. 9ECh. 2 - Write a single Java statement that will display...Ch. 2 - What does the Java code Scanner keyboard = new...Ch. 2 - What does the Java code Scanner keyboard = new...Ch. 2 - Prob. 13ECh. 2 - Many sports have constants embedded in their...Ch. 2 - Prob. 15ECh. 2 - Define named constants that you could use in...Ch. 2 - Write a program that reads three whole numbers and...Ch. 2 - Write a program that uses Scanner to read two...Ch. 2 - Write a program that reads the amount of a monthly...Ch. 2 - Write a program that reads a four-digit integer,...Ch. 2 - Prob. 5PCh. 2 - Prob. 6PCh. 2 - Write a program that converts degrees from...Ch. 2 - Write a program that reads a line of text and then...Ch. 2 - Write a program that will read a line of text as...Ch. 2 - Write a program that asks the user to enter a...Ch. 2 - Write a program that determines the change to be...Ch. 2 - Write a program that reads a 4-bit binary number...Ch. 2 - Prob. 7PPCh. 2 - The Harris-Benedict equation estimates the number...Ch. 2 - Repeat any of the previous programming projects...Ch. 2 - Write a program that reads a string for a date in...Ch. 2 - It is important to consider the effect of thermal...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Ackermann's Function Ackermann's Function is a recursive mathematical algorithm that can be used to test how we...
Starting Out with Python (4th Edition)
What is the difference between operating system software and application software?
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
What do the Ada and COBOL languages have in common?
Concepts Of Programming Languages
It has been suggested that the control software for a radiation therapy machine, used to treat patients with ca...
Software Engineering (10th Edition)
(Financial application: compute CD value) Suppose you put 10,000 into a CD with an annual percentage yield of 5...
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
following the bit-level floating-point coding rules, implement the function with the following prototype: / Com...
Computer Systems: A Programmer's Perspective (3rd Edition)
Knowledge Booster
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
- So I have what I think the code would be but it doesn't like it. This is the question- Write a program that accepts a number of minutes and converts it both to hours and days. For example, 6000 minutes is 100.0 hours or 4.166666666666667 days. This is the code I have - import java.util.Scanner; public class MinutesConversion { private static Scanner inputDevice; public static void main(String[] args) { int minutes, hours; float days; // float for decimal point inputDevice = new Scanner(System.in); System.out.println("Please enter minutes for conversion >> "); minutes = inputDevice.nextInt(); hours = minutes / 60; days = hours / 24.0f; System.out.println(+ minutes + " minutes is " + hours + " hour(s) or" + days " days"); } }arrow_forwardWrite a painting Program that allows the user to paint shapes and lines in many defrent colors here's using Java language for githubarrow_forward(Java) What will the following display to the console? Work out the solution by hand (don't run the code, until after you have worked it out by hand). StringBuilder sb1 = new StringBuilder("Cat");StringBuilder sb2 = new StringBuilder(sb1.replace(2, 3, "Rat").append("Mat"));sb2.append("Sat!");System.out.println(sb1);System.out.println(sb2);arrow_forward
- Write an java application from the code below that accepts three Strings from the user and displays them in alphabetical order without regard to case. import java.util.*; public class Alphabetize2 { public static void main(String[] args) { String str1, str2, str3; Scanner in = new Scanner(System.in); System.out.print("Enter first string >> "); str1 = in.nextLine(); System.out.print("Enter second string >> "); str2 = in.nextLine(); System.out.print("Enter third string >> "); str3 = in.nextLine(); // display strings in alphabetical order if(str1.toLowerCase().compareTo(str2.toLowerCase()) < 0 && str2.toLowerCase().compareTo(str3.toLowerCase()) < 0) System.out.println("You entered the strings in alphabetical order"); else System.out.println("You did not enter the words in alphabetical order"); } }arrow_forwardCreate a java class called Question4, and implement the following points inside the main method:1. Reads a string from the standard input device and store it in a variable called inputStr.2. Find all the letter characters in inputStr and store them in another string variable called letterChars. Then, convert all the characters in letterChars to uppercase characters (i.e., capital letters).3. Display the contents of letterChars to the user using a message dialog box.For example, if the contents of inputStr is “q123Ab455c6d”, then the final contents of letterChars will be “QABCD”.arrow_forwardWrite a program in Java that opens a 300x200 window with a grid of 3x4 buttons. The buttons have values from 1 to 12(random every time you run it). Clicking on any of the buttons changes the value of all other buttons to the value "1".arrow_forward
- can you please write in java.util.scanner form ,can you please make it so i can copy and past it int[] numbers = {345, 632, 675, 157, 834, 294, 832};1. Write a method to find its highest value. 2. Write a method to find its lowest value. 3. Write a method to find its total value.arrow_forwardIn the Java programming language, write a program that opens a 400x200 window with two 200x200 buttons. One button says "Close" - which closes the program, and on the other the number "16". Each time you press this button, the number is halved until 1. When 1 is reached the button does not change anymore.arrow_forwardWrite a Java program, GradeApp that reads a series of exam scores given as integers in the range 0 to 100. Display the total number of grades and the number of grades in each letter-grade category, followed class average (as a percentage with 2 decimal place): Use the value -1 as a sentinel value to indicate the end of the input. (The -1 value is used only to end the loop. Please do not use it in the calculations.)arrow_forward
- Write a Java or C++ program that will display the given menu: A Simple Library System1. Add a Student2. Add a Book3. Display All Students4. Display All Books5. Search a Student6. Search a Book7. Borrow a Book8. Display Borrowed Books9. Return a Book (optional)10. Exit➢ When 1 is chosen, ask the user to enter the student’s information(5-digit ID number,surname, first name, age, and sex)➢ When 2 is chosen, ask the user to enter the book’s information(5-digit book number,Title, Author’s name(Surname, first name), date of purchase, and status (available/notavailable))➢ When 3 is chosen, display list of all students(5-digit ID number, surname, first name,age, and sex)➢ When 4 is chosen, display list of all books(5-digit book number, Title, Author’sname(Surname, first name), date of purchase, and status (available/not available)➢ When 5 is chosen, ask the user if he wants to search the list by Surname or IDnumber. If record is found, display the corresponding record, else display…arrow_forwardWrite a Java or C++ program that will display the given menu: A Simple Library System1. Add a Student2. Add a Book3. Display All Students4. Display All Books5. Search a Student6. Search a Book7. Borrow a Book8. Display Borrowed Books9. Return a Book (optional)10. Exit➢ When 1 is chosen, ask the user to enter the student’s information(5-digit ID number,surname, first name, age, and sex)➢ When 2 is chosen, ask the user to enter the book’s information(5-digit book number,Title, Author’s name(Surname, first name), date of purchase, and status (available/notavailable))➢ When 3 is chosen, display list of all students(5-digit ID number, surname, first name,age, and sex)➢ When 4 is chosen, display list of all books(5-digit book number, Title, Author’sname(Surname, first name), date of purchase, and status (available/not available)➢ When 5 is chosen, ask the user if he wants to search the list by Surname or IDnumber. If record is found, display the corresponding record, else display…arrow_forwardWhen the given integer variable numberOfTools is: less than 14, output "Small tool box". between 14 inclusive and 39 inclusive, output "Mid-sized tool box". greater than 39, output "Need wall storage". End with a newline. Ex: If the input is 13, then the output is: (in java) Given Code: import java.util.Scanner; public class ToolDetails {public static void main(String[] args) {Scanner scnr = new Scanner(System.in);int numberOfTools; numberOfTools = scnr.nextInt();arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Java random numbers; Author: Bro code;https://www.youtube.com/watch?v=VMZLPl16P5c;License: Standard YouTube License, CC-BY