Results 1 to 2 of 2
Thread: Assertions
- 05-30-2011, 11:07 AM #1
Member
- Join Date
- Apr 2011
- Posts
- 35
- Rep Power
- 0
Assertions
Hey,
I want to test the following method,
the grades are defined in the following method,Java Code:public String equateGrades(String marks){ double mark = Double.parseDouble(marks); String[] grades = setGrades(); for(int i =0;i<4;i++){ if((mark<=100)&&(70<=mark)){ grade = grades[0]+" and has a distinction"; } else if((mark<=60)&&(69<=mark)){ grade = grades[1]+" and has a credit"; } else if((mark<=59)&&(50<=mark)){ grade = grades[2]+" and has a pass"; } else if((mark<=49)&&(40<=mark)){ grade = grades[3]+" and has barely passed"; } else if(mark<40){ grade = grades[4]+" and has to redo his/her exams"; } } return grade; }
Is there an assertion that checks whether a certain mark,say 50 is equivalent to a grade of C?Java Code:public String[] setGrades(){ String[] grades = new String[5]; grades[0]="A"; grades[1]="B"; grades[2]="C"; grades[3]="D"; grades[4]="E"; return grades; }
- 05-30-2011, 11:14 AM #2
You might like to read this : Programming With Assertions
GoldestJava Is A Funny Language... Really!.gif)
Click on * and add to member reputation, if you find their advices/solutions effective.
Similar Threads
-
Assertions
By LovJava in forum New To JavaReplies: 3Last Post: 01-07-2010, 09:13 AM -
Assertions on Eclipse
By jon80 in forum New To JavaReplies: 1Last Post: 05-19-2008, 03:25 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks