Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program called Average.java that prompts a user to enter a number, and allows the user to continue to enter numbers until she responds

image text in transcribed

Write a program called Average.java that prompts a user to enter a number, and allows the user to continue to enter numbers until she responds with a negative number. At that point, the program should print out how many numbers the user entered (not including the negative one), and the average of those numbers. Note: This program will use a Scanner object such as you learned about in CS 1. This is the only occasion in this class that you are likely to use a Scanner object for user interaction. You will be using command-line arguments or GUI widgets in every other program you write (or, sometimes, not interacting with a user at all). $ java Average Enter a series of numbers. Enter a negative number to quit. 1 2 4.5 3 5 -1 You entered 5 numbers averaging 3.1

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

Database Security

Authors: Alfred Basta, Melissa Zgola

1st Edition

1435453905, 978-1435453906

Students also viewed these Databases questions

Question

administer a survey to an appropriate sample of respondents;

Answered: 1 week ago