Results 1 to 12 of 12
- 06-15-2011, 12:46 AM #1
Member
- Join Date
- Jun 2011
- Posts
- 12
- Rep Power
- 0
help with assignment near finished
i am new to java i have a deadline of tomorrow i have completed my JFrame assignment 2 with no problems i have trawled google and online tutorials for assignment1 i have give it my best go i was in hospital for 4wks and was let in to level3 without level2 because i done vb last year . The assignment is a menu system for student and marks with 8 methods ive 4 done adding, removing and deleting i know for deleting ive to swap elements and unbelievably the alphabetical sort is the other which i can do easy but its the way ive set the program could someone PLEASE HELP if i post my code i want to continue with programming .
- 06-15-2011, 12:49 AM #2
Don't post all your code. Chances are that nobody will read it.
Do you have a specific problem? Then post the relevant code or a SSCCE and ask a specific question.
- 06-15-2011, 01:00 AM #3
Member
- Join Date
- Jun 2011
- Posts
- 12
- Rep Power
- 0
how can i modify my arrays student ,mark( multidimensional array ) of 3 marks for each student and how do i swap 8 elements in a loop to delete a student and their marks thanks
- 06-15-2011, 01:01 AM #4
For starters I wouldn't be using a multidimensional array. I would use a 1D array of Student objects.
- 06-15-2011, 01:04 AM #5
Member
- Join Date
- Jun 2011
- Posts
- 12
- Rep Power
- 0
it asks for a multidimensional array for marks how do i put that into a student object thanks
- 06-15-2011, 01:20 AM #6
How about you actually post your assignment so we can see what you need to do instead of us guessing. A lot of the time people ask for help on how do X when in reality they need to do Y.
- 06-15-2011, 01:28 AM #7
Member
- Join Date
- Jun 2011
- Posts
- 12
- Rep Power
- 0
PROBLEM 1 :A Java program is required to perform the following processing :
(a) input a maximum of 10 students and their corresponding marks, each consisting of :
(i) Student Surname & Forename (surname, forename)
stored in one String variable
(ii) Three exam marks in integer format
(iii) Store the above data in arrays,
(1 array for the student name and a multi-dimensional array for the marks)
(b) Provide a menu system to:
• add a student (and corresponding marks) to the arrays
• modify the details of an existing student
• delete an existing student
• sort the list in alphabetical order of name
• output the list in descending/ascending order
• display the student with the max score (sum of marks/3)
• display the student with the min score (sum of marks/3)
• display the average score of all students recorded (sum of marks/students)
• exit the program
thanks for the help
- 06-15-2011, 01:47 AM #8
This assignment is cruel and unusual punishment. As stated above it would be so much simpler using a single array of objects. Using parallel arrays is a nightmare. Why is it a nightmare?
Whatever changes (add, delete, move) in one array you hjave to make the same change in the other array to ensure the data remains matched.
One thing you have to remember is that a 2D array is just a 1D array of arrays. Take a look at the following code example, especially the bit between the calls to print.
Java Code:class Test { static final int SIZE = 5; public static void main(String[] args) throws Exception { int[][] matrix = new int[SIZE][SIZE]; int counter = 1; for(int row = 0; row < SIZE; row++) { for(int col = 0; col < SIZE; col++) { matrix[row][col] = counter++; } } print(matrix); int[] temp = matrix[0]; matrix[0] = matrix[1]; matrix[1] = temp; print(matrix); } public static void print(int[][] arr) { for(int row = 0; row < SIZE; row++) { for(int col = 0; col < SIZE; col++) { System.out.print(arr[row][col] + " "); } System.out.println(); } System.out.println(); } }
- 06-15-2011, 02:13 AM #9
Member
- Join Date
- Jun 2011
- Posts
- 12
- Rep Power
- 0
a bit confused i think your looping the values to increase each element by 1 i know this sort of what im stuck on but cant put it together i know your swapping elements but could you put it slightly simpler
- 06-15-2011, 03:54 AM #10
- 06-15-2011, 03:56 AM #11
I don't know how much simpler I can put it. You can ignore the first bit of code, that is just creating the 2D array and filling it with values. The important bit is how to swap values about. If you run the code and look at the output you will see that it has swapped the first row (1,2,3,4,5) with the second row (6,7,8,9,10).
- 06-15-2011, 04:00 AM #12
Unfortunately it seems that the most common order for teaching is arrays before objects. Therefore teachers set assignments to work with arrays before students know anything about objects. However they could still come up with better assignments that the ones we usually see on the fora.
Similar Threads
-
Need help almost finished problem thats due
By tm02943 in forum New To JavaReplies: 2Last Post: 03-22-2011, 08:10 AM -
How do I know that byte of stream is finished?
By mani_minhaj in forum New To JavaReplies: 2Last Post: 02-26-2010, 12:08 PM -
Finished Product: What now?
By Unome in forum Java AppletsReplies: 5Last Post: 02-11-2009, 10:41 AM -
How to construct my finished program?
By matpj in forum New To JavaReplies: 0Last Post: 01-14-2009, 05:37 PM -
finished paint!
By diggitydoggz in forum New To JavaReplies: 3Last Post: 01-04-2009, 10:33 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks