Modify the Student class getAverage() method to drop the lowest grade when calculating the average. You will need to loop through the array and find the lowest grade.

What will be an ideal response?


```
/**
* Method to r e turn the av erage of the g rade s a f t e r you drop
* the l owe s t grade f o r t h i s s tud ent
* @return the ave rage o f the g rade s or 0.0 i f no grade ar ray or
* no g rade s
*/
public double getAverageDropLowest ( )
{
double average = 0 . 0 ;
double lowe s t = 100;
int numGrades = this . gradeArray . l eng th ;
i f ( this . gradeArray != nul l && numGrades > 0)
{
double sum = 0 . 0 ;
// loop through the g rade s
for ( int i = 0 ; i < this . gradeArray . l eng th ; i++)
{
// check i f t h i s i s lower
i f ( this . gradeArray [ i ] < lowe s t )
{
lowe s t = this . gradeArray [ i ] ;
}
// add t h i s grade to the sum
sum = sum + this . gradeArray [ i ] ;
}
// i f t h e r e was more than one grade remove the l owe s t
i f ( numGrades > 1)
{
sum = sum ¡ lowe s t ;
numGrades¡¡;
}
ave rage = sum / numGrades ;
}
return average ;
}
```

Computer Science & Information Technology

You might also like to view...

Your boss has read about IPv6 and wants to know whether the network you oversee is ready for the transition. Prepare a response based on the networking and computer operating systems used in your facility.

What will be an ideal response?

Computer Science & Information Technology

Which of the following is a system component that can be measured in Windows Performance Monitor?

A. object B. view C. counter D. log

Computer Science & Information Technology

Which two executable files start the Registry editor?

What will be an ideal response?

Computer Science & Information Technology

The most popular plug on a computer is the small, rectangular ________ port, which is used to connect almost all of today's external devices.

A. USB B. RCA C. HDMI D. DVI

Computer Science & Information Technology