Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

whats wrong with this code? import java.text.DecimalFormat; import java.util.Scanner; /**This program reads sentences from user and print average length**/ public class AverageStudentWordLengthMain { public static

whats wrong with this code?

import java.text.DecimalFormat; import java.util.Scanner;

/**This program reads sentences from user and print average length**/ public class AverageStudentWordLengthMain {

public static void main(String[] args) { //Get user input using scanner Scanner sc=new Scanner(System.in); System.out.print("Enter number of students in the class:"); int noOfStudents=sc.nextInt(); sc.nextLine(); //Declare name array String[] names=new String[noOfStudents]; //Declare student array String[][] sentences=new String[noOfStudents][1]; StringBuilder sentence=new StringBuilder(); //Iterate for noOfStudents for(int i=0;i>>>>>>>>>>>>>>>>>|nThe class has "+noOfStudents+" students and here are their sentences:"); for(int i=0;imax) max=averageWordLengths[i]; } return max;

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Probability & Statistics For Engineers & Scientists

Authors: Ronald E. Walpole, Raymond H. Myers, Sharon L. Myers, Keying

7th Edition

9789813131279, 130415294, 9813131276, 978-0130415295

Students also viewed these Databases questions

Question

1. What is called precipitation?

Answered: 1 week ago

Question

1.what is dew ?

Answered: 1 week ago

Question

1.The difference between climate and weather?

Answered: 1 week ago

Question

1. What is Fog ?

Answered: 1 week ago

Question

How water vapour forms ?

Answered: 1 week ago