⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 partb_result.java

📁 实现学生成绩的管理系统
💻 JAVA
字号:
import java.io.*;
public class PartB_result {
    
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		
		student_Account[] student = new student_Account[5];
	    student[0]=new student_Account("Jack Smith",89,70,60,74,80);
		student[1]=new student_Account("Jim Lucas",70,65,90,78,90);
		student[2]=new student_Account("Beck Barber",56,70,63,45,60);
		student[3]=new student_Account("Ann Walker",87,83,56,73,70);
		student[4]=new student_Account("Lucy Boxer",65,78,79,85,80);
		course_Account[] course=new course_Account[5];
		course[0]=new course_Account("Maths",89,70,56,87,65);
		course[1]=new course_Account("Business",70,65,70,83,78);
		course[2]=new course_Account("Java",60,90,63,56,79);
		course[3]=new course_Account("Design",74,78,45,73,85);
		course[4]=new course_Account("Project",80,90,60,70,80);
		
		int choice=-1;    
	      do
	      {
	    	  System.out.println(); 
				System.out.println("##########################");  
				System.out.println("Java student result system"); 
				System.out.println("Please select your choice");  
				System.out.println("##########################\n");

				System.out.print("1 Dispaly student result(select a student)\n");
				System.out.print("2 Dispaly course result(select a course)\n");
				System.out.print("3 Modify student result\n");
				System.out.print("4 Output the whole result\n");
				System.out.print("Please select your choice:\n");
			
				BufferedReader stdin = new BufferedReader  
			      (new InputStreamReader(System.in));
			    String inputLine = stdin.readLine();  
			
			    choice= Integer.valueOf(inputLine).intValue();        
	            switch (choice)
	           {
	            case 1:
	            	System.out.print("Please select a student"); 
	       		    BufferedReader in1 = new BufferedReader
	       			  (new InputStreamReader(System.in)); 
	       		    String inputName = in1.readLine();
	       		    for (int i=0;i<5;i++){
	       			  if (inputName.equals((student[i]).getstudent_name())){
	       				System.out.println(inputName);
	       				student[i].getresult();
	       				student[i].getgrade();
	       				
	       			  }
	                
	       		    }
	       		 break;
	             case 2:
	            	System.out.print("Please select a course:"); 
	        		BufferedReader in2 = new BufferedReader
	        		   (new InputStreamReader(System.in)); 
	                String inputCourse = in2.readLine();
	                for (int i=0;i<5;i++){
	                	if (inputCourse.equals((course[i]).getcourse_name())){
		       				System.out.println(inputCourse);
		       				course[i].getcourse_result();
		       			System.out.println("The average mark is:"+course[i].getaverage());
		       			System.out.println("The highest mark is:"+course[i].gethighest());
		       			System.out.println("The lowest mark is:"+course[i].getlowest());
	                }
	                
	                }
	             break; 
	                
	             case 3:
	                System.out.print("Please select a student:");
	     	    	BufferedReader in11 = new BufferedReader
	     			   (new InputStreamReader(System.in)); 
	                
	     	    	String modify_student = in11.readLine();
	     	    	
	                System.out.print("Please select a course:"); 
	     			BufferedReader in21 = new BufferedReader
	     			   (new InputStreamReader(System.in)); 
	                
	     			String modify_course = in21.readLine();
	     			for (int i=0;i<5;i++){
	     				for (int j=0;j<5;j++){	     					
	     				if(modify_student.equals(student[i].getstudent_name())
	     						& modify_course.equals(course[j].getcourse_name())){
	     					System.out.println(course[j].getmodify_course());
	     				}
	     			}
	     		}
	               
	             break;
	             case 4:
	            	 for(int i=0;i<5;i++){
	            		System.out.printf("%13s",student[i].getstudent_name());		            			            		
	            	 }
	            	 System.out.println();
	            	 for(int j=0;j<5;j++){
		            		System.out.printf("%4s",course[j].getcourse_name());
		            		System.out.println();
		            	 }
	            	 for(int i=0;i<5;i++){
	            	    student[i].getdisplay_result();
	            	 }
	            	 System.out.println();
	            	 System.out.print("course_average");
	            	 for(int k=0;k<5;k++){	            		
	            		 System.out.printf("%13s",course[k].getaverage());	            		 
	            	 }
	            	 System.out.println();
	            	 System.out.print("student_average");
	            	 for(int m=0;m<5;m++){
	            		 System.out.printf("%13s",student[m].getaverage());            		 
	              	 }
	            	 System.out.println();
	            	 for (int l=0;l<5;l++){
	            		 int high_average=student[0].getaverage();
	            		 if (student[l].getaverage()>high_average){
	            			 high_average=student[l].getaverage();
	            		 
	            		 System.out.println("The student name with highest average mark is :"+student[l].getstudent_name());
	            		 }
                     }	            	 	            	 	            	               
	             break;              
	             default:
	               System.out.println("Error:Invalid option!");
	               System.out.print("Please select your choice again:\n");
	         }        
	         System.out.println();
	      } while (choice != 0);     
	      System.out.println("Program Ending!");
	      System.out.println();
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -