Double Compartment
Double Compartment

I Need Help With My Java Homework PLEASE!?
Anyway, this is my first java coding class and i need help with this problem.
Help would be very much appreciated!
Thanks so much!
Assume that you have an array declared as: double[] scores = new double[50]; and that every compartment of the array contains a real number between 0.0 and 100.0 inclusive.
a.A passing score is 70.0 or higher and a failing score is less than 70.0. Write a code segment to calculate the number of passing scores and the number of failing scores in the array.
b.Write a code segment which calculates and displays:
1. the average of the scores in the array
2. the number of scores greater than or equal to the average
3. the number of scores less than the average
/*
Just so you know scores.length provides the length of the array. In this case its 50 so it will return 50... so if you wanted to you could replace it but as of now the code will work with any length array.
*/
//Part A
int passing = 0;
for (int i = 0; i < scores.length; i++)
....if (scores[i] >= 70)
........passing = passing + 1;
int failing = scores.length - passing;
System.out.println("Passing Grades: " + passing);
System.out.println("Failing Grades: " + failing);
//Part B -- Similar concept
double average = 0; //Double because it may not be a whole number, ints are whole numbers
average = sum of all numbers dividing by how many numbers were added together
int sum = 0; //Will aid in figuring out average...
int upperAverage, lowerAverage; //#2,3 of specification
//First step - Figure out the average
for (int i = 0; i < scores.length; i++)
....average = average + scores[i];
average = average / scores.length;
//Second step - Use the average discovered to determine upper and lower bounds
for (int i = 0; i < scores.length; i++)
....if (scores[i] >= average)
........//You could use upperAverage++ if you know what that menas
........upperAverage = upperAverage + 1;
lowerAverage = scores.length - upperAverage;
System.out.println("Average: " + average);
System.out.println("Scores above or equal to average: " + upperAverage);
System.out.println("Scores lower than average: " + lowerAverage);
![]() FLOURNOY 85954 (Brown) Leather Double Compartment Laptop Case Sale Price: $97.40 Eligible for free shipping!Availability: Usually ships in 1-2 business days Features
|
![]() FLOURNOY 85955 (Black) Leather Double Compartment Laptop Case Sale Price: $98.02 Eligible for free shipping!Availability: Usually ships in 1-2 business days Features
|
![]() DORA DOUBLE COMPARTMENT LUNCH BOX - COLORS Sale Price: $7.99 Eligible for free shipping!Availability: Usually ships in 1-2 business days Features
|
![]() 131 Dark Brown Cambro 1826DTCSP Double Compartment Tray and Sheet Pan Camcart Carrier with Security Features
|
![]() Allen Company Double Heavy Canvas Compartment Shooters Bag with Belt List Price: Sale Price: $15.53 You save: $8.96 (37%) Eligible for free shipping!Availability: Usually ships in 1-2 business days Features
|
![]() Plano Molding 5231 Double Cover Stow N Go Organizer, Porche Red List Price: Sale Price: $0.50 You save: $12.49 (96%) Eligible for free shipping!Availability: Usually ships in 1-2 business days Features
|
![]() ArtBin 6990AB Super Satchel Double Deep Box with Removable Dividers, Translucent Clear List Price: Sale Price: $18.41 You save: $12.58 (41%) Eligible for free shipping!Availability: Usually ships in 1-2 business days Features
|
![]() Phineas and Ferb Double Compartment Insulated Lunch Kit - Super Dudes List Price: Sale Price: $6.99 You save: $13.00 (65%) Eligible for free shipping!Availability: Usually ships in 1-2 business days Features
|
![]() SPIDERMAN DOUBLE COMPARTMENT LUNCH BOX Sale Price: $8.95 Eligible for free shipping!Availability: Usually ships in 1-2 business days Features
|
Kann Model SLEMI Two Compartment Side Loader - Australia
|
|
Everest Deluxe Double Compartment Backpack $19.99 Everest Deluxe Double Compartment Backpack |
|
|
Piel Double Compartment Shoulder Bag - Chocolate $86 Piel-Genuine leather double compartment shoulder bag. |
|
|
Piel Double Compartment Shoulder Bag - Saddle $86 Piel-Genuine leather double compartment shoulder bag. |
|
|
Piel Double Compartment Shoulder Bag - Black $86 Piel-Genuine leather double compartment shoulder bag. |
|
|
Derek Alexander North/South Double Compartment Bucket $170.4 Derek Alexander North/South Double Compartment Bucket |
|
|
Everest Deluxe Double Compartment Backpack - Black/Gray $19.99 Everest Deluxe Double Compartment Backpack - Black/Gray |
|
|
Siamod Manarola Collection Belvedere Double Compartment $176.79 Siamod-Leather Double Compartment Laptop Case |
|
|
Siamod Manarola Collection Giovani Double Compartment $224 Siamod-Leather Double Compartment Laptop Case |
|
|
Siamod Manarola Collection Mezzo Double Compartment $232 Siamod-Leather Double Compartment Laptop Case |
|
|
Siamod Manarola Collection Signorini Double Compartment $232 Siamod-Leather Double Compartment Laptop Case |
|
|
Everest Deluxe Double Compartment Backpack - Black $11.99 Everest Deluxe Double Compartment Backpack - Black |
|
|
Roam Wellness VitaSeal Double Compartment Refill, 14/pk $11.31 Roam Wellness VitaSeal Double Compartment Refills for use with Wellness Travel Paks. |
|
|
McKlein USA Scottsdale Flap-over Double Compartment $118.39 McKlein USA SCOTTSDALE Flap-over Double Compartment Laptop Case |
|
|
McKlein USA Chatham Wheeled 17 Double Compartment $118.39 McKlein USA CHATHAM Wheeled 17" Double Compartment Laptop Case |
|
|
Everest Double Compartment Backpack 7045CD $30.45 This double compartment backpack features a front CD/MP3 player holder with a headphone adapter, a side mesh pocket, a side gusset pocket, and a heavily padded handle grip and back panel for comfort. |

Eligible for free shipping!








