package jwl.sheshizhuanhuashi; //包名
public class Ticket { //类名 public static void main(String[] args) { //主方法 double height = 1.2; System.out.println("身高1米的孩子应该购票吗?" + (height<1)); System.out.println("身高1.5米的孩子应该购票吗?" + (height<1.5)); }}//定义的比较值出错了,刚开始定义的1.2,导致全是false,应该需要购票的要比height小,结果是false//不需要的要比height大,结果是true
package jwl.sheshizhuanhuashi; //创建包名
public class StoragehAndBulk { //类名
public static void main (String[]args) { //主方法 int d = 10; int height = 3; System.out.println("求圆柱形粮仓的体积?" ); System.out.println("如果每立方米屯粮750kg,那么一共可以囤多少千克的粮食?"); double bulk = d * 3.14 * height; double Storage = bulk * 750; System.out.println("圆柱形粮仓的体积为" + bulk); System.out.println("一共可以屯粮" + Storage); }}
package jwl.sheshizhuanhuashi; //创建包名
public class Huashidu { //创建类名 public static void main(String[] args) { //主方法忘记创建了 int degree = 37; double Fahrenheit = degree * 1.8 + 32; int intFahrenheit = (int )Fahrenheit; System.out.println ("37摄氏度等于" + intFahrenheit + "华氏度");}}
package jwl.sheshizhuanhuashi;
import java.util.Scanner;public class Good { public static void main (String[]args) { Scanner A = new Scanner(System.in); System.out.println("请输入学生的成绩。"); int S = A.nextInt(); if (S >= 90) { System.out.println("该同学成绩优秀。"); }else if(S >= 80 && S < 90) { System.out.println("该同学成绩良好。"); }else if(S >= 60 && S < 80) { System.out.println("该同学成绩合格。"); }else { System.out.println("该同学成绩不合格。"); } A.close(); }}
package jwl.sheshizhuanhuashi;
public class Count {
public static void main(String [] arge) { int a = 12; //第一代菌落数量 int count = 1; //第一代 int num = 0; while(count <= 10) { num = num + a*2; count++; } System.out.println("第十代菌落的个数是" + num);} }
package jwl.sheshizhuanhuashi;
public class ArithmeticOerator {
public static void main(String[]args) { System.out.println("计算轿车的平均加速度"); double V0 = 0; double V = 100; double T = 8.7; double A = (V-V0)/T; System.out.println("轿车的平均加速度是" + A + "千米每小时"); }}