OK, so what I want to do is create 2 classes. One is main class and the second class is to make a loop sentinel control and then return the total of it till the user enters 0. I couldn't get it to work. I don't know how to call the other class because I'm very new to Java. Here's what I have.
Class 1:
import java.util.*;
public class HW3 {
public static void main(String[] args) {
OrderDetails object = new OrderDetails();
int n;
n = object.OrderDetails(0);
System.out.println(n);
Class 2:
import java.util.*;
public class OrderDetails {
Scanner input = new Scanner(System.in);
int total=0;
int n1;
public int OrderDetails(int n1){
while (n1 != 0){
System.out.println("Enter your number");
n1 = input.nextInt();
total += n1;
} // End while loop
return total;
} // End method