
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
![•• 4. Write a program that reads a word and prints whether
o it is short (fewer than 5 letters).
o it is long (at least 10 letters).
o it ends with the letter y.
ebook-bjlo-2-ch03-sec02-cc-1
wordproperties.java
1 import java.util.Scanner;
2
3 public class WordProperties
4 {
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 }
public static void main(String[] args)
{
}
Scanner in = new Scanner(System.in);
System.out.print("Enter a word: ");
String word = in.next();
if ( word < 5
{
}
if (word <= "10" )
{
System.out.println (word + " is long");
}
if (word.substring(word.length() - 1).equals("y"))
{
}
System.out.println (word + " is short");
CodeCheck
System.out.println(word + ends in a y");
11
Reset](https://content.bartleby.com/qna-images/question/3e38f750-a3b6-41fa-9e5a-77c8be67512c/abd05936-f627-45bd-83e0-880bba0e4c60/gyxqkws_thumbnail.png)
Transcribed Image Text:•• 4. Write a program that reads a word and prints whether
o it is short (fewer than 5 letters).
o it is long (at least 10 letters).
o it ends with the letter y.
ebook-bjlo-2-ch03-sec02-cc-1
wordproperties.java
1 import java.util.Scanner;
2
3 public class WordProperties
4 {
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 }
public static void main(String[] args)
{
}
Scanner in = new Scanner(System.in);
System.out.print("Enter a word: ");
String word = in.next();
if ( word < 5
{
}
if (word <= "10" )
{
System.out.println (word + " is long");
}
if (word.substring(word.length() - 1).equals("y"))
{
}
System.out.println (word + " is short");
CodeCheck
System.out.println(word + ends in a y");
11
Reset
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 3 steps with 3 images

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
- Write a code that generates a random lowercase letter. In java programming. Note: Not a string of letters just one letter is generated every time the program is run. meaning the output should not be something like this: a c t c -that's a random string, it should only be one random letter generated randomly.arrow_forwardWrite a JAVA program that prints the following grid to play Tic-Tac-Toe. +--+--+- Declare string variables to hold two kinds of patterns: a comb-shaped pattern and the bottom line. print the comb three times and the bottom line once.arrow_forwardIn Java, code a program that rolls a dice 100,000 times and prints out the result of how many 3, 4, 5's were rolled.arrow_forward
- Write a program that takes two strings and outputs the longest string. If they are the same length then output the second string. Ex. If the input is: almond pistachio the output is: pistachio (in java please)arrow_forwardWrite the code in java and please dont plagarise or copy from other sources write it on your own and read the question carefully and do what in the question says thank you.arrow_forward
arrow_back_ios
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