fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.io.BufferedReader;
  4.  
  5. /* Name of the class has to be "Main" only if the class is public. */
  6. class Ideone
  7. {
  8. public static void main (String[] args) throws IOException
  9. {
  10.  
  11. int tensu[] = new int[5];
  12.  
  13. String[] kyoka = {"英語","数学","化学","物理","歴史"};
  14.  
  15. String highkamoku = kyoka[0];
  16. int highscore = tensu[0];
  17. String lowkamoku = kyoka[0];
  18. int lowscore = 100;
  19.  
  20. double sum =0;
  21. double ave =0;
  22.  
  23. for(int i=0; i<5; i++) {
  24. System.out.print(kyoka[i] + "の得点を入力してください=>");
  25.  
  26. String str = br.readLine();
  27. int num = Integer.parseInt(str);
  28.  
  29. tensu[i] = num;
  30.  
  31. if(highscore<tensu[i]) {
  32. highkamoku = kyoka[i];
  33. highscore = tensu[i];
  34. }
  35. else if(lowscore>tensu[i]) {
  36. lowkamoku = kyoka[i];
  37. lowscore = tensu[i];
  38. }
  39.  
  40. sum += num;
  41. ave = sum/5;
  42.  
  43. }
  44.  
  45. for(int i=0; i<5; i++) {
  46. Arrays.sort(tensu);
  47. System.out.println(kyoka[i] + "の得点は" + tensu[i] + "点です");
  48. }
  49.  
  50. System.out.println("-->最高点の科目は:" + highkamoku + "で" + highscore + "点です");
  51. System.out.println("-->最低点の科目は:" + lowkamoku + "で" + lowscore + "点です");
  52.  
  53. System.out.println("平均点は" + ave + "点でした");
  54.  
  55. }
  56. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:8: error: cannot find symbol
	public static void main (String[] args) throws IOException
	                                               ^
  symbol:   class IOException
  location: class Ideone
Main.java:10: error: cannot find symbol
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		                                           ^
  symbol:   class InputStreamReader
  location: class Ideone
Main.java:47: error: cannot find symbol
			Arrays.sort(tensu);
			^
  symbol:   variable Arrays
  location: class Ideone
3 errors
stdout
Standard output is empty