Double Compartment

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
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

  • Flap-over design with dual secure slip lock claps
  • Dual front pockets hold small accessories
  • Back compartment features an interior organizer for pens, business cards and small devices
  • Adjustable, non-slip, shock absorbing shoulder strap alleviates body strain
  • Back compartment also features a padded laptop compartment that fits and protects most laptops up to 15.4? in screen size
FLOURNOY 85955 (Black) Leather Double Compartment Laptop Case
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

  • Flap-over design with dual secure slip lock claps
  • Dual front pockets hold small accessories
  • Back compartment features an interior organizer for pens, business cards and small devices
  • Adjustable, non-slip, shock absorbing shoulder strap alleviates body strain
  • Back compartment also features a padded laptop compartment that fits and protects most laptops up to 15.4? in screen size
DORA DOUBLE COMPARTMENT LUNCH BOX - COLORS
DORA DOUBLE COMPARTMENT LUNCH BOX - COLORS
Sale Price: $7.99
  Eligible for free shipping!
Availability: Usually ships in 1-2 business days

Features

  • Lunch Bag size 10inx 8.5in x 5in
  • Food Safe Double-stitched seams and durable materials Padded handles for extra comfort
131 Dark Brown Cambro 1826DTCSP Double Compartment Tray and Sheet Pan Camcart Carrier with Security
131 Dark Brown Cambro 1826DTCSP Double Compartment Tray and Sheet Pan Camcart Carrier with Security

Features

  • Holds (24) 18" x 26" trays or sheet pans
  • Features tamper-resistant hardware
  • NSF Listed
Allen Company Double Heavy Canvas Compartment Shooters Bag with Belt
Allen Company Double Heavy Canvas Compartment Shooters Bag with Belt
List Price: $24.49
Sale Price: $15.53
You save: $8.96 (37%)
  Eligible for free shipping!
Availability: Usually ships in 1-2 business days

Features

  • Adjustable snap belt included
  • Reinforced bottom
  • 2 compartments
  • Heavy weight canvas
  • Webbed belt
Plano Molding 5231 Double Cover Stow N Go Organizer, Porche Red
Plano Molding 5231 Double Cover Stow N Go Organizer, Porche Red
List Price: $12.99
Sale Price: $0.50
You save: $12.49 (96%)
  Eligible for free shipping!
Availability: Usually ships in 1-2 business days

Features

  • Partitioned Stow 'n go
  • Impact resistant
  • Secure latches
  • Quality craftsmanship
  • Convenient size
ArtBin 6990AB Super Satchel Double Deep Box with Removable Dividers, Translucent Clear
ArtBin 6990AB Super Satchel Double Deep Box with Removable Dividers, Translucent Clear
List Price: $30.99
Sale Price: $18.41
You save: $12.58 (41%)
  Eligible for free shipping!
Availability: Usually ships in 1-2 business days

Features

  • Extra depth allows for storage of larger, bulkier supplies
  • Use "open core" (without dividers) for paper and albums or customize up to 8 compartments for multiple storage options including photo storage, card making supplies, dies, templates, punches, and more
  • Same "footprint" as original super satchels, so it's stackable
  • Area on dividers accommodates standard size address labels to ID contents of each section
  • Fits in super satchel cube
Phineas and Ferb Double Compartment Insulated Lunch Kit - Super Dudes
Phineas and Ferb Double Compartment Insulated Lunch Kit - Super Dudes
List Price: $19.99
Sale Price: $6.99
You save: $13.00 (65%)
  Eligible for free shipping!
Availability: Usually ships in 1-2 business days

Features

  • Double compartment insulated lunch box measures : 9"H x 8"W x 5"D
  • Bottom Compartment - 2"H x 8"W x 5"D
  • Top Compartment - 8"H x 8"W x 5"D
  • Disney Logo Zipper pull for main compartmentS
  • Durable polyester material with PVC backing
SPIDERMAN DOUBLE COMPARTMENT LUNCH BOX
SPIDERMAN DOUBLE COMPARTMENT LUNCH BOX
Sale Price: $8.95
  Eligible for free shipping!
Availability: Usually ships in 1-2 business days

Features

  • Lunch box measures 9 1/2"W x 8"H x 3 1/2"D
  • Disney Logo Zipper pull for main compartment
  • Insulated canvas lunch tote (bag)
  • Roomy main interior Compartment, Adjustable shoulder strap



Kann Model SLEMI Two Compartment Side Loader - Australia


Everest Deluxe Double Compartment Backpack


Everest Deluxe Double Compartment Backpack


$19.99


Everest Deluxe Double Compartment Backpack

Piel Double Compartment Shoulder Bag - Chocolate


Piel Double Compartment Shoulder Bag - Chocolate


$86


Piel-Genuine leather double compartment shoulder bag.

Piel Double Compartment Shoulder Bag - Saddle


Piel Double Compartment Shoulder Bag - Saddle


$86


Piel-Genuine leather double compartment shoulder bag.

Piel Double Compartment Shoulder Bag - Black


Piel Double Compartment Shoulder Bag - Black


$86


Piel-Genuine leather double compartment shoulder bag.

Derek Alexander North/South Double Compartment Bucket


Derek Alexander North/South Double Compartment Bucket


$170.4


Derek Alexander North/South Double Compartment Bucket

Everest Deluxe Double Compartment Backpack - Black/Gray


Everest Deluxe Double Compartment Backpack - Black/Gray


$19.99


Everest Deluxe Double Compartment Backpack - Black/Gray

Siamod Manarola Collection Belvedere Double Compartment


Siamod Manarola Collection Belvedere Double Compartment


$176.79


Siamod-Leather Double Compartment Laptop Case

Siamod Manarola Collection Giovani Double Compartment


Siamod Manarola Collection Giovani Double Compartment


$224


Siamod-Leather Double Compartment Laptop Case

Siamod Manarola Collection Mezzo Double Compartment


Siamod Manarola Collection Mezzo Double Compartment


$232


Siamod-Leather Double Compartment Laptop Case

Siamod Manarola Collection Signorini Double Compartment


Siamod Manarola Collection Signorini Double Compartment


$232


Siamod-Leather Double Compartment Laptop Case

Everest Deluxe Double Compartment Backpack - Black


Everest Deluxe Double Compartment Backpack - Black


$11.99


Everest Deluxe Double Compartment Backpack - Black

Roam Wellness VitaSeal Double Compartment Refill, 14/pk


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


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


McKlein USA Chatham Wheeled 17 Double Compartment


$118.39


McKlein USA CHATHAM Wheeled 17" Double Compartment Laptop Case

Everest Double Compartment Backpack 7045CD


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.



Leave a Reply


SEO Powered By SEOPressor