Design 10 students score information, the students have 3 courses, the calculation of the students total peace and evenly. Sort output

Source: Internet
Author: User


public class Grade {
Private double Chinese; Language achievement
private double math; Math Scores
Private double 中文版; English score

Public Grade (double Chinese, double math, double 中文版)//constructor
{
This.chinese= Chinese;
This.math = Math;
This.english = 中文版;
}

Public double Total () {//Calculated total
Return Chinese + math + 中文版;
}

public void Printtotal () {//Output total
System.out.println (Total ());
}

Public double average () {//Calculate average
return Total ()/3;
}

public void Printaverage () {//Output average
System.out.println (average ());
}
Public double Getchinese () {//Get language score
return Chinese;
}

public void Setchinese (double Chinese) {
This.chinese = Chinese;
}

Public double Getmath () {//Get math Score
return math;
}

public void Setmath (double math) {
This.math = Math;
}

Public double Getenglish () {//Get English Score
return 中文版;
}

public void Setenglish (double 中文版) {
This.english = 中文版;
}
}

Class Student {
String name; Student Name
Grade Grade; Results
Public Student (String name, Grade Grade) {
THIS.name = name;
This.grade = grade;
}

public static void Main (string[] args) {//main program call
Student s = new Student ("Cici", New Grade (89, 78, 98));
S.grade.printaverage ();
S.grade.printtotal ();
}
}

Design 10 students score information, the students have 3 courses, the calculation of the students total peace and evenly. Sort output

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.