I am here to learn and share some new and cool stuffs
Since I am a rookie I will start with a problem
I have this problem
When the program starts, you will be
asked to input an amount of numbers to for your calculations. This can be any number of
numbers. No matter what number you put in, it should ask you for that amount of numbers.
For instance, if you put in 100, you will be expected to put in 100 numbers. Once you put in the
total numbers for use, your program should ask you for each number, while displaying how
many numbers you have put in and how many you have left to go. At the end, the program
should be able to show you the Sum, Difference, Product, and the average of all your numbers
This is my code so far ( it doesn't give me the proper result)
package javaapplication13;
import java.util.Scanner;
public class JavaApplication13 {
/** Main method */
public static void main(String[] args) {
// Create a Scanner
Scanner input = new Scanner(System.in);
// Read an initial data
System.out.print( "Enter a number of numbers to use in your calculation ");
int data = input.nextInt();
// Keep reading data until the input equals number of numbers
int sum = 0;
while (data !=0) {
sum += data;
// Read the next data
System.out.print(
"You have entered 0 numbers you have 5 numbers left to enter ");
data = input.nextInt();
System.out.println("All numbers added together equal " + sum);
System.out.println("All numbers subtracted from each other equal " + sum);
System.out.println("All numbers multiplied6 together equal " + sum);
System.out.println("All numbers added together equal " + sum);
}
}
}