Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Fundamentals Of Database System

Authors: Elmasri Ramez And Navathe Shamkant

7th Edition

978-9332582705

More Books

Students also viewed these Databases questions

Question

How do members envision the ideal team?

Answered: 1 week ago

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago