Vrite a Java program that has the user enter integer values, one after the other, until they enter the value Once the user enters -1, the program outputs the total and the average of all the values entered (not cluding the value -1). You may call the method "keyboard.nextInt()" which returns the integer entered by e user on the keyboard. Here are two sample runs: Sample Run #1: Enter an integer: 7 Enter an integer: 13 Enter an integer: 4 Enter an integer: -1 The sum is 24. The average is 8. Sample Run #1: Enter an integer: 50 Enter an integer: 10 Enter an integer: 30 Enter an integer: 20 Enter an integer: 60 Enter an integer: 40 Enter an integer: -1 The sum is 210. The average is 35.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter5: Repetition Statements
Section5.5: A Closer Look: Loop Programming Techniques
Problem 14E
icon
Related questions
Question
please use java language requirement- The code expected to be relatively short, up to 10 lines
Vrite a Java program that has the user enter integer values, one after the other, until they enter the value
Once the user enters -1, the program outputs the total and the average of all the values entered (not
cluding the value -1). You may call the method "keyboard.nextInt()" which returns the integer entered by
e user on the keyboard. Here are two sample runs:
Sample Run #1:
Enter an
integer: 7
Enter an
integer: 13
Enter an
integer: 4
Enter an
integer: -1
The sum is 24.
The average is
8.
Paragraph V
B
Sample Run #1:
Enter an
integer: 50
Enter an
integer: 10
Enter an
integer: 30
Enter an
integer: 20
Enter an
integer: 60
Enter an
integer: 40
Enter an
integer: -1
The sum is 210.
The average is
35.
I Uv
public static void main(String[] args) {
lılı
V
► 11
8⁰
+ v
:
Transcribed Image Text:Vrite a Java program that has the user enter integer values, one after the other, until they enter the value Once the user enters -1, the program outputs the total and the average of all the values entered (not cluding the value -1). You may call the method "keyboard.nextInt()" which returns the integer entered by e user on the keyboard. Here are two sample runs: Sample Run #1: Enter an integer: 7 Enter an integer: 13 Enter an integer: 4 Enter an integer: -1 The sum is 24. The average is 8. Paragraph V B Sample Run #1: Enter an integer: 50 Enter an integer: 10 Enter an integer: 30 Enter an integer: 20 Enter an integer: 60 Enter an integer: 40 Enter an integer: -1 The sum is 210. The average is 35. I Uv public static void main(String[] args) { lılı V ► 11 8⁰ + v :
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT