[procedure 11]
Title: there are four numbers: 1, 2, 3 and 4. How many three digits can be composed of different numbers without repetition? How many are they?
public class Test11 {
public static void main(String[] args) {
int count = 0;
for (int x = 1; x < 5; x++) {
for (int y = 1; y < 5; y++) {
for (int z = 1; z < 5; z++) {
if (x != y && y != z && x != z) {
count++;
System.out.print(x * 100 + y * 10 + z+" ");
}
}
}
}
System.out.println();
System.out.println("Share" + count + "Three digit numbers");
}
}
[procedure 12]
Title: the bonus paid by the enterprise is based on the profit commission. If the profit (I) is less than or equal to RMB 100000, the bonus can be increased by 10%; if the profit is higher than RMB 100000, the part lower than RMB 100000 will be increased by 10%; if the profit is higher than RMB 100000, the cocoa will be increased by 7.5%; if the profit is between RMB 200000 and RMB 400000, the part higher than RMB 200000 will be increased by 5%; if the profit is between RMB 400000 and RMB 600000, the part higher than RMB 400000 will be increased by 3%; if the profit is between RMB 600000 and RMB 1000000, the cocoa will be increased by 7.5%; if the profit is between RMB 200000 and RMB 400000, the part higher than RMB 600000 When it is higher than 1 million yuan, the part exceeding 1 million yuan will be charged 1%. Input the profit of the month from the keyboard, and calculate the total amount of bonus to be paid?
import java.util.Scanner;
public class Test12 {
@SuppressWarnings("resource")
public static void main(String[] args) {
double reward = 0;
Scanner sc = new Scanner(System.in);
System.out.print("Please enter the profit of the current month(Ten thousand yuan): ");
Double d = sc.nextDouble();
if(d > 0 && d <= 10) {
reward = d * 0.1;
}else if (d > 10 && d <= 20) {
reward = 10 * 0.1+(d-10)*0.075;
}else if (d > 20 && d <= 40) {
reward = 10 * 0.1+(20-10)*0.075+(d-20)*0.05;
}else if (d > 40 && d <= 60) {
reward = 10 * 0.1+(20-10)*0.075+(40-20)*0.05+(d-40)*0.03;
}else if (d > 60 && d <= 100) {
reward = 10 * 0.1+(20-10)*0.075+(40-20)*0.05+(60-40)*0.03+(d-60)*0.015;
}else if(d > 100){
reward = 10 * 0.1+(20-10)*0.075+(40-20)*0.05+(60-40)*0.03+(100-60)*0.15+(d-100)*0.01;
}
System.out.println("Total bonus payable:"+reward+"Ten thousand yuan");
}
}
[procedure 13]
Title: an integer, it is a complete square number after adding 100, plus 168 is a complete square number, what is the number?
public class Test13 {
public static void main(String[] args) {
for (int i = 0; i < 10000; i++) {
if (Math.sqrt(i+100)%1==0) {
if(Math.sqrt(i+168)%1==0) {
System.out.print(i+": Plus 100, it's a complete square, plus 168, it's a complete square");
}
}
}
}
}
[procedure 14]
Title: enter a day of a year, and judge the day as the day of the year?
import java.util.Scanner;
public class Test14 {
@SuppressWarnings({ "unused", "resource" })
public static void main(String[] args) {
long year, month, date;
int days = 0;
boolean flag = true;
Scanner sc = new Scanner(System.in);
do {
System.out.print("Please enter year:");
year = sc.nextLong();
System.out.print("Please enter month:");
month = sc.nextLong();
System.out.print("Please enter the day:");
date = sc.nextLong();
if (year < 0 || month < 0 || month > 12 || date < 0 || date > 31) {
System.out.println("Wrong input, please input again");
flag = false;
}
} while (false);
for (int i = 0; i < month; i++) {
switch (i) {
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
days = 31;
break;
case 4:
case 6:
case 9:
case 11:
days = 30;
break;
case 2:
if ((year % 400 == 0) || (year % 4 == 0 && year % 100 != 0)) {
days = 29;
}else{
days = 28;
}
break;
}
date = days+date;
}
System.out.println(year + "-" + month + "-" + days + "It's the first of the year" + (date+days) + "God.");
}
}
[procedure 15]
Title: input three integers x,y,z. please output these three numbers from small to large.
import java.util.Scanner;
public class Test15 {
@SuppressWarnings("resource")
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Please enter three integers:");
String st = sc.nextLine();
String[] s = st.split(" ");
int x = 0, y = 0, z = 0, temp = 0;
for (int i = 0; i < s.length; i++) {
x = Integer.parseInt(s[0]);
y = Integer.parseInt(s[1]);
z = Integer.parseInt(s[2]);
if (x > y) {
temp = x;
x = y;
y = temp;
}
if (x > z) {
temp = x;
x = z;
z = temp;
}
if (y > z) {
temp = y;
y = z;
z = temp;
}
}
System.out.println("The output of three numbers from small to large is as follows:"+x+" "+y+" "+z);
}
}