Question
Asked by:
USNAVYET
USNAVYET
Rating (6): A
Questions Asked: 14
Tutorials Posted: 35, earned $278.87
 

$5.00 Java program help

  • From Computer-Science: Compilers
  • Closed, but you can still post tutorials
  • Due on Oct. 20, 2009
  • Asked on Oct 17, 2009 at 1:19:56PM
Q:

Write a Java main method for the following task: sum and average a sequence of positive integers entered by the user. You must use a while-loop to do the job. In each iteration, your program will prompt the user to either enter a positive integer or enter a zero or negative integer. A positive input will be added to the sum. A zero or negative input will cause the program to exit the while loop and to print out the sum and the average (the average must be a double type number). (Points: 10)

 


   
   
   
   
 
Available Tutorials to this Question
Posted by:
modulo51
modulo51
Rating (110): A-
Questions Asked: 1
Tutorials Posted: 353, earned $2,117.64
 

$5.00 Java:: Single class (main), while loop, prints count, sum, average. UseNotes

  • This tutorial was purchased 1 time and hasn't been rated yet.
  • Posted on Oct 17, 2009 at 2:28:58PM
A:
Preview: ... (0 or negative will terminate): ");             num = Integer.parseInt(keyboard.nextLine());             if (num                 break;             } else {                 sum += num;                 count++;             }         } ...

The full tutorial is about 140 words long plus attachments.

Attachments:
SumAndAverage.java (1K) (Preview)
SumAndAverageUseNotes.txt (1K) (Preview)
Posted by:
santhanamk
santhanamk
Rating (11): A+
Questions Asked: 0
Tutorials Posted: 109, earned $71.15
 

$5.00 Solution - tested and works perfectly. see attachment

  • This tutorial hasn't been purchased yet.
  • Posted on Oct 17, 2009 at 2:44:32PM
A:
Preview: ... hment which c ...

The full tutorial is about 10 words long plus attachments.

Attachments:
SumAndAverage.java (0K) (Preview)
Posted by:
 

$2.00 Correct programe

  • This tutorial hasn't been purchased yet.
  • Posted on Oct 17, 2009 at 4:17:04PM
A:
Preview: ...   {               int sum=0,number=1,noofvalues=0; //intialising int data types        double aver=0;//declaring double data types                              while(number > 0)        {                                  System.out.println("E ...

The full tutorial is about 129 words long plus attachments.

Attachments:
imagesumave.jpg (37K) (Preview)
notepadsumaverage.txt (1K) (Preview)
sumaverage.zip (3K) 

 sumaverage/bluej.pkg
 sumaverage/notepadsumaverage.txt
 sumaverage/README.TXT
 sumaverage/sumaverage.class
 sumaverage/sumaverage.ctxt
 sumaverage/sumaverage.java
 ]

Posted by:
 

$5.00 Correct program

  • This tutorial hasn't been purchased yet.
  • Posted on Oct 18, 2009 at 03:40:25PM
A:
Preview: ... ; public class sumaverage//class name {   public static void main (String [] args)throws IOException    {              int sum=0,number=1,noofvalues=0; //intialising int data types        double aver=0;//declaring double data types        ...

The full tutorial is about 129 words long plus attachments.

Attachments:
sumaverage.txt (1K) (Preview)
   
Join Now or Log In
Get Tutoring
Get Paid
Academic Honesty