View the step-by-step solution to:

Write a program that reads integers from the keyboard until a user enters zero (a sentinel-controlled loop). You should prompt the user for the...

Intro to Java Programming and CS. Please help me with the following question:


Screen Shot 2019-02-20 at 11.46.22 AM.png

Screen Shot 2019-02-20 at 11.46.22 AM.png

3. Write a program that reads integers from the keyboard until a user enters zero (a sentinel-controlled loop).
You should prompt the user for the inputs.
Please use a do. .while loop. The program should print this information in the order given, provide text in the output that describes what
is being shown : a. The sum of all the numbers entered
b. The largest number entered (write the code to do this, rather than calling a function like max) 0. The smallest number entered (write the code to do this, rather than calling a function like min)
d. Whether the sum is odd or even (use the mod operator) Notes: 1. Do not store the values in an array. Both positive and negative numbers are valid inputs. You should use
lnteger.MAX_VALUE and lnteger.MlN_VALUE as initial values for your variables that keep track of the smallest and
largest values entered by the user. 2. The sentinel value (zero) should not be treated as an integer input. In other words, if the numbers entered are 7, 2, 1, 8, 0
the smallest value is 1, not 0. Example outputforthe following inputs:2, 20, 2, 0
Sum = 24
Largest number = 20
Smallest number = 2
The sum is even

Top Answer

View the full answer
output.JPG

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask a homework question - tutors are online