import java.util.Scanner;
public class New01 {
public static void main(String[] args) {
New01 new01 = new New01();
System.out.println("请输入1个两位整数");
Scanner a = new Scanner(System.in);
int c= a.nextInt();
System.out.println("请z输入1个两位整数");
int d=a.nextInt();
System.out.println("请输入1个两位浮点数");
float e= a.nextFloat();
System.out.println("请z输入1个两位浮点数");
float f=a.nextFloat();
System.out.println(new01.intSum(c,d));
System.out.println(new01.floatSum(e,f));
}
public int intSum(int a,int b){
return a+b ;
}
public float floatSum(float c,float d){
return c+d ;
}
}
import java.util.Arrays;
public class New02 {
public void addScore(Student[] stu){
for (int i = 0; i <stu.length ; i++) {
if(stu[i].score<60){
stu[i].score+=5;
}
}
}
public static void main(String[] args) {
Student student1 = new Student("张三", 18, 59);
Student student2 = new Student("李四", 18, 40);
Student student3 = new Student("王五", 18, 100);
Student student4 = new Student("老六", 18, 80);
Student student5 = new Student("老八", 18, 0);
Student[] stu={student1,student2,student3,student4,student5};
New02 new02 = new New02();
new02.addScore(stu);
System.out.println(Arrays.toString(stu));
}
}
public class Student {
public String name;
public int age;
public int score;
public Student(String name,int age,int score){
this.name=name;
this.age=age;
this.score=score;
}
@Override
public String toString() {
return "Student{" +
"name='" + name + '\'' +
", age=" + age +
", score=" + score +
'}';
}
}