1. Move the chair
package com.bdqn.demo;
import java.util.Scanner;
public abstract class Name {
public static void main(String[] args) {
Scanner input = new Scanner (System.in);
System.out.println("Please enter age: ");
int age = input.nextInt();
System.out.println("Please enter gender: ");
String sex = input.next();
if((age>=7)||(age>=5&&sex.equals("male"))){ //Use the if structure to judge
System.out.println("Can move the table");
}else {System.out.println("Cannot move the table");}
}
}
2, digital output arrangement
package com.baqn.demo; import java.util. *; public class Shu { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Please enter 3 integers: "); int a = input.nextInt(); int b = input.nextInt(); int c = input.nextInt(); if (a < b && a < c) { if (b < c) { System.out.print(a + "," + b + "," + c); } else { System.out.print(a + "," + c + "," + b); } } else if (b < a && b < c) { if (a < c) { System.out.println(b + "," + a + "," + c); } else { System.out.print(b + "," + c + "," + a); } } else { if (a < b) { System.out.print(c + "," + a + "," + b); } else { System.out.print(c + "," + b + "," + a); } } } }3. Divide by
package com.bdqn.demo; import java.util. *; public class Shu { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Please enter your integer: "); int Num = input.nextInt(); if (Num % 3 == 0 && Num % 5 == 0) { System.out.println("The integer is a multiple of 3 or 5"); } else { System.out.println("The integer is not divisible by either 3 or 5"); } } }4. Rewards
package com.bdqn.demo; import java.util.Scanner; public class Score { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Please enter Xiaoming's test score: "); int score = input.nextInt(); if(score==100) { System.out.println("Buy you a car"); }else if(score>=90) { System.out.println("Buy you mp4"); }else if(score>=60) { System.out.println("Buy you this reference book"); }else { System.out.println("Nothing!"); } } }4,, book a flight ticket
package com.bdqn.demo; import java.util.Scanner; public class Plane { public static void main(String[] args) { Scanner input = new Scanner(System.in); double money = 5000.0D; System.out.println("Please enter the month you travel: "); int yue = input.nextInt(); System.out.println("Please choose first class or economy: first class choose 1, economy choose 2"); int choose = input.nextInt(); if ((yue > 3) && (yue < 11)) { if (choose == 1) { money *= 0.9D; } else if (choose == 2) money *= 0.8D; } else { if (choose == 1) money *= 0.5D; if (choose == 2) { money *= 0.4D; } } System.out.println("Your ticket price is: " + money); } }