java語言程式設計基礎篇樑勇著第十版第一章課後習題答案
阿新 • • 發佈:2019-01-05
第一章大黑書課後題答案
樓主後續還會陸續把其他章答案發上去,喜歡的關注樓主一下
public class Exercise01_01 {
public static void main(String[] args) {
System.out.println("Welcome to Java");
System.out.println("Welcome to Computer Science");
System.out.println("Programming is fun");
}
}
public class Exercise01_02 { public static void main(String[] args) { System.out.println("Welcome to Java"); System.out.println("Welcome to Java"); System.out.println("Welcome to Java"); System.out.println("Welcome to Java"); System.out.println("Welcome to Java"); } }
public class Exercise01_03 { public static void main(String[] args) { System.out.println(" J A V V A "); System.out.println(" J A A V V A A "); System.out.println("J J AAAAA V V AAAAA "); System.out.println(" J J A A V A A "); } }
public class Exercise01_04 { public static void main(String[] args) { System.out.println("a a^2 a^3"); System.out.println("1 1 1"); System.out.println("2 4 8"); System.out.println("3 9 27"); System.out.println("4 16 64"); } }
public class Exercise01_05 {
public static void main(String[] args) {
System.out.println((9.5 * 4.5 - 2.5 * 3) / (45.5 - 3.5));
}
}
public class Exercise01_06 {
public static void main(String[] args) {
System.out.println(1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9);
}
}
public class Exercise01_07 {
public static void main(String[] args) {
System.out.println(4 * (1 - 1.0 / 3 + 1.0 / 5 - 1.0 / 7 +
1.0 / 9 - 1.0 / 11 + 1.0 / 13));
}
}
public class Exercise01_08 {
public static void main(String[] args) {
// Display area
System.out.println(5.5 * 5.5 * 3.14159);
// Display perimeter
System.out.println(2 * 5.5 * 3.14159);
}
}
public class Exercise01_09 {
public static void main(String[] args) {
// Display area
System.out.println(4.5 * 7.9);
// Display perimeter
System.out.println(2 * (4.5 + 7.9));
}
}
//來源蕪湖大司馬
public class Exercise01_10 {
public static void main(String[] args) {
System.out.println((14 / 45.5) * 60 / 1.6);
}
}
public class Exercise01_11 {
public static void main(String[] args) {
System.out.println(312032486 + 365 * 24 * 60 * 60 / 7.0 - 365 * 24 * 60 * 60 / 13.0 + 365 * 24 * 60 * 60 / 45.0);
System.out.println(312032486 + 2 * 365 * 24 * 60 * 60 / 7.0 - 2 * 365 * 24 * 60 * 60 / 13.0 + 2 * 365 * 24 * 60 * 60 / 45.0);
System.out.println(312032486 + 3 * 365 * 24 * 60 * 60 / 7.0 - 3 * 365 * 24 * 60 * 60 / 13.0 + 3 * 365 * 24 * 60 * 60 / 45.0);
System.out.println(312032486 + 4 * 365 * 24 * 60 * 60 / 7.0 - 4 * 365 * 24 * 60 * 60 / 13.0 + 4 * 365 * 24 * 60 * 60 / 45.0);
System.out.println(312032486 + 5 * 365 * 24 * 60 * 60 / 7.0 - 5 * 365 * 24 * 60 * 60 / 13.0 + 5 * 365 * 24 * 60 * 60 / 45.0);
}
}
public class Exercise01_12 {
public static void main(String[] args) {
System.out.println(24 / (1 + (40 + 35.0 / 60) / 60) * 1.6);
}
}
public class Exercise01_13 {
public static void main(String[] args) {
System.out.println("x is ");
System.out.println((44.5 * 0.55 - 50.2 * 5.9) /
(3.4 * 0.55 - 50.2 * 2.1));
System.out.println("y is ");
System.out.println((3.4 * 5.9 - 44.5 * 2.1) /
(3.4 * 0.55 - 50.2 * 2.1));
}
}