java优化的源代码 java优化代码常见套路

求JAVA源代码

import java.util.ArrayList;

创新互联长期为超过千家客户提供的网站建设服务,团队从业经验10年,关注不同地域、不同群体,并针对不同对象提供差异化的产品和服务;打造开放共赢平台,与合作伙伴共同营造健康的互联网生态环境。为如东企业提供专业的网站制作、成都网站建设,如东网站改版等技术服务。拥有十余年丰富建站经验和众多成功案例,为您定制开发。

import java.util.List;

import java.util.Scanner;

public class GradeStatistic {

public static void main(String[] args) {

GradeStatistic gs = new GradeStatistic();

ListMark list = new ArrayListMark();

float sum = 0;

while(true){

Scanner sc = new Scanner(System.in);

System.out.print("Please input student name: ");

String name = sc.nextLine();

if(name.equals("备差end")){

break;

}

System.out.print("Please input student score: ");

float score = sc.nextFloat();

sum += score;

list.add(gs.new Mark(name, score));

}

float max = list.get(0).getScore();

float min = list.get(0).getScore();

for(Mark mark: list){

if(max mark.getScore()){

max = mark.getScore();

}

if(min mark.getScore()){

min = mark.getScore();

}

}

float average = sum / list.size();

System.out.println("好瞎Average is: " + average);

System.out.println("Max is: " + max);

System.out.println("Min is: "仿袜皮 + min);

}

private class Mark{

private String name;

private float score;

public Mark(String name, float score){

this.name = name;

this.score = score;

}

public String getName() {

return name;

}

public float getScore() {

return score;

}

}

}

----------------------

Please input student name: Zhang san

Please input student score: 100

Please input student name: Li Si

Please input student score: 91

Please input student name: Ec

Please input student score: 35

Please input student name: ma qi

Please input student score: 67

Please input student name: end

Average is: 73.25

Max is: 100.0

Min is: 35.0


当前标题:java优化的源代码 java优化代码常见套路
标题网址:http://lszwz.com/article/dcpedpg.html

其他资讯

售后响应及时

7×24小时客服热线

数据备份

更安全、更高效、更稳定

价格公道精准

项目经理精准报价不弄虚作假

合作无风险

重合同讲信誉,无效全额退款