ImportJava.util.Scanner; Public classTest { Public Static voidMain (string[] args) {//Create a Student objectStudent s =NewStudent (); //Create a student score objectStudentscore sc =NewStudentscore (); //receive student scores from the consoleScanner input =NewScanner (system.in); //prompting users to enter student scoresSystem.out.println ("Please enter three score"); //defining parameters for console inputS.java =Input.nextint (); S.sql=Input.nextint (); S.english=Input.nextint (); //Calling MethodsSystem.out.println ("The average student's score is:" +Sc.calcavg (s)); }}
Public class Student { // define a student class int Java; int SQL; int
Public class Studentscore { //public double calcavg (Student s1) { Double avg = 0; = (S1. Java + s1. SQL + s1. 中文版)/3.0; return avg; }}
JAVA input results from the keyboard average score and function calls