Discussion » Java Help

This is a read-only copy. The forum ran on iamcal.com from 2000 until its database was lost in 2016, and this topic was rebuilt from copies saved by the Internet Archive's Wayback Machine. Some replies may be missing.
Posted by merolam, 23:19, 29th April 2004:
 
Hi there, I was told by a friend that i might be able to get some help with some Java work :-) Im pretty new to Java, only started it a few months ago so this may seem simple to some of you but to me its a little over my head still.

Basically its this : For the 3rd part of my coursework i must create a program that:

(The School of MIS maintain the total percentage marks of 30 MSc students in a computer-based system. For each student they store the following information in the system:
A unique number between 1 and 30 that is often used to identify the student.
The overall percentage mark obtained by the student
The student’s names. Implement a single class called MScResults that contains a number of attributes and methods. The methods include:
setNames(), - This public method takes two parameters. The first parameter is an integer and the second parameter is a string
storeMark(), - a public method that stores the total percentage mark achieved by a given student. It takes two parameters. The first parameter is an integer and the second parameter is a number that can have fractional parts
getMark(), - public method that returns the total percentage mark obtained by a given student. It takes a single numeric parameter
getNoOfStudents(), - public method that takes two parameters and returns the number of students that had total percentage marks between the given two numbers
displaylowestMark(), displayhighest() and
displayResults() - This method displays the results of all the students in the format shown below.

Student Name Percentage Mark Staus/GRADE
James Clever 80 Distinction
Java Shy 33 Fail
.. ..

The “Status/Grade” of a student is determined as follows:
If the total mark is 69.5 and above then the “Status/Grade” is “Distinction”.
If the mark is between 59.5 and 69.4 then the “Status/Grade” is “Merit”.

(b) Implement a Test class for the MScResults class above.

Ok, that isnt just spam. What im stuck on, basically i wont lie - most of it. But espcially the Unique number thing, how can i make an array to check the number isnt in use allready ? is that possible ? 2, The displayResults() - I have no idea how to do this at all, not in the way displayed, 3 - A test class shouldnt be that hard to make but im not sure

Sorry for the spam. I would really appreciate any help at all, Im just pretty new to Java. If your bored and want something to do - by all means help yourself :-) Post a reply here if u can help in anyway or please e-mail me b_beta@btinternet.com

Thanks,

Michael Merola
Posted by cal, 00:20, 30th April 2004:
 
i'm by no means a java guru, but consider thsi some starting advice.

create two classes: MScResults which contains the methods and a Vector(), and then MScResult which represents a single result. give the MScResult class three properties - id, name and score, and a single method, getStatus().

i might right the actual java a bit later because i'm bored
Posted by Alfie, 00:42, 30th April 2004:
 
write?
Posted by jeffld, 01:03, 30th April 2004:
 
left.
Posted by cal, 01:10, 30th April 2004:
 
jesus. i am fick
Posted by cal, 01:15, 30th April 2004:
 
ok, an attempt at the class and some basic tests are posted here:
code.iamcal.com/java/
Posted by Alfie, 01:36, 30th April 2004:
 
cal - remember that next time you shout at me for being fucking stupid :P
Posted by Sul, 10:08, 30th April 2004:
 
Get it right, Chay. He'll shout at me first then I'll cry and remind him it was you that being stupid and then he'll call us both fucking stupid.
Posted by Sul, 10:08, 30th April 2004:
 
*double post grumble grumble*
Posted by merolam, 10:59, 30th April 2004:
 
lol cheers, ignore them :-P

Thanks for the help, im still working on that key id thing + now incorporating what you have done into my own work. Thanks for that, if u get bored by all means help yourself to more of the pie ;-)

Michael Merola
Posted by arsepuppy, 11:05, 30th April 2004:
 
"i'm by no means a java guru, but consider thsi some starting advice. "

Holy FUCK. We've found something Cal doesn't rock at. 0_o
Posted by merolam, 11:07, 30th April 2004:
 
I appologise to cal now for bringing it up ! !
Posted by merolam, 14:23, 30th April 2004:
 
hmm for some reason, i cant actually get the program to work cal, maybe something im doing wrong ?
Posted by cal, 17:26, 30th April 2004:
 
