Lab 2

Lab Description:

Lab 2 is where we get familiar with Java and Eclipse. The goal of this lab is to create a program that ask the user to enter any amount of numbers(positives or negatives and the program will take the numbers and displayed the following for the user: the first number that the user have input, the last number that the user input, the total amount of numbers that the user had input, the maximum/minimum of the all the input numbers, the total sum of all the numbers, and the average of the total number.

Code:

import java.util.Scanner;
public class lab_number_2 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner input = new Scanner(System.in);

		int count=0;
		int score=0;
		int max=0;
		int min=0;
		int first=0;
		int last=1;
		int sum=0;

		while(true){
			System.out.print("Enter any amount of numbers: "+"\n");
			System.out.println("press 0 to exit");

			score = input.nextInt();

			if (score ==0) break;

				if(score>=max){

					max=score;
				}

				if (score 0){
					last=score;
				}
				sum=score+sum;

				}

			System.out.printf("the Last number is:   %d\n",last);
			System.out.printf("the First number is:  %d\n",first);
			System.out.printf("the Count of number entered %d\n",count);
			System.out.printf("the Minimum: %d\n",min);
			System.out.printf("the Maximum: %d\n",max);
			System.out.printf("the Sum of all numbers is:  %d\n",sum);
			System.out.printf("the Average of total numbers is: %d\n",sum/count);
			}

		}

Screenshots: