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
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started