Quote (labatymo @ Feb 25 2015 04:17pm)
either store them in a list or an array
ex...
Code
{
List<int[]> arrays = new ArrayList<int[]>( );
for ( int i = 0; i < 5; i++ ) {
arrays.add( new int[6] );
}
}
//or
{
int[][] arrays = new int[5][];
for ( int i = 0; i < 5; i++ ) {
arrays[i] = new int[6];
}
}
damn thanks
we cant use 2d arrays and we havent done anything with lists so id imagine we cant use those either
if someone could point in the right direction for this question I would be appreciative
Code
In a gymnastics or diving competition, each contestant's score is calculated by dropping the lowest and highest scores and then adding the remaining scores. A judge awards points between 1 and 10, with 1 being the lowest and 10 being the highest. Write a program that will read judges' scores from an input file (there will be between 5 and 10 scores) and output the points received by the contestant, formatted with two decimal places. For example, Input file contains: 9.2 9.3 9.0 9.9 9.5 9.5 9.6 9.8 Dropped scores: 9.0 and 9.9 Points received: 56.90 Since you do not know the exact number of scores you will need to count the scores as they are read from the input file and use this as the actual size, or number of elements actually stored in your array.
example of possible input file
Code
Chen Ruolin 9.2 9.3 9 9.9 9.5 9.5 9.6 9.8
Emilie Heymans 9.2 9.2 9 9.9 9.5 9.5 9.7 9.6
Wang Xin 9.2 9.2 9.1 9.9 9.5 9.6 9.4 9.8
Paola Espinosa 9.2 9.3 9.2 9 9.5 9.3 9.6 9.8
Tatiana Ortiz 9.2 9.3 9 9.4 9.1 9.5 9.6 9.8
Melissa Wu 9.2 9.3 9.3 9.7 9.2 9.2 9.6 9.8
Marie-Eve Marleau 9.2 9.2 9.2 9.9 9.5 9.2 9.3 9.8
Tonia Couch 9.2 9 9.1 9.5 9.2 9.3 9.4 9.6
Laura Wilkinson 9.7 9.1 9.3 9.4 9.5 9.4 9.6 9.2
my original plan was to make separate arrays for each competitor but because that can change I cant
so should I make just two arrays one for the names and then one for the scores? and use some kind of for loop to read only the first x integers and then somehow get the min and max from those then get the total and then put that value into another array to hold it?
This post was edited by Beat on Feb 25 2015 04:00pm