Skip to main content

Need major help with a project! I dont even know where to start with this, if anyone has any input or anything it would help.

4 replies [Last post]
tpratt3
Offline
Joined: 2013-12-02
Points: 0

Using an array to Determine Grades: Complete hands-on project. There are 3 versions of this program, calculate the sum, average, largest, and smallest elements of an array. Pick the one that you like best. Add logic inside the for loop to test if the number is between 90 and 100.If the number is in this range, then it should add 1 to the tally of gradeA. You should have another test to see if the number is between 80 and 89 and if it is it should add 1 to the tally of gradeb. You should continue to have tests for 70 to 79 being gradeC: 60-69 being graded; and below 60 as being gradeF. After the for loop is done , you should display a list of how many students had A's, B's, etc. in the output message box.

If the data is:
90, 100, 80, 85, 63, 73, 80, 92, 90

The display should be something like this:

The sum is 753
The average is 83
The largest test score is 100
The lowest test score is 63
The number of students with scores of 90-100 (A) is 4
The number of students with scores of 80-89 (B) is 3
The number of students with scores of 70-79 (C) is 1
The number of students with scores of 60-69 (D) is 1
The number of students with scores below 60 (F) is 0

- Set the variables of gradeA, gradeB, gradeC, gradeD, and gradeF to zero at beginning of program.

- Set up the 5 if statements appropriately to count the gradeA, gradeB, gradeC, gradeD, and gradeF variables.

- Print the counts for each grade in a message box.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Vishwajit
Offline
Joined: 2013-10-11
Points: 0

Hi tpratt3,

I just saw your post in morning.
This is done. See the code below. Let me know if you want more help.

class Grades{
int arr[] = {90, 100, 80, 85, 63, 73, 80, 92, 90};
int sum, average, smallest=arr[0], largest=arr[0], gradeA, gradeB, gradeC, gradeD, gradeE, gradeF;

public void calculateAll(){

for(int i=0; i=90 && arr[i]<=100){
gradeA++; // Grade A
}
else if(arr[i]>=80 && arr[i]<=89){
gradeB++; // Grade B
}
else if(arr[i]>=70 && arr[i]<=79){
gradeC++; // Grade C
}
else if(arr[i]>=60 && arr[i]<=69){
gradeD++; // Grade D
}
else if(arr[i]<60){
gradeF++; // Grade F
}

// Largest from the array
if(largest

creampemutihwajah
Offline
Joined: 2013-12-17
Points: 0

very informative..thank you

tpratt3
Offline
Joined: 2013-12-02
Points: 0

Thankyou so very much! It has been stressing me out for a week an a half now. God bless you!

Vishwajit
Offline
Joined: 2013-10-11
Points: 0

Above code is not copy pasted well, so download the file from below link. http://ge.tt/5JgWYh61?c