Average Running Total

Average Running Total - System.out.print("enter the...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package averagewithrunningtotal; import java.util.Scanner; /** * * @author Manny */ public class AverageWithRunningTotal { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here double totalValue = 0; Scanner in = new Scanner(System.in); System.out.print("enter the first double number: "); double number1 = in.nextDouble(); totalValue = totalValue + number1; System.out.println("The current total value is: " + totalValue);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: System.out.print("enter the second double number: "); double number2 = in.nextDouble(); totalValue = totalValue + number2; System.out.println("The current total value is: " + totalValue); System.out.print("enter the third double number: "); double number3 = in.nextDouble(); totalValue = totalValue + number3; System.out.println("The current total value is: " + totalValue); //Calculate Average double average = totalValue/3; // Output 3 System.out.printf("The Average(rounded to hundredth)= %6.2f", average); } }...
View Full Document

This note was uploaded on 12/07/2011 for the course BUS 350 taught by Professor Leighjin during the Fall '11 term at S.F. State.

Ask a homework question - tutors are online