choice89
01-23-2005, 10:10 AM
Hello Webdeveloper,
I am a new memeber and I am asking for HELP! I am new to the programming world and I am taking a programming class that is kicking my BUTT!
I am trying to write a program that reads in a list int values, one per line, and outputs their sum as well as the numbers read in, with each number annotated to say what percentage it contributes to the sum. The dialog should look like this:
How many numbers will you enter?
4
Enter 4 integers, one per line:
2
1
1
2
The sum is 6.
the numbers are:
2 33.3333% of the sum.
1 16.6666% of the sum.
1 16.6666% of the sum.
2 33.3333% of the sum.
Could someone point me in the right direction I am pulling my HAIR Out!! This is what I have so far:
public class Homeworkone
{
public static void main(String[] args)
{
double[] numbers = new double[100];
int index;
double sum, average;
System.out.println("How many numbers will you enter?");
sum = 0;
for (index = 0; index < 100; index++)
}
}
Choice89
I am a new memeber and I am asking for HELP! I am new to the programming world and I am taking a programming class that is kicking my BUTT!
I am trying to write a program that reads in a list int values, one per line, and outputs their sum as well as the numbers read in, with each number annotated to say what percentage it contributes to the sum. The dialog should look like this:
How many numbers will you enter?
4
Enter 4 integers, one per line:
2
1
1
2
The sum is 6.
the numbers are:
2 33.3333% of the sum.
1 16.6666% of the sum.
1 16.6666% of the sum.
2 33.3333% of the sum.
Could someone point me in the right direction I am pulling my HAIR Out!! This is what I have so far:
public class Homeworkone
{
public static void main(String[] args)
{
double[] numbers = new double[100];
int index;
double sum, average;
System.out.println("How many numbers will you enter?");
sum = 0;
for (index = 0; index < 100; index++)
}
}
Choice89