zeroliken 79

the structure should be before main not inside

zeroliken 79

[CODE]double a;[/CODE]
include this in the main function

[CODE]printf("%.2lf\n", a);[/CODE]
.(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

Still simple... use a loop again

[CODE]int sum;
for(int i=0;i<array.length();i++){
sum=sum+array[i];
}[/CODE]

NormR1 commented: Spoonfeeding - doing the OPs work -3

zeroliken 79

Here's my Example
[CODE] 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;  
}[/CODE]

you should specify how the JOptionPane should look or work like

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

zeroliken 79

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

help.java
[CODE]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);
}
}
[/CODE]

help2.java
[CODE]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;
}
}[/CODE]

WaltP commented: Don't post answers to questions. It's not YOUR homework. -4