PROGRAMMING AND CODE
Assignemnt #67
Code
/// Name: Justin Li /// Period 7 /// Program Name: Values /// File Name: Values.java /// Date Finished: 1/5/15 import java.util.Scanner; import java.util.Random; class Values { public static void main(String[]args) { Random r = new Random(); Scanner keyboard = new Scanner(System.in); int number, total; total = 0; System.out.print("I will add up the numbers you give me.\nNumber: "); number = keyboard.nextInt(); while(number != 0) { total = total + number; System.out.println("The total so far is: " + total); System.out.print("Number: "); number = keyboard.nextInt(); } System.out.println("The total is: " + total); } }