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

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

More Books

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