zeroliken 79 Nearly a Posting Virtuoso

all you need to do is to store the numbers in another class

help.java

import java.util.Scanner;
import java.util.*;

public class help
{

public static void main(String[] args)
{
int num;
int total=0;
int i=0;

help2[] entries=new help2[100];
int counter=0;

Scanner sc = new Scanner(System.in);

do
{
System.out.print("Input an integer. Input 0 to finalize: ");
num = sc.nextInt();

   entries[counter]=new help2(num);
   counter++;

if (i==0)
{
total = num;
}
else
{
if (i%2==0)
{
total = total + num;
}
else
{
total = total-num;
}
}
i++;
}
while (num!=0);
System.out.println("The number of input is:" +i);
   for(int j=0;j<counter-1;j++){
	if (j%2==0)
	{
		if(j!=counter-2){
			System.out.print(entries[j].getNum()+ "-");
		}	
		else{	
			System.out.print(entries[j].getNum());
		}
	}else{
		if(j!=counter-2){
			System.out.print(entries[j].getNum()+ "+");
		}	
		else{	
			System.out.print(entries[j].getNum());
		}
	}
}
System.out.println("="+total);
}
}

help2.java

public class help2{

private int num;

   public help2(int num){
	this.num = num;
   }
   public void setNum(int num){
   this.num=num; 
   }
   public int getNum(){
   return this.num;
   }
}
WaltP commented: Don't post answers to questions. It's not YOUR homework. -4