码迷,mamicode.com
首页 > 其他好文 > 详细

第二次过程性考核

时间:2018-10-14 20:59:10      阅读:123      评论:0      收藏:0      [点我收藏+]

标签:sys   tps   static   class   keyword   student   can   ext   boa   

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;
  
}
 
}
 

第二次过程性考核

标签:sys   tps   static   class   keyword   student   can   ext   boa   

原文地址:https://www.cnblogs.com/snjsnjsnj/p/9787315.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!