bonjour
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62 import java.io.*; public class StuDetail { int RollNo; } class StudMarks extends StuDetail { float sub1; float sub2; float sub3; float TotalMarks; void getData() { System.out.println("\nRecording Entry"); try { BufferedReader obj=new BufferedReader(new InputStreamReader(System.in)); String sRNo,sSub1,sSub2,sSub3; System.out.println("Enter Roll No:"); System.out.flush(); sRNo=obj.readLine(); RollNo=Integer.parseInt(sRNo); System.out.println("Enter Marks for Subject 1:"); System.out.flush(); sSub1=obj.readLine(); sub1=Float.parseFloat(sSub1); System.out.println("Enter Marks for Subject 2:"); System.out.flush(); sSub2=obj.readLine(); sub2=Float.parseFloat(sSub2); System.out.println("Enter Marks for Subject 3:"); System.out.flush(); sSub3=obj.readLine(); sub3=Float.parseFloat(sSub3); TotalMarks=sub1+sub2+sub3; } catch(Exception e) {} } void display() { System.out.println("\nDisplaying Record"); System.out.println("Roll No:"+RollNo); System.out.println("Subject 1:"+sub1); System.out.println("Subject 1:"+sub2); System.out.println("Subject 1:"+sub3); System.out.println("Total Marks:"+TotalMarks); } void TotalMarks() { System.out.println("\nDisplaying Record"); System.out.println("Roll No:"+RollNo); System.out.println("Total Marks:"+TotalMarks); } }Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68 import java.io.BufferedReader; import java.io.InputStreamReader; public class StudentDatabase { public static void main(String []args) { System.out.println("\n======STUDENT DATABASE=====\n"); float HighMark_sub1; float HighMark_sub2; float HighMark_sub3; float StudHightMark; int No_of_stud=3,choice; String str; char c; try { BufferedReader obj=new BufferedReader(new InputStreamReader(System.in)); System.out.print("\nEnter number of students:"); System.out.flush(); str=obj.readLine(); No_of_stud=Integer.parseInt(str); StudMarks SMobj[]=new StudMarks[No_of_stud]; //SMobj[i] = new SMobj[i]; while(true) { System.out.println("\nChoose your choice...."); System.out.println("1)PASS ENTRY"); System.out.println("2)DISPLAY ALL RECORDS"); System.out.println("3)DISPLAT TOTAL MARKS for all students"); System.out.println("4)DISPLAT HIGHEST MARKS in each subject"); System.out.println("5 DISPLAY student who recived highest total marks"); System.out.println("6 Exit"); System.out.println("ENTER YOUR CHOICE:"); System.out.flush(); str=obj.readLine(); choice=Integer.parseInt(str); switch(choice) { case 1: for(int i=0; i<No_of_stud; i++) { SMobj[i] = new SMobj(i); SMobj[i].getData(); break; } case 2: for(int i=0; i<No_of_stud; i++) SMobj[i].display(); break; case 3: for(int i=0; i<No_of_stud; i++) SMobj[i].TotalMarks(); break; case 4:break; case 5:break; case 6:System.out.println("\nThanks for visting....."); System.exit(1); } } } catch(Exception e) { e.printStackTrace();} } }
SMobj cannot be resolved to a type
at StudentDatabase.main(StudentDatabase.java:45)
ligne 45 est:
SMobj[i] = new SMobj(i);
Partager