zeroliken 79 Nearly a Posting Virtuoso

the structure should be before main not inside

zeroliken 79 Nearly a Posting Virtuoso
double a;

include this in the main function

printf("%.2lf\n", a);

.(anynumber) represents the number of decimal places you want to output

or just do the solution posted by WaitP to be exact

WaltP commented: Doesnt come anywhere near the answer. -4
zeroliken 79 Nearly a Posting Virtuoso

Still simple... use a loop again

int sum;
for(int i=0;i<array.length();i++){
    sum=sum+array[i];
}
NormR1 commented: Spoonfeeding - doing the OPs work -3
zeroliken 79 Nearly a Posting Virtuoso

Here's my Example

public double calcinsDeduct()
	{
      String cmdString =
        JOptionPane.showInputDialog("M-Male or F-Female: ");
 
        if(cmdString == ("M")){
          JOptionPane.showMessageDialog(null,"50.00 - deducted"); //shows the message...you can edit this 
	 insDeduct = 50.00;
	}
       else if(cmdString == ("F")){
          JOptionPane.showMessageDialog(null,"100.00 - deducted");
	 insDeduct = 100.00;
	}
	else{
          JOptionPane.showMessageDialog(null, "enter either M or F");
	}
	return insDeduct;  
	}

you should specify how the JOptionPane should look or work like

check here for more examples
http://http://download.oracle.com/javase/tutorial/uiswing/components/dialog.html#features

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