Java語言程式設計(基礎篇)第十版 綜合題 **3.23(幾何: 點是否在矩形內?)
public class J3_24 {
public static void main(String[] args) {
// TODO Auto-generated method stub
java.util.Scanner input = new java.util.Scanner(System.in);
System.out.print("Enter a ponit with two coordinates");
double x = input.nextDouble();
double y = input.nextDouble();
if (x <= 5 && y <=2.5)
System.out.println("Point ("+x+","+y+") is in the rectangle");
else
System.out.println("Point ("+x+","+y+") isn't in the rectangle");
}
}
相關推薦
Java語言程式設計(基礎篇)第十版 綜合題 **3.23(幾何: 點是否在矩形內?)
public class J3_24 { public static void main(String[] args) { // TODO Auto-generated method stub java.util.Sc
Java語言程式設計(基礎篇)第十版 程式設計練習題3.3(代數: 求解2*2線性方程)
**編寫程式,提示使用者輸入a,b,c,e和f,然後顯示結果。 如果ad-bc=0,則方程式無解 應用Cramer規則求解線性方程組** public class linearEquation { public static void main(Stri
Java語言程式設計(基礎篇)第十版 程式設計練習題3.8 (對三個整數排序)
編寫程式,提示使用者輸入三個整數。以非降序(即升序)的形式排序顯示這三個整數。 由於第三章還沒有學迴圈和陣列,有迴圈和陣列即可用氣泡排序完成。所以在這用IF選擇語句方法編碼,若有更快捷的方法歡迎留言。 public class AscendingOrder
Java語言程式設計(基礎篇)第十版 程式設計練習題**3.10(遊戲:加法測驗)
import java.util.Random; public class AdditionGame { public static void main(String[] args) { // TODO Auto-generated
Java語言程式設計(基礎篇)第十版 程式設計練習題*3.11(給出一個月的總天數)
public class NumberOfDaysPerMonth { public static void main(String[] args) { // TODO Auto-generated method stub
Java語言程式設計(基礎篇)第十版 程式設計練習題**3.15(遊戲:彩票)
因為第三章還沒有陣列和迴圈,所以只能用IF語句和組合數的方法來判別使用者是否匹配到數字。 import java.util.Scanner; public class Lottery { public static void main(String[
Java語言程式設計(基礎篇)第十版 4.4
public class J4_4 { public static void main(String[] args) { // TODO Auto-generated method stub java.util.Scanner input = ne
Java語言程式設計(基礎篇)第十版 4.5
public class J4_5 { public static void main(String[] args) { // TODO Auto-generated method stub java.util.Scanner input = ne
Java語言程式設計(基礎篇)第十版 4.7
public class J4_7 { public static void main(String[] args) { // TODO Auto-generated method stub java.util.Scanner input = ne
Java語言程式設計(基礎篇)第十版 4.10
import java.util.Scanner; public class J4_10 { public static void main(String[] args) { String set1 = " 1 3 5
Java語言程式設計(基礎篇)第十版 4.11
public class J4_11 { public static void main(String[] args) { // TODO Auto-generated method stub java.util.Scanner input = n
Java語言程式設計(基礎篇)第十版 4.12
public class J4_12 { public static void main(String[] args) { // TODO Auto-generated method stub java.util.Scanner input = n
Java語言程式設計(基礎篇)第十版 4.13
public class J4_13 { public static void main(String[] args) { // TODO Auto-generated method stub java.util.Scanner input = n
Java語言程式設計(基礎篇)第十版 4.14
public class J4_14 { public static void main(String[] args) { // TODO Auto-generated method stub java.util.Scanner input = n
Java語言程式設計(基礎篇)第十版 4.15
public class J4_15 { public static void main(String[] args) { // TODO Auto-generated method stub java.util.Scanner input = n
Java語言程式設計(基礎篇)第十版 4.16 4.17
public class J4_16 { public static void main(String [] args) { int ch= (int)(Math.random()*25)+65; char ch1 = (char)ch; Sys
Java語言程式設計(基礎篇)第十版 4.18
public class J4_18 { public static void main(String[] args) { // TODO Auto-generated method stub java.util.Scanner input = n
Java語言程式設計(基礎篇)第十版 5.2
import java.util.Scanner; public class J5_2 { public static void main(String[] args) { // TODO Auto-generated method stub fi
Java語言程式設計(基礎篇)第十版 5.3 5.4
public class J5_3 { public static void main(String[] args) { // TODO Auto-generated method stub System.out.printf("%8s%8s\n"
Java語言程式設計(基礎篇)第十版 5.7
public class J5_7 { public static void main(String[] args) { // TODO Auto-generated method stub double tuitionFee = 10000;