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.
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
Related questions
Question
please use java language
requirement- The code expected to be relatively short, up to 10 lines
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images
Recommended textbooks for you
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT