Assignemnt #67 and AddWithLoop.java

Code

    /// Name: Boris Kazantsev
    /// Period: 6
    /// Program Name: AddWithLoop
    /// File Name: AddWithLoop.java
    /// Date Finished: 1/14/2016
    
    import java.util.Scanner;
    import java.util.Random;
    
    public class AddWithLoop{
        public static void main(String[] args){
            Scanner keyboard = new Scanner(System.in);
                    
            int a = 0, end = 0;
            
            System.out.println("I will add up the numbers you give me. If you are done, put \"0\" for the number");
            
            do {
                System.out.print("Nubmer: ");
                a = keyboard.nextInt();
                
                end += a;
                System.out.println();
                if ( a != 0) System.out.println("The total so far is "+ end + ".");
                else System.out.println("The total is " + end + ".");
            }
            while (a != 0);
        }
    }
        
        
        
                   
    

Picture of the output

Assignment 67