Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!