Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Instructions package edu.buffalostate.cis 4 2 5 . sp 2 4 . put - your - username - here; / * * * File: Average.java *
Instructions
package edu.buffalostate.cisspputyourusernamehere;
File: Average.java
Requirements
Write a program that accepts integers from the keyboard and
computes their average.
if the user enters the program exits early, and outputs
the average of the numbers entered so far.
Fill in the blanks to make the program work
@author putyournamehere
import java.util.Scanner;
public class Average
public static void main String args
double ave num sum ;
int cnt ;
Scanner sc new ;
System.out.println "Integer Averaging Program" ;
System.out.println "Enter Integers" ;
add a line here to output a message advising the user to enter to exit
for
System.out.printEnter Integer i : ;
check if the user entered a noninteger
if schasNextInt
System.err will print the message in RED
System.err.printlnSorry please enter an integer";
scnextLine;
i;
continue;
num scnextInt;
if num
cnt;
sum sum num;
if
ave ;
else
;
System.out.printlnThe average of cnt numbers is ave ;
end main
end Average
When you have this Exercise ready for me to view and grade, you should upload your Average.java file here.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started