Question
Urgent help needed in java ! Thanx public class AverageCalculator { public static void main(String[] args) { // 1. Create a Scanner instance (called 'scan1')
Urgent help needed in java ! Thanx
public class AverageCalculator {
public static void main(String[] args) {
// 1. Create a Scanner instance (called 'scan1') that allows users to input a single line from the keyboard. hint use scan1.nextLine()
// 2. Convert the input value into an integer type number, reporting an error if it cannot be converted.
// 3. Extend the program so it keeps asking for a value until the user just presses enter without inputting a value. hint: use a while loop
// 4. Within each iteration of the loop keep a running total of the values input by the user. hint: you will need a 'total' variable.
// 5. Once the user quits display the average of the values they have input. hint: you will need to know how many values were input to calculate the average.
}
}
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