PDA

View Full Version : Help Needed Please



rhys
03-25-2007, 05:15 PM
Hi everyone... Just wondering if yous could give me alot of help here on a question i have been asked for university:mad: I dont have a clue about it to be honest and this has to be done by tomarrow evening:eek:
So any help possible will be greatly appreciated!
Thanks!:)

So heres the question.. and they have started the code as u can see at the bottom. Just i dont have a clue how to write the rest!:mad:

Task 1. Design, code and fully test a program that sorts a set of students into descending overall mean mark order. The overall mean mark is to be calculated from their level 2 and level 3 results). Each students details are stored across a set of arrays, details below. The program should then display the following for all the students:
Students identity information (Names, Person I.D.)
Final mean mark (calculated using the level 2 mean mark as 25% of the overall mean mark and the level 3 mean mark as 75% of the overall mean mark),
Degree classification (using the calculated mean mark) mapped to:
70.00 or more gives a ‘1st’,
60.00 to 69.99 gives a ‘2:1’,
50.00 to 59.99 gives a ‘2:2’,
40.00 to 49.99 gives a ‘3rd’,
39.99 and below gives a ‘Fail’
The sorting of the arrays must be implemented as a separate method called from the ‘main’ method. The code file has been started for you and contains test data, already populating the arrays, for which you will be required to create a set of expected results and analyse to check if the test data thoroughly tests the application and if not, create your own test data set(s) and their expected results. You can assume the data will always be populating the arrays when the program starts and will be correct.
Arrays Setup – All 20 in size (allowing for 20 students maximum):
Surname (String)
Firstname (String)
Person I.D. (6 Digit Integer – not allowed to start with 0 (zero))
Level 2 Mean Mark (double value 0.00 through to 100.00 only)
Level 3 Mean Mark (double value 0.00 through to 100.00 only)
Overall Mean Mark (double value, to be automatically calculated from the level 2 and level mean marks as they are entered)

Code:

import java.util.*;
public class student_grade
{
public static final int MAX_STUDENTS = 20;
public static String[] surname = { “Bloggs1”, “Bloggs2”, “Bloggs3”, “Bloggs4”, “Bloggs5”, “Bloggs6”, “Bloggs7”, Bloggs8”, “Bloggs9”, “Bloggs10”, “Bloggs11”, “Bloggs12” };
public static String[] firstname = { “Joe1”, “Joe2”, “Joe3”, “Joe4”, “Joe5”, “Joe6”, “Joe7”, “Joe8”, “Joe9”, “Joe10”, “Joe11”, “Joe12” };
public static int[] person_id = { 123401, 123402, 123403, 123404, 123405, 123406, 123407, 123408, 123409, 123410, 123411, 123412 };
public static double[] lev2_mean = { 43.56, 45.23, 78.65, 50.00, 60.00, 80.23, 45.23, 45.23, 50.01, 49.99, 99.99, 40.00 };
public static double[] lev3_mean = { 40.00, 55.33, 67.54, 65.00, 62.63, 70.56, 54.23, 36.45, 55.54, 59.34, 90.87, 40.00 };
public static double[] overall_mean = new double[MAX_STUDENTS];
public static int no_of_students = 12;

public static void sort_students()
{
// Declare and Initialise Variables

// Sort the student arrays

}

public static void main(String[] args)
{
// Declare and initialise variables
int i;

// Work out overall mean for each student
for (i=0; i < no_of_students; i++)
{
// Calculate and store overall mean for this (i) student
}

// Sort student arrays
sort_students();

// Output results
for (i=0; i < no_of_students; i++)
{
// Output id, name and overall mean
System.out.print(person_id[i] + “ “ + firstname[i] + ” ” + surname [i] + ” : ” + overall_mean[i]);
// Output degree classification
}
}
}

rhys
03-27-2007, 12:37 PM
Anyone? :(