Client Side Things
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesClient Side Things

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old January 15th, 2004, 06:05 PM
Lisa Lisa is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 2 Lisa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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 () {



}

}

Reply With Quote
  #2  
Old January 15th, 2004, 06:06 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: Java Geeks, here is simple problem

Hmm, won't take more than ten minutes

Reply With Quote
  #3  
Old January 15th, 2004, 07:04 PM
Andrew's Avatar
Andrew Andrew is offline
Moderator
Click here for more information. Click here for more information
 
Join Date: Apr 2007
Location: United Kingdom
Posts: 1,945 Andrew User rank is Private First Class (20 - 50 Reputation Level)Andrew User rank is Private First Class (20 - 50 Reputation Level)  Folding Points: 2429 Folding Title: Novice Folder
Time spent in forums: 4 Days 5 h 57 m 19 sec
Reputation Power: 3
RE: Java Geeks, here is simple problem

I might be wrong but this code shouldnt be here i think.

Reply With Quote
  #4  
Old January 15th, 2004, 07:18 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: Java Geeks, here is simple problem

oh yes, it shouldn't be

Reply With Quote
  #5  
Old January 16th, 2004, 12:03 AM
-vertigo- -vertigo- is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Louth, Lincolnshire
Posts: 314 -vertigo- User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 24 sec
Reputation Power: 2
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.

Reply With Quote
  #6  
Old January 16th, 2004, 12:11 AM
postalcow postalcow is offline
Codewalkers Beginner (1000 - 1499 posts)
 
Join Date: Apr 2007
Location: Ford CIty, PA USA
Posts: 1,267 postalcow User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
Send a message via Yahoo to postalcow
RE: Java Geeks, here is simple problem

-----Moved By Postal Cow-----

Reply With Quote
  #7  
Old January 16th, 2004, 01:25 PM
zombie zombie is offline
Codewalkers Intermediate (1500 - 1999 posts)
 
Join Date: Apr 2007
Location: serbia
Posts: 1,876 zombie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
RE: Java Geeks, here is simple problem

all i can do is quote this:

Quote:
Yes, I can. And no, I won't.

Because if I did, you might actually pass your class without knowing how to write trivial programs like these.

And if you pass your class you might get a job as a programmer some day.

And if you get a job as a programmer some day, you might wind up working on a project with me.

And if you wind up working on a project with me as a programmer, and you do not know how to write trivial programs like these, I would have to do you serious bodily harm.


Reply With Quote
  #8  
Old January 16th, 2004, 02:12 PM
postalcow postalcow is offline
Codewalkers Beginner (1000 - 1499 posts)
 
Join Date: Apr 2007
Location: Ford CIty, PA USA
Posts: 1,267 postalcow User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
Send a message via Yahoo to postalcow
RE: Java Geeks, here is simple problem

Thanks for the good laugh Zombie.

Reply With Quote
  #9  
Old January 22nd, 2004, 02:18 PM
Andrew's Avatar
Andrew Andrew is offline
Moderator
Click here for more information. Click here for more information
 
Join Date: Apr 2007
Location: United Kingdom
Posts: 1,945 Andrew User rank is Private First Class (20 - 50 Reputation Level)Andrew User rank is Private First Class (20 - 50 Reputation Level)  Folding Points: 2429 Folding Title: Novice Folder
Time spent in forums: 4 Days 5 h 57 m 19 sec
Reputation Power: 3
RE: Java Geeks, here is simple problem

yeh thanks. Only just read this thread again.

Reply With Quote
  #10  
Old January 23rd, 2004, 02:06 PM
Lisa Lisa is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 2 Lisa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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';

}

}

Reply With Quote
  #11  
Old January 23rd, 2004, 07:13 PM
Andrew's Avatar
Andrew Andrew is offline
Moderator
Click here for more information. Click here for more information
 
Join Date: Apr 2007
Location: United Kingdom
Posts: 1,945 Andrew User rank is Private First Class (20 - 50 Reputation Level)Andrew User rank is Private First Class (20 - 50 Reputation Level)  Folding Points: 2429 Folding Title: Novice Folder
Time spent in forums: 4 Days 5 h 57 m 19 sec
Reputation Power: 3
RE: Java Geeks, here is simple problem

So i take it the above code is correct?

Reply With Quote
  #12  
Old January 28th, 2004, 01:37 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: Java Geeks, here is simple problem

whot this code does????? main is missing. no Driver?

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesClient Side Things > Java Geeks, here is simple problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |