Java programming Basics Object-oriented practice

Source: Internet
Author: User

Recently Java opened an object-oriented curriculum, the teacher assigned the homework, ah, that is, what homework I don't how to describe, code as follows, do their own, code is very immature, please understand! That's about it:

classstudent{PrivateString Stuno; PrivateString name; Private floatMath; Private float中文版; Private floatcomputer; /*Student () {}*/     Public voidstuper (String stuno,string name) { This. Stuno =Stuno;  This. Name =name; }     Public voidStugrade (floatMathfloat中文版,floatcomputer) {         This. Math =Math;  This. 中文版 =中文版;  This. Computer =computer; }     Public voidcount () {floatAverage = (math + 中文版 + computer)/3; System.out.println ("Average score:" +average); floatsum = (Math + 中文版 +computer); System.out.println ("Total:" +sum); floatMax = 0; if(Math >中文版) {Max=Math; }        Else{Max=中文版; }        if(Max >computer) {System.out.println ("Highest score:" +max); }        Else{System.out.println ("Highest score:" +computer); }        floatMin = 0; if(Math >中文版) {min=中文版; }        Else{min=Math; }        if(Min >computer) {System.out.println ("Minimum score:" +computer); }        Else{System.out.println ("Minimum score:" +min); }    }     Public voidTell () {System.out.println ("Name:" + name + "study Number:" +Stuno); System.out.println ("Math Score:" + math + "English score:" + 中文版 + "Computer score:" +computer); }}classstuinfo{ Public Static voidMain (string[] args) {Student person=NewStudent (); Person. Stuper ("2015025500", "Zhang San"); Person.stugrade (50,60,70);        Person.tell ();    Person.count (); } }

The result of the program operation is:

Name: Zhang Sanxu No.: 2015025500
Math score: 50.0 English score: 60.0 Computer score: 70.0
Average score: 60.0
Total: 180.0
The highest score is: 70.0
Minimum score: 50.0

Java programming Basics Object-oriented practice

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.