该程序输入句子,并写字母,单词,句子的数量? [英] the program that enter sentences and it writes the numbers of letters ,words ,sentences?

查看:100
本文介绍了该程序输入句子,并写字母,单词,句子的数量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


//count letters ,words ,sentences
package sentence1java;
import java.util.Scanner;
public class main {
    public static void main(String[] args) {
       
     Scanner input=new Scanner(System.in);  
        System.out.println("enter an expression:");
        int word=0;
        int letter=0;
        int sentence=0;
        String s;
        int i=0;
        s=input.nextLine();
        while(i<s.length()){
            i++;
        }
            if (s.charAt(i) == '.') {
                sentence++;
                
            if (s.charAt(i) != '.') {
                    
         System.out.println("sentence:");
           if (s.charAt(i) == '') {
                word++;
          if (s.charAt(i) != '') {
         System.out.println("word:");
          if (s.charAt(i) != '.'+' ') {
                              letter++;
                                  
         System.out.println("letter:");
                          }
                  )
                  )


该程序希望从我们这里获取句子,然后该程序最多计算字母,单词和句子的数量.


the program want sentences from us after then the program most count the numbers of letters , words , sentences.

推荐答案

mf_arian写道:
mf_arian wrote:

程序需要我们的句子



尝试输入此内容.



Try entering this.

The quick brown fox jumps over the lazy dog. 
The quick brown fox jumps over the lazy dog. 
The quick brown fox jumps over the lazy dog.


:doh::doh::doh:


:doh: :doh: :doh:


这篇关于该程序输入句子,并写字母,单词,句子的数量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