1.Person
package ddd; import java.util.*; public class Person { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("请输入你的姓名:"); String name = sc.next(); System.out.println("请输入你的性别:"); String sex = sc.next(); System.out.println("请输入你的年龄:"); int age = sc.nextInt(); sc.nextLine(); System.out.println("请输入你的身份证号码::"); String idecart = sc.nextLine(); System.out.println("你的信息如下:"); System.out.println("姓名:"+name+" "+"性别:"+sex+" "+"年龄:"+age+" "+"身份证号码:"+idecart); } }
2.Phone
package ddd; import java.util.*; public class Phone { public static void main(String[] args) { for(int i=0;i<3;i++) { Scanner sc=new Scanner(System.in); System.out.println("请输入手机品牌:"); String Phonebrand=sc.nextLine(); System.out.println("请输入手机型号:"); String Phonetype=sc.nextLine(); System.out.println("手机品牌:"+Phonebrand+"手机型号:"+Phonetype); } } }
3.book
package ddd; import java.util.*; public class book { public static void main(String[] args) { Scanner sc=new Scanner(System.in); String name=sc.nextLine(); String num=sc.nextLine(); String editor=sc.nextLine(); String press=sc.nextLine(); String year=sc.nextLine(); String month=sc.nextLine(); String day=sc.nextLine(); String page=sc.nextLine(); String price=sc.nextLine(); System.out.println("书名:"+name+" "+"书号:"+num+" "+"编辑:"+editor); System.out.println("出版社:"+press+" "+"时间:"+year+"年"+month+"月"+day+"日"); System.out.println("页数:"+page+" "+"价格:"+price); } }
4.yuan
package ddd; import java.util.*; public class YUAN { public static void main(String[] args) { Scanner sc=new Scanner(System.in); double r=sc.nextDouble(); sc.hasNextLine(); double h=sc.nextDouble(); sc.hasNextLine(); double s,v; final double PAI=3.14; s=r*r*PAI; v=PAI*r*r*h; System.out.println("半径"+r+"高"+h+"底面积:"+s+"体积:"+v); } }