subject

import java. util. Scanner; import java. util. StringTokenizer; public class ICE2 { public static void main(String[] args) { // Ask user for a sentence int n = 5; String sentence; StringTokenizer tokens; Scanner keyboard = new Scanner(System. in); System. out. println("Enter a sentence"); //Use string tokenizer to split up the input into tokens StringTokenizer tokenizer = new StringTokenizer(sentence); n = tokenizer. countTokens(); //check how many tokens if(n < 5) { System. out. println("Enter more words."); } if(n > 8) { System. out. println("Enter less words."); } while(n-->0) { //Display the entire sentence System. out. println(sentence); while(tokens. hasMoreTokens()) { //get token String token = tokens. nextToken(); int letters = 0; int digits = 0; int uppercase = 0; int lowercase = 0; int space = 0; String t = tokens. nextToken();{ for(int i = 0; i < token. length(); i++) { char ch = token. charAt(i); if(Character. isLetter(ch)) { letters++; } if(Character. isDigit(ch)) { digits++; } if(Character. isUpperCase(ch)) { uppercase++; } if(Character. isLowerCase(ch)) { lowercase++; } if(Character. isSpaceChar(ch)) { space++; } System. out. println(t + ":" + t. length()); } String nospace = sentence. replace(" ", ""); System. out. println("The total number of characters excluding the spaces." + nospace. length()); } } } } }

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 16:00
Page orientation can be either landscape or
Answers: 1
question
Computers and Technology, 21.06.2019 21:00
When a rectangular region is defined using an appropriate style, which value matches the specified edge of the clipping region to the edge of the parent element?
Answers: 3
question
Computers and Technology, 21.06.2019 22:00
Signal sets company contracts to deliver one hundred 52-inch plasma high-definition television sets to a new retail customer, tuner tv store, on may 1, with payment to be made on delivery. signal tenders delivery in its own truck. tuner's manager notices that some of the cartons have scrape marks. tuner's owner phones signal's office and asks whether the sets might have been damaged as they were being loaded. signal assures tuner that the sets are in perfect condition. tuner tenders signal a check, which signal refuses, claiming that the first delivery to new customers is always for cash. tuner promises to pay the cash within two days. signal leaves the sets with tuner, which stores them in its warehouse pending its "grand opening sale" on may 15. two days later, tuner's stocker opens some of the cartons and discovers that a number of the sets are damaged beyond ordinary repair. signal claims tuner has accepted the sets and is in breach by not paying on delivery. will signal succeed on these claims? explain.
Answers: 1
question
Computers and Technology, 24.06.2019 04:30
Fall protection, confined space entry procedures, controlled noise levels, and protection from chemical hazards are some of the things that contribute to a safe and
Answers: 1
You know the right answer?
import java. util. Scanner; import java. util. StringTokenizer; public class ICE2 { public static vo...
Questions
Questions on the website: 13722367