Lab#3

Objective Discretion,
This lab was kind of continuity of lab number 2, to understand how Java programming language and syntax are relate to each other. The way syntax and the Java programming work, is like a loop statement. When a number is execute we see that the user number computer several statistics. I also find another undesirable error, in which in this experiment I had problem to run the program, the problem that I found was saying that I have 1 syntax error, I tried to change the code many way.

Code

Henry A
 public class NumberStats {

 public static void main(String[]args) { 
     
	       
   private int number;
       private int number
       private double average;
       private int minimum;
       private int maximum;
       private int count;
       private int firstnumber;
       private int lastnumber;
       private int numberamount;
       private int totalnumber;
       
       public int getnumber() { 
   		return double getaverage;
  }
   	public int getfirstnumber() {
   		return minimum;
  } 

   	public int getlastnumber() {
   		return maximum;
  }
   	public int getcount()   {
   		return count++;
  }
   	public double getaverage() {
   		return totalnumber;
  }
   	public int getmaximum() {
   		return numbermount;
 }
   	public int getminimum() {
   		return firstnumber;
 }
   	public int gettotalnumber() {
   		return lastnumber;
}
   	
   		
   }


   public class TrainStats{
	   public static void main (String[] args){
		    int number = 0
		    double average;
		    int maximum = 0;
			int minimum = 1;
			int count =1;
		    int firstnumber = number;
		    int lastnumber = number %15;
		    int numberamount = 0;
			int totalnumber = 0;

			Scanner input = new Scanner( System.in);

		System.out.println("Enter a series of number: ");
		System.out.println("Enter 0 when u finished:  ");

		do {
		number=input.nextInt();
		numberamount ++;
		totalnumber = totalnumber + number;

		if (number > maximum)
		{
			maximum=number;
			count=0;
		}
		if(number==maximum)
			count++;

		else if (number < minimum) {  	minimum=number; 	count=1; } if(number==minimum){ 	count ++; } 	     if (count ==1){ 	firstnumber = number; 	} 	else if (count >0) {
			lastnumber = number;
		}
		}

	while (number !=0);

	average=(double)totalnumber/(numberamount-1);
	System.out.printf("The average is %.2f\n", average);

	System.out.println("the total number you entered: " + numberamount);
	System.out.println("The sum for the numbers you entered is " + totalnumber);
	System.out.println("The maximum number is\t: " + maximum);
	System.out.println("The minimum number is: " + minimum);

	System.out.printf("the first digit you entered is " + firstnumber);
	System.out.printf("\nThe last digit you entered is  " + lastnumber); 

		NumberStats mystats1 = new NumberStats();
		NumberStats mystats2= new NumberStats();
		NumberStats mystats3 = new NumberStats();
		NumberStats mystats4 = new NumberStats();
		NumberStats mystats5 = new NumberStats();
		NumberStats mystats6 = new NumberStats();
		NumberStats mystats7 = new NumberStats();
		NumberStats mystats8 = new NumberStats();

		System.out.printf("%s\n" , mystats1.getmaximum());
		System.out.printf("%s\n" , mystats2.getminimum());
		System.out.printf("%s\n" , mystats3.getaverage());
		System.out.printf("%s\n" , mystats4.getlastnumber());
		System.out.printf("%s\n" , mystats5.getfirstnumber());
		System.out.printf("%s\n" , mystats6.getnumber());
		System.out.printf("%s\n" , mystats7.getnumberamount());
		System.out.printf("%s\n" , mystats8.gettotalnumber());

	
	


	   }
   }