well, it compiles fine for me. what happens when you run comp.bat to compile it?
Posted by jeffld, 01:54, 1st May 2004:
 
I was able to get it to run, but only after changing one line.

Line 23 of MScResults.java

Before:

this.results.add(r)



After:

this.results.addElement(r)



Student Name Percentage Mark Status/GRADE
Bob 50.0 Whatever
Jack 70.0 Distinction
Jill 22.4 Whatever
Posted by cal, 02:37, 1st May 2004:
 
aha :)
Posted by cal, 02:38, 1st May 2004:
 
(you have a older version of the JDK)
Posted by jeffld, 21:05, 1st May 2004:
 
ya probably. I won't even tell you what I used. I would be the laughing stock if I did.

Some of these things are knd of neat to watch.

Sodaplay
Posted by moitio, 16:18, 3rd May 2004:
 
I hate JAVA. It's too complicated for me. It was originaly created to sunc household appliances
Posted by Brock, 16:20, 3rd May 2004:
 
I prefer Bali.
Posted by moitio, 16:21, 3rd May 2004:
 
whats that?
Posted by Abe Frohman, 16:26, 3rd May 2004:
 
hehe
Posted by Brock, 16:32, 3rd May 2004:
 
Altogether now...

*whoooooosssh*
Posted by moitio, 17:20, 3rd May 2004:
 
what????
Posted by Brock, 17:27, 3rd May 2004:
 
isn't it?
Posted by Brock, 17:28, 3rd May 2004:
 
Hmmm?
Posted by Brock, 17:28, 3rd May 2004:
 
Small boys in the park?
Posted by Brock, 17:28, 3rd May 2004:
 
Jumpers for goalposts?
Posted by Brock, 17:28, 3rd May 2004:
 
Hmmm?
Posted by moitio, 17:29, 3rd May 2004:
 
Stop confusing me!!!!!!
Posted by Brock, 17:30, 3rd May 2004:
 
I bet breathing confuses you, son...

"in....out.....in.......in......in again...*gasp!*"

*thud*
Posted by syl, 17:33, 3rd May 2004:
 
Now Now Brock, be nice.
Posted by Brock, 17:34, 3rd May 2004:
 
And destroy my reputation?

Bollocks.
Posted by moitio, 17:35, 3rd May 2004:
 
im stressed!!!!! ive got my SATs in... urr.. 2400 - 1759 + 900 = 1541 ... 15 hours and 41 minutes... BRAIN OVERLOAD!!! SYSTEM SHUTDOWN¬~¬~¬~¬ 5 4 3 2 1 *FAINTS*
Posted by moitio, 17:35, 3rd May 2004:
 
+ i fucked that calculation up!!
Posted by Brock, 17:43, 3rd May 2004:
 
What are the chances, eh?
Posted by moitio, 17:45, 3rd May 2004:
 
Somebody kill me!!!
Posted by Brock, 18:10, 3rd May 2004:
 
If only you knew the risk you were taking, saying that to me...
Posted by moitio, 18:36, 3rd May 2004:
 
I can take a really wild guess...
Posted by sal, 18:50, 3rd May 2004:
 
I think merolam should get off his arse and learn how to program himself and not get other people to do his coursework for him :/
Posted by Sul, 19:13, 3rd May 2004:
 
I think you've got a point, Sal.

Cal, that's it. No more help. From now on you code your own site. Sorry but you have to learn.
Posted by moitio, 19:31, 3rd May 2004:
 
Hehe who helps him? Or had you better publish it in a web page?
Posted by Sul, 19:34, 3rd May 2004:
 
:)
Posted by moitio, 19:35, 3rd May 2004:
 
Hi there, I was told by a friend that i might be able to get some help with some Java work :-) Im pretty new to Java, only started it a few months ago so this may seem simple to some of you but to me its a little over my head still.


Well he was told by a friend. Perhaps we should help him. I mean its 2 months right?
Posted by merolam, 21:20, 3rd May 2004:
 
i didnt mean to force anyone ! i just got stuck, trying to figure it out myself just donno how to , lol :-/ need a way to enter the values get_xxx etc, cheers for the help so far. To all.

Michael Merola