Hi!

Having programmed in non-object oriented programming languages for a pretty long time, thinking in terms of classes and objects hurts my brain.

I have written a program in BASIC (to print out the result sheet of a class after having obtained the data such as name of the student and their marks in each subject) which if you read is pretty easy to understand and is sufficiently well documented.

10 CLS

20 REM *** Dimensioning variables ***

30 DIM NAMES$(40)

40 DIM RESULT(40)

50 DIM GRADE$(40, 13)

60 DIM DIVISION(40)

70 DIM TMARKS(40)

80 DIM PERCENTAGE(40)

90 DIM MARKS(40, 13)

100 REM *** subject code list ***

110 REM 1 - English

120 REM 2 - Second Language

130 REM 3 - Mathematics

140 REM 4 - Physics

150 REM 5 - Chemistry

160 REM 6 - Biology

170 REM 7 - Geography

180 REM 8 - History / Civics

190 REM 9 - Sixth Subject

200 REM 10- SUPW

210 REM *** set variable to the number of student in the class ***

220 LET STRENGTH = 2

230 REM *** loop for inputting marks ***

240 FOR I = 1 TO STRENGTH

250 INPUT "Name of Student :"; NAMES$(I)

260 PRINT

270 INPUT "English :"; MARKS(I, 1)

280 PRINT

290 INPUT "Second Language :"; MARKS(I, 2)

300 PRINT

310 INPUT "Mathematics :"; MARKS(I, 3)

320 PRINT

330 INPUT "Physics :"; MARKS(I, 4)

340 PRINT

350 INPUT "Chemistry :"; MARKS(I, 5)

360 PRINT

370 INPUT "Biology :"; MARKS(I, 6)

380 PRINT

390 INPUT "Geography :"; MARKS(I, 7)

400 PRINT

410 INPUT "History / Civics :"; MARKS(I, 8)

420 PRINT

430 INPUT "Sixth Subject :"; MARKS(I, 9)

440 PRINT

450 INPUT "S.U.P.W. :"; MARKS(I, 10)

460 NEXT I

470 REM *** process result ***

480 PRINT "Processing result........"

490 PRINT "========================="

500 FOR I = 1 TO STRENGTH

510 PRINT

520 PRINT "Processing Roll Number:"; I

530 REM *** initialize tmarks(i) to zero

540 TMARKS(I) = 0

550 FOR J = 1 TO 10

560 REM *** process grades , total marks and percentage ***

570 IF MARKS(I, J) >= 0 AND MARKS(I, J) <= 9 THEN GRADE$(I, J) = "10*"

580 IF MARKS(I, J) >= 10 AND MARKS(I, J) <= 19 THEN GRADE$(I, J) = "09*"

590 IF MARKS(I, J) >= 20 AND MARKS(I, J) <= 29 THEN GRADE$(I, J) = "08*"

600 IF MARKS(I, J) >= 30 AND MARKS(I, J) <= 39 THEN GRADE$(I, J) = "07*"

610 IF MARKS(I, J) >= 40 AND MARKS(I, J) <= 49 THEN GRADE$(I, J) = "06"

620 IF MARKS(I, J) >= 50 AND MARKS(I, J) <= 59 THEN GRADE$(I, J) = "05"

630 IF MARKS(I, J) >= 60 AND MARKS(I, J) <= 69 THEN GRADE$(I, J) = "04"

640 IF MARKS(I, J) >= 70 AND MARKS(I, J) <= 79 THEN GRADE$(I, J) = "03"

650 IF MARKS(I, J) >= 80 AND MARKS(I, J) <= 89 THEN GRADE$(I, J) = "02"

660 IF MARKS(I, J) >= 90 AND MARKS(I, J) <= 100 THEN GRADE$(I, J) = "01"

670 REM *** add up marks to get the total marks ***

680 TMARKS(I) = TMARKS(I) + MARKS(I, J)

690 NEXT J

700 REM *** calculate percentage ***

710 PERCENTAGE(I) = (TMARKS(I) / 1000) * 100

720 NEXT I

730 REM *** process promoted/ detained ***

740 FOR I = 1 TO STRENGTH

750 REM *** processing for compulsory subjects ENGLISH & SUPW ***

760 REM *** rflag=0 means 'PROMOTED' rflag=1 means 'DETAINED'

770 LET RFLAG = 0

780 IF MARKS(I, 1) < 40 OR MARKS(I, 10) < 40 THEN RFLAG = 1

790 REM *** processing for two subject failure ***

800 REM *** fcounter stands for FAIL COUNTER ***

810 LET FCOUNTER = 0

820 FOR J = 1 TO 10

830 IF MARKS(I, J) < 40 THEN FCOUNTER = FCOUNTER + 1

840 NEXT J

850 IF FCOUNTER > 2 THEN RFLAG = 1

