课后习题记录(持续更新)"/>
Java语言程序设计 基础版 第十版 个人学习课后习题记录(持续更新)
具体内容
Java语言程序设计 基础版 第十版 个人学习课后习题记录(持续更新)
目录
具体内容
第一章
第二章
第三章
第一章
1.1
public class Q1_1 {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");}
}
1.2
public class Q1_2 {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");}
}
1.3
public class Q1_3 {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");}
}
1.4
public class Q1_4 {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");}
}
1.5
public class Q1_5 {public static void main(String[] args) {System.out.println(((9.5*4.5)-(2.5*3)/(45.5-3.5)));}
}
1.6
public class Q1_6 {public static void main(String[] args) {System.out.println(1+2+3+4+5+6+7+8+9);}
}
1.7
public class Q1_7 {public static void main(String[] args) {System.out.println(4*(1.0-1.0/3+1.0/5-1.0/7+1.0/9-1.0/11));System.out.println(4*(1.0-1.0/3+1.0/5-1.0/7+1.0/9-1.0/11+1.0/13));}
}
1.8
public class Q1_8 {public static void main(String[] args) {System.out.println("周长 = " + (2*5.5*3.14));System.out.println("面积 = " + (5.5*5.5*3.14));}
}
1.9
public class Q1_9 {public static void main(String[] args) {System.out.println("周长 = " + (4.5*2+7.9*2));System.out.println("面积 = " + (4.5*7.9));}
}
1.10
public class Q1_10 {public static void main(String[] args) {System.out.println("平均速度为" + ((14.0/1.6)/(45.0/60+((30.0/60)/60))) + ("英里/小时"));}
}
1.11
public class Q1_11 {public static void main(String[] args) {System.out.println("未来一年人口数为:" + (312032486 + (1*365*24*60*60/7) - (1*365*24*60*60/13) + (1*365*24*60*60/45)));System.out.println("未来二年人口数为:" + (312032486 + (2*365*24*60*60/7) - (2*365*24*60*60/13) + (2*365*24*60*60/45)));System.out.println("未来三年人口数为:" + (312032486 + (3*365*24*60*60/7) - (3*365*24*60*60/13) + (3*365*24*60*60/45)));System.out.println("未来四年人口数为:" + (312032486 + (4*365*24*60*60/7) - (4*365*24*60*60/13) + (4*365*24*60*60/45)));System.out.println("未来五年人口数为:" + (312032486 + (5*365*24*60*60/7) - (5*365*24*60*60/13) + (5*365*24*60*60/45)));}
}
1.12
public class Q1_12 {public static void main(String[] args) {System.out.println("平均速度为:" + ((24*1.6)/(1.0+40.0/60+35.0/60/60)) + "km/h");}
}
1.13
public class Q1_13 {public static void main(String[] args) {System.out.println("x = " + ((44.5*0.55-50.2*5.9)/(3.4*0.55-50.2*2.1)));System.out.println("y = " + ((3.4*5.9-44.5*2.1)/(3.5*0.55-50.2*2.1)));}
}
第二章
2.1
import java.util.Scanner;public class Q2_1 {public static void main(String[] args) {Scanner input = new Scanner(System.in);System.out.println("Please enter a degree in Celsius: ");double celsius = input.nextDouble();double fahrenheit = (9.0 / 5) * celsius + 32;System.out.println(celsius + " Celsius is " + fahrenheit + " Fahrenheit.");}
}
2.2
import java.util.Scanner;public class Q2_2 {public static void main(String[] args) {double p = 3.14159;Scanner input = new Scanner(System.in);System.out.println("Please enter the radius an length of a cylinder: ");double radius = input.nextDouble();double cylinder = input.nextDouble();double area = radius * radius * p;double volume = area * cylinder;System.out.println("The area is " + area);System.out.println("The volume is " + volume);}
}
2.3
import java.util.Scanner;public class Q2_3 {public static void main(String[] args) {Scanner input = new Scanner(System.in);System.out.println("Please enter a value for feet: ");double feet = input.nextDouble();double meter = feet * 0.305;System.out.println(feet + " feet is " + meter + " meters");}
}
2.4
import java.util.Scanner;public class Q2_4 {public static void main(String[] args) {Scanner input = new Scanner(System.in);System.out.println("Please enter a number in pounds: ");double pounds = input.nextDouble();double kilograms = pounds * 0.454;System.out.println(pounds + " pounds is " + kilograms + " kilograms.");}}
2.5
import java.util.Scanner;public class Q2_5 {public static void main(String[] args) {Scanner input = new Scanner(System.in);System.out.println("Please enter the subtotal and a gratuity rate: ");double fee = input.nextDouble();double gratuity = fee * 15 / 100;double total = fee + gratuity;System.out.println("The gratuity is $" + gratuity + " and total is $" + total);}
}
2.6
import java.util.Scanner;public class Q2_6 {public static void main(String[] args) {Scanner input = new Scanner(System.in);System.out.println("Please enter a number between 0 and 1000: ");int num0 = input.nextInt();int num1 = num0 % 10;int num2 = (num0 / 10) % 10;int num3 = (num0 / 100) % 10;int total = num1 + num2 + num3;System.out.println("The sum of the digits is " + total);}
}
2.7
import java.util.Scanner;public class Q2_7 {public static void main(String[] args) {Scanner input = new Scanner(System.in);System.out.println("Please enter the number of minutes: ");int minutes = input.nextInt();int day = minutes / 60 / 24;int year = day / 365;day = day % 365;System.out.println(minutes + " minutes is approximately " +year + " years and " + day + "days.");}
}
2.8
import java.util.Scanner;public class Q2_8 {public static void main(String[] args) {Scanner input = new Scanner(System.in);System.out.println("Please enter the time zone offset to GMT: ");int timeZone = input.nextInt();long totalMillisceonds = System.currentTimeMillis();//获取GMT到当前时间毫秒数long totalSeconds = totalMillisceonds / 1000;//获取GMT到当前时间秒数long currentMilliseconds = totalMillisceonds % 1000;long totalMinutes = totalSeconds / 60;long currentSeconds = totalSeconds % 60;long totalHour = totalMinutes / 60;long currentMinutes = totalMinutes % 60;long currentHour = (totalHour + timeZone) % 24;System.out.println("The current time is " + currentHour + " : " +currentMinutes + " : " + currentSeconds + " : " +currentMilliseconds);}
}
2.9
import java.util.Scanner;public class Q2_9 {public static void main(String[] args) {Scanner input = new Scanner(System.in);System.out.println("Please enter v0, v1, and t: ");double v0 = input.nextDouble();double v1 = input.nextDouble();double t = input.nextDouble();double averageAcceleration = (v1 - v0) / t;System.out.println("The average acceleration is " + averageAcceleration);}
}
2.10
import java.util.Scanner;public class Q2_10 {public static void main(String[] args) {Scanner input = new Scanner(System.in);System.out.println("Please enter amount of water in kilograms: ");double weight = input.nextDouble();System.out.println("Please enter the initial temperature: ");double initialTemperature = input.nextDouble();System.out.println("Please enter the final temperature: ");double finalTemperature = input.nextDouble();double energy = weight * (finalTemperature - initialTemperature) * 4184;System.out.println("The energy needed is " + (float)energy);}
}
2.11
import java.util.Scanner;public class Q2_11 {public static void main(String[] args) {Scanner input = new Scanner(System.in);System.out.println("Please enter the number of years: ");int year = input.nextInt();int population = 312032486 + (year*365*24*60*60/7) - (year*365*24*60*60/13) + (year *365*24*60*60/45);System.out.println("The population in " + year + " is " + population);}
}
2.12
import java.util.Scanner;public class Q2_12 {public static void main(String[] args) {Scanner input = new Scanner(System.in);System.out.println("Please enter speed and acceleration: ");double speed = input.nextDouble();double acceleration = input.nextDouble();double length = speed * speed / (2 * acceleration);System.out.println("The minimum runway length is " + length + "m.");}
}
2.13
import java.util.Scanner;public class Q2_13 {public static void main(String[] args) {Scanner input = new Scanner(System.in);System.out.println("Please enter the monthly saving amount: ");double amount = input.nextDouble();double accountValueAfter1Month = amount * (1 + 0.00417);double accountValueAfter2Month = (amount + accountValueAfter1Month) * (1 + 0.00417);double accountValueAfter3Month = (amount + accountValueAfter2Month) * (1 + 0.00417);double accountValueAfter4Month = (amount + accountValueAfter3Month) * (1 + 0.00417);double accountValueAfter5Month = (amount + accountValueAfter4Month) * (1 + 0.00417);double accountValueAfter6Month = (amount + accountValueAfter5Month) * (1 + 0.00417);System.out.println("After the sixth month, the account value is $" + accountValueAfter6Month);}
}
2.14
import java.util.Scanner;public class Q2_14 {public static void main(String[] args) {Scanner input = new Scanner(System.in);System.out.println("Please enter weight in pounds: ");double weightInPounds = input.nextDouble();System.out.println("Please enter height in inches: ");double heightInInches = input.nextDouble();double weightInKilometers = weightInPounds * 0.45359237;double heightInMeters = heightInInches * 0.0254;double BMI = weightInKilometers / (heightInMeters * heightInMeters);System.out.println("BMI is " + BMI);}
}
2.15
import java.util.Scanner;public class Q2_15 {public static void main(String[] args) {Scanner input = new Scanner(System.in);System.out.println("Please enter x1 and y1: ");double x1 = input.nextDouble();double y1 = input.nextDouble();System.out.println("Please enter x2 and y2: ");double x2 = input.nextDouble();double y2 = input.nextDouble();double distance = Math.pow(((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)),0.5);System.out.println("The distance between the two points is " + distance);}
}
2.16
import java.util.Scanner;public class Q2_16 {public static void main(String[] args) {Scanner input = new Scanner(System.in);System.out.println("Please enter the side: ");double side = input.nextDouble();double area;area = (3 * Math.pow(3,0.5) /2) * (side * side);System.out.println("The area of the hexagon is " + area);}
}
2.17
import java.util.Scanner;public class Q2_17 {public static void main(String[] args) {Scanner input = new Scanner(System.in);System.out.println("Please enter the temperature in Fahrenheit between -58℉ and 41℉: ");double temperature = input.nextDouble();System.out.println("Please enter the wind speed(>=2) in miles per hour: ");double windSpeed = input.nextDouble();double windChillIndex;windChillIndex = 35.74 + 0.6215 * temperature - 35.75 *Math.pow(windSpeed,0.16) + 0.4275 * temperature * Math.pow(windSpeed,0.16);System.out.println("The wind chill index is " + windChillIndex);}
}
2.18
public class Q2_18 {public static void main(String[] args) {System.out.println("a b pow(a,b)");System.out.println("1 2 " + (int)Math.pow(1,2));System.out.println("2 3 " + (int)Math.pow(2,3));System.out.println("3 4 " + (int)Math.pow(3,4));System.out.println("4 5 " + (int)Math.pow(4,5));System.out.println("5 6 " + (int)Math.pow(5,6));}
}
2.19
import java.util.Scanner;public class Q2_19 {public static void main(String[] args) {Scanner input = new Scanner(System.in);System.out.println("Please enter three points for a triangle: ");double x1 = input.nextDouble();double y1 = input.nextDouble();double x2 = input.nextDouble();double y2 = input.nextDouble();double x3 = input.nextDouble();double y3 = input.nextDouble();double s1, s2, s3, s, area;s1 = Math.pow(((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)),0.5);s2 = Math.pow(((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1)),0.5);s3 = Math.pow(((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2)),0.5);s = (s1 + s2 + s3) / 2;area = Math.pow(s * (s - s1) * (s - s2) * (s - s3),0.5);System.out.println("The area of the triangle is " + area);}
}
2.20
import java.util.Scanner;public class Q2_20 {public static void main(String[] args) {Scanner input = new Scanner(System.in);System.out.println("Please enter balance and interest rate (e.g., 3 for 3%): ");double balance = input.nextDouble();double rate = input.nextDouble();double interest;interest = balance * (rate / 1200);System.out.println("The interest is " + interest);}
}
2.21
import java.util.Scanner;public class Q2_21 {public static void main(String[] args) {Scanner input = new Scanner(System.in);System.out.println("Please enter investment amount: ");double investmentAmount = input.nextDouble();System.out.println("Please enter annual interest rate in percentage: ");double annualInterestRate = input.nextDouble();System.out.println("Please enter number of years: ");double years = input.nextDouble();double accumulatedValue = investmentAmount * (1 + 1.0 * Math.pow(annualInterestRate/100,years));System.out.println("Accumulated value is $" + accumulatedValue);}
}
2.22
import java.util.Scanner;public class Q2_22 {public static void main(String[] args) {Scanner input = new Scanner(System.in);System.out.println("Please enter an amount in int, for example 1156 means $11.56: ");int amount = input.nextInt();int remainingAmount = amount;int numberOfOneDollars = remainingAmount / 100;remainingAmount = remainingAmount % 100;int numberOfQuarters = remainingAmount / 25;remainingAmount = remainingAmount % 25;int numberOfDimes = remainingAmount / 10;remainingAmount = remainingAmount % 10;int numberOfNickels = remainingAmount / 5;remainingAmount = remainingAmount % 5;int numberOfPennies = remainingAmount;/*sout*/System.out.println("Your amount " + amount + " consists of");System.out.println(" " + numberOfOneDollars + " dollars");System.out.println(" " + numberOfQuarters + " quarters");System.out.println(" " + numberOfDimes + " dimes");System.out.println(" " + numberOfNickels + " nickels");System.out.println(" " + numberOfPennies + " pennies");}
2.23
import java.util.Scanner;public class Q2_23 {public static void main(String[] args) {Scanner input = new Scanner(System.in);System.out.println("Please enter the driving distance: ");double distance = input.nextDouble();System.out.println("Please enter miles per gallon: ");double milesPerGallon = input.nextDouble();System.out.println("Please enter price per gallon: ");double pricePerGallon = input.nextDouble();double cost;cost = (distance / milesPerGallon) * pricePerGallon;System.out.println("The cost of driving is $" + cost);}
}
第三章
3.1
import java.util.Scanner;public class Q3_1{public static void main(String[] args) {Scanner input = new Scanner(System.in);System.out.println("Please enter the value of a: ");double a = input.nextDouble();System.out.println("Please enter the value of b: ");double b = input.nextDouble();System.out.println("Please enter the value of c: ");double c = input.nextDouble();double judgement;judgement = Math.pow(b, 2) - 4*a*c;double r1, r2;if (judgement > 0){r1 = ((-b) + Math.pow(judgement, 0.5))/(2*a);r2 = ((-b) - Math.pow(judgement, 0.5))/(2*a);System.out.println("The equation has 2 roots " + r1 + " and " + r2 + ".");}else if (judgement == 0){r1 = ((-b) + Math.pow(judgement, 0.5))/(2*a);System.out.println("The equation has 1 root " + r1 + ".");}else{System.out.println("The equation has no real roots.");}}
}
3.2
import java.util.Scanner;public class Q3_2 {public static void main(String[] args) {int number01 = (int) System.currentTimeMillis() % 10;int number02 = (int) System.currentTimeMillis() / 7 % 10;int number03 = (int) System.currentTimeMillis() / 4 % 10;Scanner input = new Scanner(System.in);System.out.println("What is " + number01 +" + "+ number02 +" + "+ number03 +" ? ");int answer = input.nextInt();System.out.println(number01 +" + "+ number02 +" + "+ number03 + " = " + answer +" is " +(number01 + number02 + number03 == answer));}
}
3.3
import java.util.Scanner;public class Q3_3{public static void main(String[] args) {Scanner input = new Scanner(System.in);System.out.println("Enter a, b ,c ,d, e, f: ");float a = input.nextFloat();float b = input.nextFloat();float c = input.nextFloat();float d = input.nextFloat();float e = input.nextFloat();float f = input.nextFloat();float judgement = a*d - b*c;float x, y;if (judgement == 0){System.out.println("The equation has no solution.");}else{x = (e*d - b*f)/(a*d - b*c);y = (a*f - e*c)/(a*d - b*c);System.out.println("x is " + x + " and y is " + y + ".");} }
}
3.4
import java.util.Scanner;
import java.util.Random;public class Q3_4 {public static void main(String[] args) {Random r = new Random();int month = r.nextInt(13) + 1;switch (month){case 1 : System.out.println("The number " + month + " is " + "January"); break;case 2 : System.out.println("The number " + month + " is " + "February"); break;case 3 : System.out.println("The number " + month + " is " + "March"); break;case 4 : System.out.println("The number " + month + " is " + "April"); break;case 5 : System.out.println("The number " + month + " is " + "May"); break;case 6 : System.out.println("The number " + month + " is " + "June"); break;case 7 : System.out.println("The number " + month + " is " + "July"); break;case 8 : System.out.println("The number " + month + " is " + "August"); break;case 9 : System.out.println("The number " + month + " is " + "September"); break;case 10 : System.out.println("The number " + month + " is " + "October"); break;case 11 : System.out.println("The number " + month + " is " + "November"); break;case 12 : System.out.println("The number " + month + " is " + "December"); break;}}
}
3.5
import java.util.Scanner;public class test {public static void main(String[] args) {Scanner input = new Scanner(System.in);System.out.println("Enter today's day: ");int day = input.nextInt();System.out.println("Enter the number of days elapsed since today: ");int num_of_days = input.nextInt();int a = num_of_days % 7;int future_day1 = day + a;int future_day2;if (future_day1 > 6){future_day2 = future_day1 - 6;}else{future_day2 = future_day1;}switch (day) {case 0 : System.out.print("Today is Sunday ");break;case 1 : System.out.print("Today is Monday ");break;case 2 : System.out.print("Today is Tuesday ");break;case 3 : System.out.print("Today is Wednesday ");break;case 4 : System.out.print("Today is Thursday ");break;case 5 : System.out.print("Today is Friday ");break;case 6 : System.out.print("Today is Saturday ");break;}switch(future_day2){case 0 : System.out.println("and the future day is Sunday ");break;case 1 : System.out.println("and the future day is Monday ");break;case 2 : System.out.println("and the future day is Tuesday ");break;case 3 : System.out.println("and the future day is Wednesday ");break;case 4 : System.out.println("and the future day is Thursday ");break;case 5 : System.out.println("and the future day is Friday ");break;case 6 : System.out.println("and the future day is Saturday ");break;}}
}
3.6
import java.util.Scanner;public class test {public static void main(String[] args) {Scanner input = new Scanner(System.in);System.out.print("Enter weight in pounds:");double weight = input.nextDouble();System.out.print("Enter feet:");double feet = input.nextDouble();System.out.print("Enter inches:");double inches = input.nextDouble();inches = feet * 12 + inches;final double KIL0GRAMS_PER_P0UND = 0.45359237;final double METERS_PER_INCH = 0.0254;double weightInKilograms = weight * KIL0GRAMS_PER_P0UND;double heightInMeters = inches * METERS_PER_INCH;double bmi = weightInKilograms / (heightInMeters * heightInMeters);System.out.println("BMI is " + bmi);if (bmi < 18.5)System.out.println("Underweight");else if (bmi < 25)System.out.println("Normal");else if (bmi < 30)System.out.println("Overweight");elseSystem.out.println("Obese");}
}
46
3.7
import java.util.Scanner;public class test {public static void main(String args[]){Scanner input = new Scanner(System.in);System.out.print("Enter an amount in double, for example 11.56: ");double amount = input.nextDouble();int remainingAmount = (int)(amount * 100);int numberOfOneDollars = remainingAmount / 100;remainingAmount = remainingAmount % 100;int numberOfQuarters = remainingAmount / 25;remainingAmount = remainingAmount % 25;int numberOfDimes = remainingAmount / 10;remainingAmount = remainingAmount % 10;int numberOfNickels = remainingAmount /5;remainingAmount =remainingAmount % 5;int numberOfPennies = remainingAmount;System.out.println("Your amount " + amount + " consists of ");if(numberOfOneDollars == 1)System.out.println(" " + numberOfOneDollars + " dollar");else if (numberOfOneDollars > 1)System.out.println(" " + numberOfOneDollars + " dollars");if(numberOfQuarters == 1)System.out.println(" " + numberOfQuarters + " quarter");else if (numberOfQuarters > 1)System.out.println(" " + numberOfQuarters + " quarters");if(numberOfDimes == 1)System.out.println(" " + numberOfDimes + " dime");else if (numberOfDimes > 1)System.out.println(" " + numberOfDimes + " dimes");if(numberOfNickels == 1)System.out.println(" " + numberOfNickels + " nickel");else if (numberOfNickels > 1)System.out.println(" " + numberOfNickels + " nickels");if(numberOfPennies == 1)System.out.println(" " + numberOfPennies + " penny");else if (numberOfPennies > 1)System.out.println(" " + numberOfPennies + " pennies");}
}
3.8
import java.util.Scanner;public class test {public static void main(String[] args) {Scanner input = new Scanner(System.in);System.out.println("Enter three number a, b, c: ");int a = input.nextInt();int b = input.nextInt();int c = input.nextInt();int judgement;if (a>b){if (a>c){judgement = a;a = c;c = judgement;}else{judgement = c;}}System.out.println(a + ", " + b + ", " + c);}
}
3.9
import java.util.Scanner;public class test {public static void main(String[] args) {Scanner input = new Scanner(System.in);System.out.println("Enter 9 numbers(d1~d9): ");int d1 = input.nextInt();int d2 = input.nextInt();int d3 = input.nextInt();int d4 = input.nextInt();int d5 = input.nextInt();int d6 = input.nextInt();int d7 = input.nextInt();int d8 = input.nextInt();int d9 = input.nextInt();int d10 = (1*d1+2*d2+3*d3+4*d4+5*d5+6*d6+7*d7+8*d8+9*d9) % 11;if (d10 == 10){System.out.println("The ISBN-10 number is " + d1 + d2 + d3 + d4 + d5 + d6 + d7 + d8 + d9 + "X");}else{System.out.println("The ISBN-10 number is " + d1 + d2 + d3 + d4 + d5 + d6 + d7 + d8 + d9 + d10);}}
}
3.10
import java.util.Scanner;public class test {public static void main(String args[]){int number1 = (int)(Math.random() * 10);int number2 = (int)(Math.random() * 10);System.out.print("What`s " + number1 + "+" + number2 + " ? ");Scanner input = new Scanner(System.in);int answer = input.nextInt();if (number1 + number2 == answer)System.out.println("You are correct!");else{System.out.println("You answer is wrong.");System.out.println(number1 + "+" + number2 + " should be " + (number1 + number2));}}
}
3.11
import java.util.Scanner;public class test {public static void main(String[] args) {Scanner input = new Scanner(System.in);System.out.println("Enter the month and year: ");int month = input.nextInt();int year = input.nextInt();if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0){if (month == 2){System.out.println("February " + year + " has 29 days.");}else{switch(month){case 1 : System.out.println("January "+ year + " has 31 days");break;case 3 : System.out.println("March "+ year + " has 31 days");break;case 4 : System.out.println("April "+ year + " has 30 days");break;case 5 : System.out.println("May "+ year + " has 31 days");break;case 6 : System.out.println("June "+ year + " has 30 days");break;case 7 : System.out.println("July "+ year + " has 31 days");break; case 8 : System.out.println("August "+ year + " has 31 days");break;case 9 : System.out.println("September "+ year + " has 30 days");break;case 10 : System.out.println("October "+ year + " has 31 days");break;case 11 : System.out.println("November "+ year + " has 30 days");break;case 12 : System.out.println("December "+ year + " has 31 days");break;} }}else{switch (month){case 1 : System.out.println("January "+ year + " has 31 days");break;case 2 : System.out.println("February " + year + " has 28 days."); break;case 3 : System.out.println("March "+ year + " has 31 days");break;case 4 : System.out.println("April "+ year + " has 30 days");break;case 5 : System.out.println("May "+ year + " has 31 days");break;case 6 : System.out.println("June "+ year + " has 30 days");break;case 7 : System.out.println("July "+ year + " has 31 days");break;case 8 : System.out.println("August "+ year + " has 31 days");break;case 9 : System.out.println("September "+ year + " has 30 days");break;case 10 : System.out.println("October "+ year + " has 31 days");break;case 11 : System.out.println("November "+ year + " has 30 days");break;case 12 : System.out.println("December "+ year + " has 31 days");break;}}}
}
3.12
3.13
3.14
3.15
3.16
更多推荐
Java语言程序设计 基础版 第十版 个人学习课后习题记录(持续更新)
发布评论