Question: User import java.util.Scanner; public class Problem 2 { public static void main ( String [ ] args ) { / / WRITE YOUR CODE H

User
import java.util.Scanner;
public class Problem
2
{
public static void main
(
String
[
]
args
)
{
/
/
WRITE YOUR CODE H
Scanner in
=
new Scanner
(
System
.
in
)
;
int sum
=
0
;
/
/
int n;
double average;
String movie
=
in
.
next
(
)
;
int length
=
in
.
nextInt
(
)
;
for
(
int i
=
0
; i
<
length; i
+
+
)
{
String genre
=
in
.
next
(
)
;
int n
=
in
.
nextInt
(
)
;
sum
=
sum
+
n;
}
average
=
(
double
)
sum
/
length;
int result
=
(
int
)
Math
.
round
(
average
)
;
System.out.println
(
"
The
"
+
movie
+
"
books were
"
+
result
+
"
pages long on average."
)
;
}
}find the problems related to this

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!