import java.util.Scanner; class Test4 { public static void main(String[] args) { Scanner s=new Scanner(System.in); System.out.println("身高:"); System.out.println("財富:"); System.out.println("帥否:"); int height=s.nextInt(); double money=s.nextDouble(); String str=s.next(); boolean m=str.equals("是");//輸入“帥否”的值和str.equals("是")的參數“是”作比較,相同,則返回真(true) if(height>=180&&money>=10.0&&m==true){ System.out.println("我一定要嫁給你!"); }else if(height>=180||money>=10.0||m==true){ System.out.println("嫁吧,比上不足,比下有餘。"); } else System.out.println("一定不會嫁給你!"); } }
輸入三個值,進行條件判斷
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.