|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Java Geeks, here is simple problem
Can some one help me by filling this Template. Its a Java class.
// This file contains the template for a class used in processing the // student marks for a course. class StudentCourseMarks extends basic { private static int numberTests=2; private static int numberCwks=12; private static int absent = -1; private static int sick = -2; private String lastName,firstName, studentNumber; private int[] TestMarks; private int[] CwkMarks; public StudentCourseMarks (String last, String first, String number) { lastName = last; firstName = first; studentNumber = number; TestMarks = new int[numberTests]; for (int i=0; i<numberTests; i++) TestMarks[i]= absent; CwkMarks = new int[numberCwks]; for (int i=0; i<numberCwks; i++) CwkMarks[i]= absent; } public boolean isAbsentTest(int i) { return (TestMarks[i]==absent); } public boolean isSickTest(int i) { return (TestMarks[i]==sick); } public boolean isAbsentCwk(int i) { return (CwkMarks[i]==absent); } public boolean isSickTest(int i) { return (CwkMarks[i]==sick); } // TEST MARK ADMINISTRATION // First test is numbered 0, second 1, as normal in Java // Set the mark for the relevant test public void setTestMark(int test, int mark){ } // Return the mark for the relevant test public void getTestMark(int test){ } // TO PASS TESTS // EITHER // (i) must have average >= 40 on two tests // OR // (ii) was sick for first test, but passed (>= 40) on second public boolean hasPassedTests () { } // TO BE ELIGIBLE FOR AN UNPEGGED RESIT ON TESTS // (i) has NOT passed tests // AND // (ii) was sick for at least one test public boolean hasUnpeggedResitTests () { } // MARK // (i) if sick for neither, then average // (ii) if sick for first, and passed second then second // (iii) if sick for second then sick public int testMark () { } // GRADE // (i) if eligible for unpegged resit, then 'U' // (ii) else if mark < 40 then 'F' // 40 <= mark < 45 then 'E' // 45 <= mark < 50 then 'D' // 50 <= mark < 60 then 'C' // 60 <= mark < 70 then 'B' // 70 <= mark then 'A' public char testGrade () { } // COURSEWORK MARK ADMINISTRATION // set mark for relevant coursework public void setCwkMark(int test, int mark){ } // return mark for relevant coursework public int getCwkMark(int test){ } // TO PASS COURSEWORKS // EITHER // (i) is not eligible for an unpegged resit on courseworks // (i.e. has been well for more than 65% of courseworks) // AND // (ii) has passed at least 75% of those courseworks for which they // were well // AND // (iii) has an average of over 40% on those courseworks public boolean hasPassedCwks () { } // TO BE ELIGIBLE FOR AN UNPEGGED RESIT ON COURSEWORKS // has been sick for 35% or more of courseworks public boolean hasUnpeggedResitCwks () {} // MARK // the average mark taken over those courseworks for which the student // was well, reduced to 39 if necessary if the student failed the // coursework overall (i.e. if their average was 40 or over, but they // failed more than 25% of the courseworks). public int cwkMark () { } // GRADE // (i) if eligible for unpegged resit, then 'U' // (ii) else if mark < 40 then 'F' // 40 <= mark < 45 then 'E' // 45 <= mark < 50 then 'D' // 50 <= mark < 60 then 'C' // 60 <= mark < 70 then 'B' // 70 <= mark then 'A' public char cwkGrade () { } // OVERALL ASSESSMENT // PASS COURSE // pass courseworks AND pass tests public boolean hasPassed () { } // MARK COURSE // The mark for the course is a weighted average of the test mark and // the coursework mark. Tests count for 80% and courseworks count for 20%. public int mark () { } // GRADE COURSE // If the student is eligible for an unpegged resit, then the grade is // put down as 'U'. // Otherwise it is based on the marks as above public char grade () { } } |
|
#2
|
|||
|
|||
|
RE: Java Geeks, here is simple problem
Hmm, won't take more than ten minutes
|
|
#3
|
||||
|
||||
|
RE: Java Geeks, here is simple problem
I might be wrong but this code shouldnt be here i think.
|
|
#4
|
|||
|
|||
|
RE: Java Geeks, here is simple problem
oh yes, it shouldn't be
|
|
#5
|
|||
|
|||
|
RE: Java Geeks, here is simple problem
I don't like answering threads like this. I have no problem that the code is Java, but it seems to be an assignment and you have left the methods empty.
Unless you at least try to do them I won't help you in any way. Giving you the answers does no good. |
|
#6
|
|||
|
|||
|
RE: Java Geeks, here is simple problem
-----Moved By Postal Cow-----
|
|
#7
|
|||
|
|||
|
RE: Java Geeks, here is simple problem
all i can do is quote this:
Quote:
|
|
#8
|
|||
|
|||
|
RE: Java Geeks, here is simple problem
Thanks for the good laugh Zombie.
|
|
#9
|
||||
|
||||
|
RE: Java Geeks, here is simple problem
yeh thanks. Only just read this thread again.
|
|
#10
|
|||
|
|||
|
RE: Java Geeks, here is simple problem
class StudentCourseMarks extends basic {
private static int numberTests=2; private static int numberCwks=12; private static int absent = -1; private static int sick = -2; private String lastName,firstName, studentNumber; private int[] TestMarks; private int[] CwkMarks; public StudentCourseMarks (String last, String first, String number) { lastName = last; firstName = first; studentNumber = number; TestMarks = new int[numberTests]; for (int i=0; i<numberTests; i++) TestMarks[i]= absent; CwkMarks = new int[numberCwks]; for (int i=0; i<numberCwks; i++) CwkMarks[i]= absent; } public boolean isAbsentTest(int i) { return (TestMarks[i]==absent); } public boolean isSickTest(int i) { return (TestMarks[i]==sick); } public boolean isAbsentCwk(int i) { return (CwkMarks[i]==absent); } public boolean isSickCwk(int i) { return (CwkMarks[i]==sick); } public void setTestMark(int test, int mark){ TestMarks[test] = mark; } public int getTestMark(int test){ return TestMarks[test]; } public boolean hasPassedTests () { int Average =0; boolean Pass=false; Average = (TestMarks[0] +TestMarks[1])/2; if (Average>=40) Pass = true; if (((TestMarks[0]==sick) && (TestMarks[1] >= 40))) Pass =true; return Pass; } public boolean hasUnpeggedResitTests () { return (!hasPassedTests() || (TestMarks[0]== sick || TestMarks[1]==sick)); } public int testMark () { int average=0; if ((TestMarks[0]!=sick) && (TestMarks[1]!=sick)) { average = (TestMarks[0] + TestMarks[1]); average = average/2; } if ((TestMarks[0]==sick) && (TestMarks[1]>=40)) average=TestMarks[1]; if (TestMarks[1]==sick){ average =sick; } return average; } public char testGrade () { char grade; int average = testMark(); if (hasUnpeggedResitTests()) grade= 'U'; else if (average<40) grade ='F'; else if (average>=40 && average<45) grade='E'; else if (average>=45 && average<50) grade ='D'; else if (average>=50 && average<60) grade ='C'; else if (average>=60 && average<70) grade ='B'; else grade ='A'; return grade; } public void setCwkMark(int cwk, int mark){ CwkMarks[cwk] = mark; } public int getCwkMark(int cwk){ return CwkMarks[cwk]; } public boolean hasPassedCwks () { int countPass=0; int countSick=0; int Average=0; int submitted=0; int sum=0; int PassAverage=0; for (int i=0; i<numberCwks;i++) { if (CwkMarks[i]==sick) countSick =countSick +1; if (CwkMarks[i]>=40) countPass =countSick +1; if (CwkMarks[i]!=sick) sum = sum + CwkMarks[i]; } submitted= numberCwks - countSick; Average= sum/submitted; PassAverage = (countPass/submitted) *100; //check Pass courseworks average if ((!hasUnpeggedResitCwks()) || ((PassAverage>=75) && (Average>=40))) return (true); else return (false); } public boolean hasUnpeggedResitCwks () { int NotAbsent=0; int NotSick=0; double submitted=0; boolean Resit; for (int i=0; i<numberCwks; i++){ if (CwkMarks[i]!=absent); //it should be initialised to sick instead of absent // at the start of the template. NotAbsent= NotAbsent + 1; if (CwkMarks[i]!=sick) NotSick= NotSick +1; } submitted= NotSick+NotAbsent; if (submitted <=(25*numberCwks)/100) //4.2 return (true); // Resit Allowed else return (false); // Resit not Allowed } public int cwkMark () { int Average=0; int sum=0; int count=0; int countfailed=0; int Averagefailed=0; for (int i=0; i<numberCwks;i++) { if (CwkMarks[i]!=sick || CwkMarks[i]!=absent) count= count +1; //count submitted cwks. sum = sum + CwkMarks[i]; if (CwkMarks[i]<40) countfailed=countfailed +1; //count the one failed. } Averagefailed= (countfailed/count)*100; Average = sum/count; //Marks Average if( Average>=40 && Averagefailed>25) { Average=39; return Average; } else return Average; } public char cwkGrade () { char grade; if (hasUnpeggedResitCwks()) return grade='U'; if (cwkMark()<40) return grade='F'; if (cwkMark()>=40 && cwkMark()<45) return grade='E'; if (cwkMark()>=45 && cwkMark()<50) return grade ='D'; if (cwkMark()>=50 && cwkMark()<60) return grade ='C'; if (cwkMark()>=60 && cwkMark()<70) return grade ='B'; else return grade='A'; } public boolean hasPassed () { return (hasPassedTests() && hasPassedCwks()); } public int mark () { return ((testMark()*80/100)+(cwkMark()*20/100)); } public char grade () { char grade; if (hasUnpeggedResitTests()) return grade='U'; else if (mark()<40) return grade='F'; else if (mark()>=40 && mark()<45) return grade='E'; else if (mark()>=45 && mark()<50) return grade ='D'; else if (mark()>=50 && mark()<60) return grade ='C'; else if (mark()>=60 && mark()<70) return grade ='B'; else return grade ='A'; } } |
|
#11
|
||||
|
||||
|
RE: Java Geeks, here is simple problem
So i take it the above code is correct?
|
|
#12
|
|||
|
|||
|
RE: Java Geeks, here is simple problem
whot this code does????? main is missing. no Driver?
|
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Client Side Things > Java Geeks, here is simple problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|