zoukankan      html  css  js  c++  java
  • java——第三天

     1 package day01;
     2 
     3 public class VarDemo {
     4 
     5     public static void main(String[] args) {
     6         // TODO Auto-generated method stub
     7         System.out.println("hello world!");
     8         int a;
     9         a=12;
    10         char myChar='A';
    11         System.out.println(myChar);
    12         
    13         byte myByte=127;
    14         System.out.println(myByte);
    15 
    16     }
    17 
    18 }

     1 package day01;
     2 import java.util.Scanner;
     3 
     4 public class ScoreLevel {
     5 
     6     public static void main(String[] args) {
     7         // TODO Auto-generated method stub
     8         Scanner scan=new Scanner(System.in);
     9         int score=scan.nextInt();
    10         if(score>=90) {
    11             System.out.println("A");
    12         }
    13         else if(score>=80) {
    14             System.out.println("B");
    15         }
    16         else {
    17             System.out.println("c");
    18         }
    19     }
    20 
    21 }

     1 package day01;
     2 import java.util.Scanner;
     3 public class Homework {
     4 
     5     public static void main(String[] args) {
     6         // TODO Auto-generated method stub
     7 //        int a=5;
     8 //        if(a>3) {
     9 //            int b=8;
    10 //            System.out.println(a);
    11 //            System.out.println(b);
    12 //        }
    13 //        System.out.println(a);
    14 //        System.out.println(b);
    15         Scanner sacn=new Scanner(System.in);
    16         System.out.println("please input your salary:");
    17         double salary=sacn.nextDouble();//输入您的工资
    18         double taxSalary=salary-5000;//计税工资
    19         double tax=0.0;//税率、
    20         if(taxSalary<=0) {
    21             tax=0.0;
    22         }else if (taxSalary<=3000) {
    23             tax=0.03;
    24         }
    25         
    26         
    27         System.out.println(salary+"-------------"+tax);
    28         
    29         
    30 
    31     }
    32 
    33 }
    View Code

     1 package day01;
     2 import java.util.Scanner;
     3 public class 猜测一个随机数 {
     4 
     5     public static void main(String[] args) {
     6         // TODO Auto-generated method stub
     7         Scanner scanner=new Scanner(System.in);
     8         int myRandom=(int)(Math.random()*10+1);
     9         System.out.println(myRandom);
    10 
    11     }
    12 
    13 }

     1 package day01;
     2 import java.util.Scanner;
     3 
     4 import javax.imageio.ImageTranscoder;
     5 public class 猜测一个随机数 {
     6 
     7     public static void main(String[] args) {
     8         // TODO Auto-generated method stub
     9 //        Scanner scanner=new Scanner(System.in);
    10 //        int myRandom=(int)(Math.random()*10+1);
    11 //        System.out.println(myRandom);
    12         
    13         
    14 //        long sum=0;
    15 //        for (int i=1;i<=10;i++) {
    16 //            sum=sum*10+9;
    17 //            System.out.println(sum);
    18 //        }
    19         
    20         
    21         for (int i=1;i<=5;i++) {
    22             System.out.println(1.0/i);
    23         }
    24         
    25     }
    26 
    27 }

     


     1 package day01;
     2 
     3 public class arraydemo {
     4 
     5     public static void main(String[] args) {
     6         // TODO Auto-generated method stub
     7         int[] arr=new int[100];
     8         for (int i=0;i<arr.length;i++) {
     9             arr[i]=i*2+5;
    10             //continue;
    11         }
    12         for(int j =0;j<arr.length;j++) {
    13             System.out.print(arr[j]);
    14         }
    15         System.out.println();
    16         for(int j =arr.length-1;j>=0;j--) {
    17             System.out.print(arr[j]);
    18         }
    19     }
    20 
    21 }

     1 package week1;
     2 import java.util.Arrays;
     3 public class MaxOfArray {
     4 
     5     public static void main(String[] args) {
     6         // TODO Auto-generated method stub
     7         int[] arr=new int[4];
     8 //        for(int i :arr) {
     9 //            System.out.println(i);
    10 //        }
    11         System.out.println(arr.length);
    12         arr=Arrays.copyOf(arr, arr.length+1);
    13         System.out.println(arr.length);
    14         
    15         
    16         long a=System.currentTimeMillis();
    17         Arrays.sort(arr);
    18         long b=System.currentTimeMillis();
    19         System.out.println(b-a);
    20 
    21     }
    22 
    23 }
  • 相关阅读:
    毕业设计(高校网上作业提交系统)开发记录(15)
    毕业设计(高校网上作业提交系统)开发记录(14)
    毕业设计(高校网上作业提交系统)开发记录(13)
    毕业设计(高校网上作业提交系统)开发记录(12)
    毕业设计(高校网上作业提交系统)开发记录(11)
    毕业设计(高校网上作业提交系统)开发记录(10)
    毕业设计(高校网上作业提交系统)开发记录(9)
    毕业设计(高校网上作业提交系统)开发记录(8)
    Java实现沙箱测试环境支付springboot
    Java面试宝典2019
  • 原文地址:https://www.cnblogs.com/Mengchangxin/p/10287056.html
Copyright © 2011-2022 走看看