fork download
  1. package project;
  2. import java.util.Scanner;
  3. public class Project
  4. {
  5. public String [] name = new String [100];
  6. public String [] name_course = new String [100];
  7. public String code,id;
  8. public int c,a,sumhour=0;
  9. public int [] hour = new int [100];
  10. public float score,sumpoints=0f;
  11. public float [] gpa = new float [100];
  12. public float [][]points=new float[100][100];
  13. public void Student()
  14. {
  15. Scanner s=new Scanner (System.in);
  16. Scanner d=new Scanner (System.in);
  17. System.out.println("enter a number of student");
  18. c=s.nextInt();
  19. for(int i=0;i<c;i++)
  20. {
  21. System.out.println("enter name of student "+(i+1));
  22. name[i]=d.nextLine();
  23. System.out.println("enter id of student "+(i+1));
  24. id=d.nextLine();
  25. }
  26. }
  27. public void Course()
  28. {
  29. Scanner s=new Scanner (System.in);
  30. System.out.println("enter a number of course for students");
  31. a=s.nextInt();
  32. for(int i=0;i<a;i++)
  33. {
  34. System.out.println("enter the name of course "+(i+1));
  35. name_course[i]=s.next();
  36. System.out.println("enter the code of course "+(i+1));
  37. code=s.next();
  38. System.out.println("enter the hour of course "+(i+1));
  39. hour[i]=s.nextInt();
  40. }
  41. for(int i=0;i<c;i++)
  42. {
  43. for(int j=0;j<a;j++)
  44. {
  45. System.out.println("enter the score of "+name[i]+" for course "+(j+1));
  46. score=s.nextFloat();
  47. if(score<45)
  48. points[i][j]=0f;
  49. else if(score>=45&&score<=49)
  50. points[i][j]=1.0f;
  51. else if(score>=50&&score<=54)
  52. points[i][j]=1.3f;
  53. else if(score>=55&&score<=59)
  54. points[i][j]=1.7f;
  55. else if(score>=60&&score<=64)
  56. points[i][j]=2.0f;
  57. else if(score>=65&&score<=69)
  58. points[i][j]=2.3f;
  59. else if(score>=70&&score<=74)
  60. points[i][j]=2.7f;
  61. else if(score>=75&&score<=79)
  62. points[i][j]=3.0f;
  63. else if(score>=80&&score<=84)
  64. points[i][j]=3.3f;
  65. else if(score>=85&&score<=89)
  66. points[i][j]=3.7f;
  67. else if (score>=90&&score<=100)
  68. points[i][j]=4.0f;
  69. else
  70. System.out.println("error");
  71. sumhour=sumhour+hour[j];
  72. sumpoints=sumpoints+(hour[j]*points[i][j]);
  73. }
  74. gpa[i]=sumpoints/sumhour;
  75. sumhour=0;
  76. sumpoints=0f;
  77. }
  78. }
  79. public void gpa()
  80. {
  81. for(int i=0;i<c;i++)
  82. {
  83. System.out.println("The Name "+name[i]);
  84. for(int j=0;j<a;j++)
  85. {
  86. System.out.println(name_course[j]+" "+points[i][j]);
  87. }
  88. System.out.println("the gpa of "+gpa[i]);
  89. }
  90.  
  91. }
  92. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:3: error: class Project is public, should be declared in a file named Project.java
public class Project
       ^
1 error
stdout
Standard output is empty