729
7.public voidreverse()
{
inttempScore;
inthalfLength = score.length/ 2 ;
for(intindex = 0 ; index < halfLength; index++)
{
tempScore = score[index];
score[index] = score[score.length - (index + 1 )];
score[score.length - (index + 1 )] = tempScore;
}
}
8.public classParts
{
intnumber;
doublecost;
Parts(inthowMany, doublehowMuch)
{
number = howMany;
cost = howMuch;
}
}
.
.
Parts[] inventory = newParts[ 100 ];
String inLine;
intindex;
intnumber;
doublecost;
intcount = 0 ;
// File has been declared and instantiated
while((inLine = inFile.readLine()) != null)
{
index = inLine.indexOf(' '); // Find position of blank
number = Integer.parseInt(inLine.substring( 0 , index)); // Extract a number
// Remove the first part of the string
inLine = inLine.substring(index+ 1 , inLine.length());
cost = Double.parseDouble(inLine);
inventory[count] = newParts(number, cost);
count++;
}