Web-android Engineer Beginner-5-5 Advanced Practice

Source: Internet
Author: User

Source: http://www.imooc.com/video/1628

New requirements:

Write Java program to receive three classes each four students of the Java results, and then calculate the average score of each class student

Tips:

Enter main plus Alt +/Enter, then enter

     Public Static void Main (string[] args) {            }

The source code is as follows:

1  PackageCom.imooc;2 ImportJava.util.Scanner;3 4 /*5 * Function: Realize the Java achievement of receiving four students from three classes, then calculate the average score of each class student6 * Knowledge points: Double circulation, outer loop control number of classes, Inner loop control number of students per class7  *8  */9  Public classDemo02 {Ten      Public Static voidMain (string[] args) { One         intclassnum=3;//Number of Classes A         intstunum=4;//Number of students -         Doublesum=0;//Total Score -         Doubleavg=0;//average score of scores theScanner input=NewScanner (system.in); -          -          for(intI=1; I <= classnum; i++) {//Outer Loop controls the number of classes -SYSTEM.OUT.PRINTLN ("* * * * Please enter the" +i+ "class Grades * * * *"); +Sum=0; -              for(intj=1;j<=stunum;j++) { +System.out.println ("Please enter" +j+ "Student's score:"); A                 intScore=input.nextint ();//get the input score atSum=sum+score;//Result summation -             } -AVG = Sum/stunum;//calculate the average score -System.out.println ("+i+" class student's average divided into: "+avg); -         } -  in     } -}

The results are as follows:

Please enter the 1th class score * ***The average of the 1th class students is divided into:82.75*** Please enter the grade of 2nd class * * *  The average of the 2nd class students is divided into:81.0*** Please enter the 3rd class score * * *88  98 The average of 3rd class students is divided into:81.75

Experience Summary:

1. Identify requirements through analysis

2. Organize relevant knowledge points

3. Carding the implementation process

4. Solve the problem with "breakpoint tracking"

Web-android Engineer Beginner-5-5 Advanced 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.