860 REM *** update result '1' means PROMOTED '0' means DETAINED ***

870 IF RFLAG = 1 THEN RESULT(I) = 0 ELSE RESULT(I) = 1

880 REM *** process division ***

890 IF PERCENTAGE(I) >= 80 AND RESULT(I) = 1 THEN DIVISION(I) = 1

900 IF PERCENTAGE(I) >= 60 AND PERCENTAGE(I) <= 79 AND RESULT(I) = 1 THEN DIVISION(I) = 2

910 IF PERCENTAGE(I) < 60 AND RESULT(I) = 1 THEN DIVISION(I) = 3

920 IF RESULT(I) = 0 THEN DIVISION(I) = 0

930 NEXT I

940 REM *** process printing of result ***

950 REM *** start loop ***

960 FOR I = 1 TO STRENGTH

970 LPRINT " St. Josephs Convent"

980 LPRINT " Kalimpong"

990 LPRINT

1000 LPRINT " Report Card"

1010 LPRINT " ( Class: VIII )"

1020 LPRINT

1030 LPRINT "Roll Number : ";I;" Name of Student : "; NAMES$(I)

1040 LPRINT "-------------------------------------------------------------"

1050 LPRINT "SUBJECT MARKS GRADE"

1060 LPRINT "-------------------------------------------------------------"

1070 LPRINT "English "; MARKS(I, 1); " "; GRADE$(I, 1)

1080 LPRINT "Second Language "; MARKS(I, 2); " "; GRADE$(I, 2)

1090 LPRINT "Mathematics "; MARKS(I, 3); " "; GRADE$(I, 3)

1100 LPRINT "Physics "; MARKS(I, 4); " "; GRADE$(I, 4)

1110 LPRINT "Chemistry "; MARKS(I, 5); " "; GRADE$(I, 5)

1120 LPRINT "Biology "; MARKS(I, 6); " "; GRADE$(I, 6)

1130 LPRINT "Geography "; MARKS(I, 7); " "; GRADE$(I, 7)

1140 LPRINT "History/Civics "; MARKS(I, 8); " "; GRADE$(I, 8)

1150 LPRINT "Sixth Subject "; MARKS(I, 9); " "; GRADE$(I, 9)

1160 LPRINT "S.U.P.W "; MARKS(I, 10); " "; GRADE$(I, 10)

1170 LPRINT "-------------------------------------------------------------"

1180 LPRINT "TOTAL MARKS: "; TMARKS(I); " PERCENTAGE : "; PERCENTAGE(I); "%"

1190 LPRINT

1200 IF RESULT(I) = 1 THEN RESULT$ = "Promoted" ELSE RESULT$ = "Detained"

1210 IF DIVISION(I) = 0 THEN DIVISION$ = " No Division Awarded"

1220 IF DIVISION(I) = 1 THEN DIVISION$ = " 1st"

1230 IF DIVISION(I) = 2 THEN DIVISION$ = " 2nd"

1240 IF DIVISION(I) = 3 THEN DIVISION$ = " 3rd"

1250 LPRINT "RESULT: "; RESULT$; " DIVISION:"; DIVISION$

1260 LPRINT

1270 LPRINT

1280 LPRINT "= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = "

1290 LPRINT "Division will be awarded on the basis of the percengage of marks"

1300 LPRINT "----------------------------------------------------------------"

1310 LPRINT "1st Division ---> 80% and above"

1320 LPRINT "2nd Division ---> 60% - 79%"

1330 LPRINT "3rd Division ---> Below 60% provided the student passes"

1340 LPRINT "Failed student will not be awarded any division"

1350 LPRINT "= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = "

1360 LPRINT

1370 LPRINT

1380 LPRINT "= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = "

1390 LPRINT "Grade intervals for the subjects are as follows"

1400 LPRINT "-----------------------------------------------"

1410 LPRINT "90 - 100 ---> 01 50 - 59 ---> 05 10 - 19 ---> 09*"

1420 LPRINT "80 - 89 ---> 02 40 - 49 ---> 06 00 - 09 ---> 10*"

1430 LPRINT "70 - 79 ---> 03 30 - 39 ---> 07*"

1440 LPRINT "60 - 69 ---> 04 20 - 29 ---> 08* * -----> FAIL"

1450 LPRINT "= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = "

1460 REM *** Send Form Feed character to the printer to move to the next page ***

1470 LPRINT CHR$(12)

1480 NEXT I

I want to write the same program in JAVA. What are the classes and functions that I will need? The kind of help that I need here is that if you could let me know which classes I need to break up the above BASIC program into and which function should the classes contain. I have picked up the basics of the input/output/process of JAVA and am pretty confident I can write the program (though I *may* just need help!).

Thanks for reading this post. I will be more thankful, if you could give me a postive response.

Regards,

Rupesh Pradhan