第二次过程性考核
Posted snjsnjsnj
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了第二次过程性考核相关的知识,希望对你有一定的参考价值。
https://gitee.com/snjsnjsnj/codes/fwpcmiqray17v4lsjed0331
1:
import java.util.Scanner;
class Student {
private String name;
private String sex;
private int age;
public Student() {
this.name = "tom";
this.sex = "male";
this.age = 15;
}
public void toString(String n, int a, String s) {
this.name = n;
this.sex = s;
this.age = a;
System.out.println("Student [name=‘" + this.name + "‘, sex=‘" + this.sex + "‘, age=" + this.age + "]");
}
}
public class Main {
public static void main(String[] args) {
Scanner reader = new Scanner(System.in);
String n = reader.next();
int a = reader.nextInt();
String s = reader.next();
Student ww = new Student();
ww.toString(n, a, s);
reader.close();
}
}
2:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int[] grade = new int[5];
for(int i=0; i<grade.length; i++){
grade[i] = in.nextInt();
}
RR rr = new RT(grade);
double dd = rr.mark();
System.out.printf("%.2f",dd);
}
}
abstract class RR{
int[] grade;
public RR(int[] grade){
this.grade = grade;
}
public abstract double mark();
}
class RT extends RR{
}
3:
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int height, width;
char status;
height = in.nextInt();
width = in.nextInt();
Board board = new Board(height, width);
status = board.getStatus();
System.out.print(status);
}
}
class Board{
int A, B;
public Board(int A, int B){
this.height = A;
this.width = B;
}
public char getStatus(){
if(A<=B){
return status(1);
}else{
return status(1.0);
}
}
public char status(double rate){
return "B";
}
public char status(int rate){
return "A";
}
}
4:
import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
double x1,x2,y1,y2,a,b,disance;
while(in.hasNextDouble()) {
x1=in.nextDouble();
x2=in.nextDouble();
y1=in.nextDouble();
y2=in.nextDouble();
a=x1-x2;
b=y1-y2;
disance=dis(a,b);
System.out.printf("%.2f",disance);
System.out.println();
}
}
public static double dis(double x,double y) {
double d;
d=Math.sqrt(x*x+y*y);
return d;
}
}
以上是关于第二次过程性考核的主要内容,如果未能解决你的问题,请参考以下文章