Help with a loop-like problem
Hi all, first post here.
I had a question about a program i was thinking of writing but am having trouble with finishing.
the thing is i get stuck here
Input contains several money amounts. Each represents a donation. The ned is denoted by a negative amount. The program will print each amount on a separate line, with a dollar sign. At the end it will print a blank line, total donations, and the average. Note that the amounts as well as the average are printed to two decimal places, rounded.
The output for an input such as 24.95 64.50 77 -89.90 will be
Total from 3 donations = $ 166.45
Average = $ 55.48
i know i havent started writing the code for the total and average, but i first need to know how i get this stupid loop to work with the total and average.
public class Prog5
public static void main(String args)
double donations, total, average;
Scanner sea = new Scanner(System.in);
System.out.print("Donations please: ");
donations = sea.nextDouble();
while(donations >= 0);
any help please