├── Ch12 ├── score.txt ├── .idea │ ├── description.html │ ├── encodings.xml │ ├── vcs.xml │ ├── modules.xml │ ├── misc.xml │ └── compiler.xml ├── out │ └── production │ │ └── Ch12 │ │ ├── Main.class │ │ ├── test.class │ │ ├── ReadData.class │ │ ├── WebCrawler.class │ │ ├── WriteData.class │ │ ├── ReplaceText.class │ │ ├── TestFileClass.class │ │ ├── ReadFileFromURL.class │ │ ├── ChainedExceptionDemo.class │ │ ├── InvalidRadiusException.class │ │ ├── QuotientWithException.class │ │ ├── CircleWithCustomException.class │ │ ├── Quiz_12_4_IllArgumentException.class │ │ ├── TestCircleWithCustomException.class │ │ ├── Quiz_12_1_NumberFormationException.class │ │ ├── Quiz_12_3_ArrayIndexOutBoundsException.class │ │ └── Quiz_12_4_ThrowIllegalArgumentException.class ├── src │ ├── TestFileClass.java │ ├── InvalidRadiusException.java │ ├── Quiz_12_4_IllArgumentException.java │ ├── ChainedExceptionDemo.java │ ├── WriteData.java │ ├── Quiz_12_3_ArrayIndexOutBoundsException.java │ └── Quiz_12_4_ThrowIllegalArgumentException.java └── Ch12.iml ├── Ch07 ├── src │ ├── Quz_7_14.java │ ├── Quiz_7_13.java │ ├── Quiz_7_7.java │ ├── InputInteger.java │ ├── VarArgsDemo.java │ ├── ArrayCopyMethod.java │ ├── ReturnArrary.java │ ├── Quiz_7_34.java │ ├── Quiz_7_23.java │ ├── BinarySearch.java │ ├── Quiz_7_2.java │ ├── Quiz_7_9.java │ ├── Quiz_7_3.java │ ├── Quiz_7_20.java │ ├── Quiz_7_10.java │ ├── Quiz_7_12.java │ ├── Quiz_7_18.java │ ├── Quiz_7_8.java │ ├── AnalyzeNum.java │ └── SelectionSort.java ├── .idea │ ├── description.html │ ├── encodings.xml │ ├── vcs.xml │ ├── modules.xml │ ├── misc.xml │ └── compiler.xml ├── out │ └── production │ │ └── Ch07 │ │ ├── Main.class │ │ ├── Quiz_7_1.class │ │ ├── Quiz_7_2.class │ │ ├── Quiz_7_3.class │ │ ├── Quiz_7_4.class │ │ ├── Quiz_7_5.class │ │ ├── Quiz_7_6.class │ │ ├── Quiz_7_7.class │ │ ├── Quiz_7_8.class │ │ ├── Quiz_7_9.class │ │ ├── Quz_7_14.class │ │ ├── AnalyzeNum.class │ │ ├── DeckOfCard.class │ │ ├── Quiz_7_10.class │ │ ├── Quiz_7_12.class │ │ ├── Quiz_7_13.class │ │ ├── Quiz_7_15.class │ │ ├── Quiz_7_16.class │ │ ├── Quiz_7_17.class │ │ ├── Quiz_7_18.class │ │ ├── Quiz_7_19.class │ │ ├── Quiz_7_20.class │ │ ├── Quiz_7_21.class │ │ ├── Quiz_7_23.class │ │ ├── Quiz_7_24.class │ │ ├── Quiz_7_28.class │ │ ├── Quiz_7_29.class │ │ ├── Quiz_7_30.class │ │ ├── Quiz_7_32.class │ │ ├── Quiz_7_34.class │ │ ├── Quiz_7_35.class │ │ ├── TestArray.class │ │ ├── BinarySearch.class │ │ ├── InputInteger.class │ │ ├── ReturnArrary.class │ │ ├── SelectionSort.class │ │ ├── VarArgsDemo.class │ │ ├── ArrayCopyMethod.class │ │ └── CountLetterInArray.class └── Ch07.iml ├── README.md ├── Ch01 ├── .idea │ ├── description.html │ ├── vcs.xml │ ├── encodings.xml │ ├── artifacts │ │ └── unnamed.xml │ ├── modules.xml │ ├── misc.xml │ └── compiler.xml ├── out │ └── production │ │ └── Ch01 │ │ ├── Main.class │ │ ├── quiz_1_3.class │ │ ├── quiz_1_6.class │ │ ├── quiz_1_7.class │ │ ├── quiz_1_10.class │ │ ├── quiz_1_11.class │ │ └── quiz_1_13.class ├── src │ ├── quiz_1_3.java │ ├── quiz_1_7.java │ ├── quiz_1_6.java │ ├── quiz_1_11.java │ ├── quiz_1_10.java │ └── quiz_1_13.java └── Ch01.iml ├── Ch02 ├── .idea │ ├── description.html │ ├── encodings.xml │ ├── vcs.xml │ ├── modules.xml │ ├── misc.xml │ └── compiler.xml ├── out │ └── production │ │ └── Ch02 │ │ ├── Main.class │ │ ├── Quiz_2_6.class │ │ ├── SalesTax.class │ │ ├── Quiz_2_13.class │ │ ├── Quiz_2_17.class │ │ ├── Quiz_2_23.class │ │ ├── ComputeChange.class │ │ ├── ComputeLoan.class │ │ └── ShowCurrentTime.class ├── Ch02.iml └── src │ ├── SalesTax.java │ ├── Quiz_2_6.java │ ├── Quiz_2_17.java │ ├── Quiz_2_23.java │ ├── Quiz_2_13.java │ └── Main.java ├── Ch03 ├── .idea │ ├── description.html │ ├── encodings.xml │ ├── vcs.xml │ ├── modules.xml │ ├── misc.xml │ └── compiler.xml ├── out │ └── production │ │ └── Ch03 │ │ ├── Main.class │ │ ├── Lottery.class │ │ ├── Quiz_3_4.class │ │ ├── Quiz_3_5.class │ │ ├── Quiz_3_8.class │ │ ├── Quiz_3_9.class │ │ ├── ComputeTax.class │ │ ├── Quiz_3_11.class │ │ ├── Quiz_3_12.class │ │ ├── Quiz_3_14.class │ │ ├── Quiz_3_16.class │ │ ├── Quiz_3_18.class │ │ ├── Quiz_3_19.class │ │ ├── Quiz_3_21.class │ │ ├── Quiz_3_22.class │ │ ├── Quiz_3_23.class │ │ ├── Quiz_3_24.class │ │ ├── Quiz_3_27.class │ │ ├── Quiz_3_28.class │ │ ├── Quiz_3_29.class │ │ ├── Quiz_3_31.class │ │ ├── Quiz_3_32.class │ │ ├── Quiz_3_33.class │ │ ├── Quiz_3_34.class │ │ ├── AdditionQuiz.class │ │ ├── SubtractionQuiz.class │ │ ├── DoubleEquivalence.class │ │ └── ComputeAndInterpretBMI.class ├── src │ ├── DoubleEquivalence.java │ ├── Quiz_3_14.java │ ├── Quiz_3_8.java │ ├── AdditionQuiz.java │ ├── Quiz_3_23.java │ ├── Quiz_3_19.java │ ├── Quiz_3_12.java │ ├── SubtractionQuiz.java │ ├── Quiz_3_18.java │ ├── Quiz_3_22.java │ ├── Quiz_3_27.java │ ├── Quiz_3_11.java │ └── Quiz_3_33.java └── Ch03.iml ├── Ch04 ├── .idea │ ├── description.html │ ├── encodings.xml │ ├── vcs.xml │ ├── modules.xml │ ├── misc.xml │ └── compiler.xml ├── out │ └── production │ │ └── Ch04 │ │ ├── Main.class │ │ ├── Quiz_4_1.class │ │ ├── Quiz_4_2.class │ │ ├── Quiz_4_5.class │ │ ├── Quiz_4_6.class │ │ ├── Quiz_4_7.class │ │ ├── Quiz_4_8.class │ │ ├── Quiz_4_9.class │ │ ├── FormatDemo.class │ │ ├── Quiz_4_11.class │ │ ├── Quiz_4_12.class │ │ ├── Quiz_4_13.class │ │ ├── Quiz_4_14.class │ │ ├── Quiz_4_15.class │ │ ├── Quiz_4_16.class │ │ ├── Quiz_4_17.class │ │ ├── Quiz_4_18.class │ │ ├── Quiz_4_19.class │ │ ├── Quiz_4_20.class │ │ ├── Quiz_4_21.class │ │ ├── Quiz_4_23.class │ │ ├── Quiz_4_24.class │ │ ├── Quiz_4_25.class │ │ ├── TestPrintf.class │ │ ├── TestString.class │ │ ├── HexDigit2Dec.class │ │ ├── OrderTwoCities.class │ │ └── LotteryUsingString.class ├── src │ ├── Quiz_4_16.java │ ├── TestPrintf.java │ ├── Quiz_4_20.java │ ├── Quiz_4_25.java │ ├── Quiz_4_1.java │ ├── Quiz_4_8.java │ ├── Quiz_4_5.java │ ├── Quiz_4_9.java │ ├── Quiz_4_11.java │ ├── FormatDemo.java │ ├── OrderTwoCities.java │ └── Quiz_4_7.java └── Ch04.iml ├── Ch05 ├── .idea │ ├── description.html │ ├── project-template.xml │ ├── modules.xml │ └── misc.xml ├── out │ └── production │ │ └── Ch05 │ │ └── com │ │ └── company │ │ ├── Cost.class │ │ ├── Main.class │ │ ├── Dec2Hex.class │ │ ├── GuessNum.class │ │ ├── PrintNum.class │ │ ├── Quiz_5_8.class │ │ ├── ChangKG2B.class │ │ ├── ComputeCost.class │ │ ├── Palindrome.class │ │ ├── Quiz_5_10.class │ │ ├── Quiz_5_14.class │ │ ├── Quiz_5_15.class │ │ ├── Quiz_5_16.class │ │ ├── Quiz_5_17.class │ │ ├── Quiz_5_18.class │ │ ├── Quiz_5_19.class │ │ ├── Quiz_5_20.class │ │ ├── Quiz_5_21.class │ │ ├── Quiz_5_23.class │ │ ├── Quiz_5_24.class │ │ ├── Quiz_5_25.class │ │ ├── Quiz_5_26.class │ │ ├── Quiz_5_27.class │ │ ├── Quiz_5_28.class │ │ ├── Quiz_5_29.class │ │ ├── Quiz_5_30.class │ │ ├── Quiz_5_32.class │ │ ├── Quiz_5_33.class │ │ ├── Quiz_5_35.class │ │ ├── Quiz_5_37.class │ │ ├── Quiz_5_38.class │ │ ├── Quiz_5_39.class │ │ ├── Quiz_5_40.class │ │ ├── Quiz_5_41.class │ │ ├── Quiz_5_43.class │ │ ├── Quiz_5_44.class │ │ ├── Quiz_5_46.class │ │ ├── Quiz_5_47.class │ │ ├── Quiz_5_48.class │ │ ├── Quiz_5_49.class │ │ ├── Quiz_5_50.class │ │ ├── Quiz_5_51.class │ │ ├── SentinelVaiue.class │ │ ├── ComputeAverage.class │ │ ├── Quiz_5_8_Student.class │ │ ├── MulitplicationTable.class │ │ ├── SubtractionQuizLoop.class │ │ └── GfreatestCommonDivisor.class ├── src │ └── com │ │ └── company │ │ ├── ChangKG2B.java │ │ ├── Quiz_5_15.java │ │ ├── Quiz_5_46.java │ │ ├── Cost.java │ │ ├── Quiz_5_23.java │ │ ├── Quiz_5_37.java │ │ ├── Quiz_5_24.java │ │ ├── Quiz_5_35.java │ │ ├── Quiz_5_38.java │ │ ├── Quiz_5_8_Student.java │ │ ├── Quiz_5_25.java │ │ ├── Quiz_5_48.java │ │ ├── Quiz_5_44.java │ │ ├── SentinelVaiue.java │ │ ├── Quiz_5_16.java │ │ ├── Quiz_5_26.java │ │ ├── Quiz_5_50.java │ │ ├── Quiz_5_10.java │ │ ├── Quiz_5_33.java │ │ ├── MulitplicationTable.java │ │ ├── Quiz_5_41.java │ │ ├── Quiz_5_14.java │ │ ├── Dec2Hex.java │ │ ├── Quiz_5_40.java │ │ ├── Quiz_5_20.java │ │ ├── Quiz_5_18.java │ │ ├── Quiz_5_39.java │ │ ├── Quiz_5_29.java │ │ ├── Quiz_5_43.java │ │ ├── GuessNum.java │ │ ├── Palindrome.java │ │ ├── PrintNum.java │ │ └── GfreatestCommonDivisor.java └── Ch05.iml ├── Ch06 ├── .idea │ ├── description.html │ ├── encodings.xml │ ├── vcs.xml │ ├── modules.xml │ ├── misc.xml │ └── compiler.xml ├── out │ └── production │ │ └── Ch06 │ │ ├── Main.class │ │ ├── Hex2Dec.class │ │ ├── Quiz_5_2.class │ │ ├── Quiz_5_3.class │ │ ├── Quiz_6_1.class │ │ ├── Quiz_6_4.class │ │ ├── Quiz_6_5.class │ │ ├── Quiz_6_6.class │ │ ├── Quiz_6_7.class │ │ ├── Quiz_6_17.class │ │ ├── Quiz_6_18.class │ │ ├── Quiz_6_21.class │ │ ├── Quiz_6_22.class │ │ ├── Quiz_6_25.class │ │ ├── Quiz_6_26.class │ │ ├── Quiz_6_27.class │ │ ├── Quiz_6_28.class │ │ ├── Quiz_6_29.class │ │ ├── Quiz_6_30.class │ │ ├── Quiz_6_31.class │ │ ├── Quiz_6_32.class │ │ ├── Quiz_6_33.class │ │ ├── Quiz_6_37.class │ │ ├── TestMethod.class │ │ ├── PrimeNumMethod.class │ │ ├── RandomCharacter.class │ │ ├── TestRandomCharacter.class │ │ └── GreatestCommonDivisorMethod.class ├── src │ ├── Quiz_6_4.java │ ├── TestMethod.java │ ├── TestRandomCharacter.java │ ├── Quiz_6_29.java │ ├── Quiz_6_32.java │ ├── Quiz_5_2.java │ ├── Quiz_6_28.java │ ├── Quiz_6_1.java │ ├── Quiz_6_17.java │ ├── RandomCharacter.java │ ├── Quiz_6_22.java │ ├── Quiz_6_25.java │ ├── Quiz_6_26.java │ ├── Quiz_6_6.java │ ├── Quiz_6_27.java │ ├── Quiz_6_37.java │ ├── Hex2Dec.java │ ├── Quiz_6_7.java │ └── GreatestCommonDivisorMethod.java └── Ch06.iml ├── Ch08 ├── .idea │ ├── description.html │ ├── encodings.xml │ ├── vcs.xml │ ├── modules.xml │ ├── misc.xml │ └── compiler.xml ├── out │ └── production │ │ └── Ch08 │ │ ├── Array.class │ │ ├── Main.class │ │ ├── Quiz_8_1.class │ │ ├── Quiz_8_2.class │ │ ├── Quiz_8_4.class │ │ ├── Quiz_8_6.class │ │ ├── Quiz_8_9.class │ │ ├── Solution.class │ │ ├── Weather.class │ │ ├── GradeExam.class │ │ ├── Quiz_8_11.class │ │ ├── Quiz_8_14.class │ │ ├── Quiz_8_16.class │ │ ├── Test2Array.class │ │ └── FindNearestPoint.class ├── Ch08.iml └── src │ ├── Quiz_8_2.java │ ├── Quiz_8_6.java │ ├── GradeExam.java │ └── Quiz_8_1.java ├── Ch09 ├── .idea │ ├── description.html │ ├── encodings.xml │ ├── vcs.xml │ ├── modules.xml │ ├── misc.xml │ └── compiler.xml ├── out │ └── production │ │ └── Ch09 │ │ ├── Main.class │ │ ├── Quiz_9_3_Date.class │ │ ├── Quiz_9_2_Stock.class │ │ ├── Quiz_9_4_Random.class │ │ ├── Quiz_9_13_Location.class │ │ ├── Quiz_9_1_Rectangle.class │ │ ├── Quiz_9_6_StopWatch.class │ │ ├── Quiz_9_9_RegularPolygon.class │ │ └── Quiz_9_5_GregroianCalendar.class ├── Ch09.iml └── src │ ├── Quiz_9_4_Random.java │ ├── Quiz_9_3_Date.java │ ├── Quiz_9_6_StopWatch.java │ ├── Quiz_9_1_Rectangle.java │ ├── Quiz_9_5_GregroianCalendar.java │ └── Quiz_9_2_Stock.java ├── Ch10 ├── .idea │ ├── description.html │ ├── encodings.xml │ ├── vcs.xml │ ├── modules.xml │ ├── misc.xml │ └── compiler.xml ├── out │ └── production │ │ └── Ch10 │ │ ├── Main.class │ │ ├── Parse.class │ │ ├── Test.class │ │ ├── LargeFactorial.class │ │ ├── TestStringBuilder.class │ │ └── PalindromIgnoreNonAlphanumeric.class ├── src │ ├── Parse.java │ ├── Test.java │ └── LargeFactorial.java └── Ch10.iml ├── Ch11 ├── .idea │ ├── description.html │ ├── encodings.xml │ ├── vcs.xml │ ├── modules.xml │ ├── misc.xml │ └── compiler.xml ├── out │ └── production │ │ └── Ch11 │ │ ├── Main.class │ │ ├── ClassA.class │ │ ├── ClassB.class │ │ ├── MyStack.class │ │ ├── CastingDemo.class │ │ ├── TestArrayList.class │ │ ├── DistincNumbers.class │ │ ├── Quiz_11_2_Staff.class │ │ ├── TestInstanceOf.class │ │ ├── Quiz11_1_Triangle.class │ │ ├── Quiz_11_10_MyStack.class │ │ ├── Quiz_11_13_Remove.class │ │ ├── Quiz_11_2_Employer.class │ │ ├── Quiz_11_2_Faculty.class │ │ ├── Quiz_11_2_Person.class │ │ ├── Quiz_11_2_Student.class │ │ ├── Quiz_11_8_Account.class │ │ ├── Quiz_11_9_MaxNum.class │ │ ├── ArrayListConverArray.class │ │ ├── Quiz_11_Transaction.class │ │ ├── TestCircleRectangle.class │ │ ├── Quiz11_1_TestTriangle.class │ │ ├── SimpleGeometricObject.class │ │ ├── Quiz_11_3_MaxOfArraylist.class │ │ ├── SuperClassTestInstanceOf.class │ │ ├── CircleFromSimpleGeometricObject.class │ │ └── RectangleFromSimpleGeometricObject.class ├── src │ ├── SuperClassTestInstanceOf.java │ ├── TestInstanceOf.java │ ├── Quiz_11_14_Combination.java │ ├── Quiz_11_2_Staff.java │ ├── ClassA.java │ ├── Quiz_11_2_Employer.java │ ├── ClassB.java │ ├── Quiz_11_2_Faculty.java │ ├── Quiz_11_2_Person.java │ ├── Quiz_11_3_MaxOfArraylist.java │ ├── Quiz_11_13_Remove.java │ ├── Quiz_11_2_Student.java │ ├── Quiz_11_8_Account.java │ ├── CastingDemo.java │ ├── MyStack.java │ └── Quiz_11_10_MyStack.java └── Ch11.iml └── .gitignore /Ch12/score.txt: -------------------------------------------------------------------------------- 1 | zh 99 2 | wf 89 3 | -------------------------------------------------------------------------------- /Ch07/src/Quz_7_14.java: -------------------------------------------------------------------------------- 1 | public class Quz_7_14 { 2 | } 3 | -------------------------------------------------------------------------------- /Ch07/src/Quiz_7_13.java: -------------------------------------------------------------------------------- 1 | public class Quiz_7_13 { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/README.md -------------------------------------------------------------------------------- /Ch01/.idea/description.html: -------------------------------------------------------------------------------- 1 | Simple Java application that includes a class with main() method -------------------------------------------------------------------------------- /Ch01/out/production/Ch01/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch01/out/production/Ch01/Main.class -------------------------------------------------------------------------------- /Ch02/.idea/description.html: -------------------------------------------------------------------------------- 1 | Simple Java application that includes a class with main() method -------------------------------------------------------------------------------- /Ch02/out/production/Ch02/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch02/out/production/Ch02/Main.class -------------------------------------------------------------------------------- /Ch03/.idea/description.html: -------------------------------------------------------------------------------- 1 | Simple Java application that includes a class with main() method -------------------------------------------------------------------------------- /Ch03/out/production/Ch03/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch03/out/production/Ch03/Main.class -------------------------------------------------------------------------------- /Ch04/.idea/description.html: -------------------------------------------------------------------------------- 1 | Simple Java application that includes a class with main() method -------------------------------------------------------------------------------- /Ch04/out/production/Ch04/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch04/out/production/Ch04/Main.class -------------------------------------------------------------------------------- /Ch05/.idea/description.html: -------------------------------------------------------------------------------- 1 | Simple Java application that includes a class with main() method -------------------------------------------------------------------------------- /Ch05/.idea/project-template.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Ch06/.idea/description.html: -------------------------------------------------------------------------------- 1 | Simple Java application that includes a class with main() method -------------------------------------------------------------------------------- /Ch06/out/production/Ch06/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch06/out/production/Ch06/Main.class -------------------------------------------------------------------------------- /Ch07/.idea/description.html: -------------------------------------------------------------------------------- 1 | Simple Java application that includes a class with main() method -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/Main.class -------------------------------------------------------------------------------- /Ch08/.idea/description.html: -------------------------------------------------------------------------------- 1 | Simple Java application that includes a class with main() method -------------------------------------------------------------------------------- /Ch08/out/production/Ch08/Array.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch08/out/production/Ch08/Array.class -------------------------------------------------------------------------------- /Ch08/out/production/Ch08/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch08/out/production/Ch08/Main.class -------------------------------------------------------------------------------- /Ch09/.idea/description.html: -------------------------------------------------------------------------------- 1 | Simple Java application that includes a class with main() method -------------------------------------------------------------------------------- /Ch09/out/production/Ch09/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch09/out/production/Ch09/Main.class -------------------------------------------------------------------------------- /Ch10/.idea/description.html: -------------------------------------------------------------------------------- 1 | Simple Java application that includes a class with main() method -------------------------------------------------------------------------------- /Ch10/out/production/Ch10/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch10/out/production/Ch10/Main.class -------------------------------------------------------------------------------- /Ch10/out/production/Ch10/Parse.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch10/out/production/Ch10/Parse.class -------------------------------------------------------------------------------- /Ch10/out/production/Ch10/Test.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch10/out/production/Ch10/Test.class -------------------------------------------------------------------------------- /Ch11/.idea/description.html: -------------------------------------------------------------------------------- 1 | Simple Java application that includes a class with main() method -------------------------------------------------------------------------------- /Ch11/out/production/Ch11/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch11/out/production/Ch11/Main.class -------------------------------------------------------------------------------- /Ch11/src/SuperClassTestInstanceOf.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author callmezh 3 | */ 4 | public class SuperClassTestInstanceOf { 5 | } 6 | -------------------------------------------------------------------------------- /Ch12/.idea/description.html: -------------------------------------------------------------------------------- 1 | Simple Java application that includes a class with main() method -------------------------------------------------------------------------------- /Ch12/out/production/Ch12/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch12/out/production/Ch12/Main.class -------------------------------------------------------------------------------- /Ch12/out/production/Ch12/test.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch12/out/production/Ch12/test.class -------------------------------------------------------------------------------- /Ch01/out/production/Ch01/quiz_1_3.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch01/out/production/Ch01/quiz_1_3.class -------------------------------------------------------------------------------- /Ch01/out/production/Ch01/quiz_1_6.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch01/out/production/Ch01/quiz_1_6.class -------------------------------------------------------------------------------- /Ch01/out/production/Ch01/quiz_1_7.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch01/out/production/Ch01/quiz_1_7.class -------------------------------------------------------------------------------- /Ch02/out/production/Ch02/Quiz_2_6.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch02/out/production/Ch02/Quiz_2_6.class -------------------------------------------------------------------------------- /Ch02/out/production/Ch02/SalesTax.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch02/out/production/Ch02/SalesTax.class -------------------------------------------------------------------------------- /Ch03/out/production/Ch03/Lottery.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch03/out/production/Ch03/Lottery.class -------------------------------------------------------------------------------- /Ch03/out/production/Ch03/Quiz_3_4.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch03/out/production/Ch03/Quiz_3_4.class -------------------------------------------------------------------------------- /Ch03/out/production/Ch03/Quiz_3_5.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch03/out/production/Ch03/Quiz_3_5.class -------------------------------------------------------------------------------- /Ch03/out/production/Ch03/Quiz_3_8.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch03/out/production/Ch03/Quiz_3_8.class -------------------------------------------------------------------------------- /Ch03/out/production/Ch03/Quiz_3_9.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch03/out/production/Ch03/Quiz_3_9.class -------------------------------------------------------------------------------- /Ch04/out/production/Ch04/Quiz_4_1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch04/out/production/Ch04/Quiz_4_1.class -------------------------------------------------------------------------------- /Ch04/out/production/Ch04/Quiz_4_2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch04/out/production/Ch04/Quiz_4_2.class -------------------------------------------------------------------------------- /Ch04/out/production/Ch04/Quiz_4_5.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch04/out/production/Ch04/Quiz_4_5.class -------------------------------------------------------------------------------- /Ch04/out/production/Ch04/Quiz_4_6.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch04/out/production/Ch04/Quiz_4_6.class -------------------------------------------------------------------------------- /Ch04/out/production/Ch04/Quiz_4_7.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch04/out/production/Ch04/Quiz_4_7.class -------------------------------------------------------------------------------- /Ch04/out/production/Ch04/Quiz_4_8.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch04/out/production/Ch04/Quiz_4_8.class -------------------------------------------------------------------------------- /Ch04/out/production/Ch04/Quiz_4_9.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch04/out/production/Ch04/Quiz_4_9.class -------------------------------------------------------------------------------- /Ch06/out/production/Ch06/Hex2Dec.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch06/out/production/Ch06/Hex2Dec.class -------------------------------------------------------------------------------- /Ch06/out/production/Ch06/Quiz_5_2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch06/out/production/Ch06/Quiz_5_2.class -------------------------------------------------------------------------------- /Ch06/out/production/Ch06/Quiz_5_3.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch06/out/production/Ch06/Quiz_5_3.class -------------------------------------------------------------------------------- /Ch06/out/production/Ch06/Quiz_6_1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch06/out/production/Ch06/Quiz_6_1.class -------------------------------------------------------------------------------- /Ch06/out/production/Ch06/Quiz_6_4.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch06/out/production/Ch06/Quiz_6_4.class -------------------------------------------------------------------------------- /Ch06/out/production/Ch06/Quiz_6_5.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch06/out/production/Ch06/Quiz_6_5.class -------------------------------------------------------------------------------- /Ch06/out/production/Ch06/Quiz_6_6.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch06/out/production/Ch06/Quiz_6_6.class -------------------------------------------------------------------------------- /Ch06/out/production/Ch06/Quiz_6_7.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch06/out/production/Ch06/Quiz_6_7.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/Quiz_7_1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/Quiz_7_1.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/Quiz_7_2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/Quiz_7_2.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/Quiz_7_3.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/Quiz_7_3.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/Quiz_7_4.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/Quiz_7_4.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/Quiz_7_5.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/Quiz_7_5.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/Quiz_7_6.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/Quiz_7_6.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/Quiz_7_7.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/Quiz_7_7.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/Quiz_7_8.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/Quiz_7_8.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/Quiz_7_9.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/Quiz_7_9.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/Quz_7_14.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/Quz_7_14.class -------------------------------------------------------------------------------- /Ch08/out/production/Ch08/Quiz_8_1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch08/out/production/Ch08/Quiz_8_1.class -------------------------------------------------------------------------------- /Ch08/out/production/Ch08/Quiz_8_2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch08/out/production/Ch08/Quiz_8_2.class -------------------------------------------------------------------------------- /Ch08/out/production/Ch08/Quiz_8_4.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch08/out/production/Ch08/Quiz_8_4.class -------------------------------------------------------------------------------- /Ch08/out/production/Ch08/Quiz_8_6.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch08/out/production/Ch08/Quiz_8_6.class -------------------------------------------------------------------------------- /Ch08/out/production/Ch08/Quiz_8_9.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch08/out/production/Ch08/Quiz_8_9.class -------------------------------------------------------------------------------- /Ch08/out/production/Ch08/Solution.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch08/out/production/Ch08/Solution.class -------------------------------------------------------------------------------- /Ch08/out/production/Ch08/Weather.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch08/out/production/Ch08/Weather.class -------------------------------------------------------------------------------- /Ch11/out/production/Ch11/ClassA.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch11/out/production/Ch11/ClassA.class -------------------------------------------------------------------------------- /Ch11/out/production/Ch11/ClassB.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch11/out/production/Ch11/ClassB.class -------------------------------------------------------------------------------- /Ch11/out/production/Ch11/MyStack.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch11/out/production/Ch11/MyStack.class -------------------------------------------------------------------------------- /Ch12/out/production/Ch12/ReadData.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch12/out/production/Ch12/ReadData.class -------------------------------------------------------------------------------- /Ch01/out/production/Ch01/quiz_1_10.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch01/out/production/Ch01/quiz_1_10.class -------------------------------------------------------------------------------- /Ch01/out/production/Ch01/quiz_1_11.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch01/out/production/Ch01/quiz_1_11.class -------------------------------------------------------------------------------- /Ch01/out/production/Ch01/quiz_1_13.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch01/out/production/Ch01/quiz_1_13.class -------------------------------------------------------------------------------- /Ch02/out/production/Ch02/Quiz_2_13.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch02/out/production/Ch02/Quiz_2_13.class -------------------------------------------------------------------------------- /Ch02/out/production/Ch02/Quiz_2_17.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch02/out/production/Ch02/Quiz_2_17.class -------------------------------------------------------------------------------- /Ch02/out/production/Ch02/Quiz_2_23.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch02/out/production/Ch02/Quiz_2_23.class -------------------------------------------------------------------------------- /Ch03/out/production/Ch03/ComputeTax.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch03/out/production/Ch03/ComputeTax.class -------------------------------------------------------------------------------- /Ch03/out/production/Ch03/Quiz_3_11.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch03/out/production/Ch03/Quiz_3_11.class -------------------------------------------------------------------------------- /Ch03/out/production/Ch03/Quiz_3_12.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch03/out/production/Ch03/Quiz_3_12.class -------------------------------------------------------------------------------- /Ch03/out/production/Ch03/Quiz_3_14.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch03/out/production/Ch03/Quiz_3_14.class -------------------------------------------------------------------------------- /Ch03/out/production/Ch03/Quiz_3_16.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch03/out/production/Ch03/Quiz_3_16.class -------------------------------------------------------------------------------- /Ch03/out/production/Ch03/Quiz_3_18.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch03/out/production/Ch03/Quiz_3_18.class -------------------------------------------------------------------------------- /Ch03/out/production/Ch03/Quiz_3_19.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch03/out/production/Ch03/Quiz_3_19.class -------------------------------------------------------------------------------- /Ch03/out/production/Ch03/Quiz_3_21.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch03/out/production/Ch03/Quiz_3_21.class -------------------------------------------------------------------------------- /Ch03/out/production/Ch03/Quiz_3_22.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch03/out/production/Ch03/Quiz_3_22.class -------------------------------------------------------------------------------- /Ch03/out/production/Ch03/Quiz_3_23.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch03/out/production/Ch03/Quiz_3_23.class -------------------------------------------------------------------------------- /Ch03/out/production/Ch03/Quiz_3_24.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch03/out/production/Ch03/Quiz_3_24.class -------------------------------------------------------------------------------- /Ch03/out/production/Ch03/Quiz_3_27.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch03/out/production/Ch03/Quiz_3_27.class -------------------------------------------------------------------------------- /Ch03/out/production/Ch03/Quiz_3_28.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch03/out/production/Ch03/Quiz_3_28.class -------------------------------------------------------------------------------- /Ch03/out/production/Ch03/Quiz_3_29.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch03/out/production/Ch03/Quiz_3_29.class -------------------------------------------------------------------------------- /Ch03/out/production/Ch03/Quiz_3_31.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch03/out/production/Ch03/Quiz_3_31.class -------------------------------------------------------------------------------- /Ch03/out/production/Ch03/Quiz_3_32.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch03/out/production/Ch03/Quiz_3_32.class -------------------------------------------------------------------------------- /Ch03/out/production/Ch03/Quiz_3_33.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch03/out/production/Ch03/Quiz_3_33.class -------------------------------------------------------------------------------- /Ch03/out/production/Ch03/Quiz_3_34.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch03/out/production/Ch03/Quiz_3_34.class -------------------------------------------------------------------------------- /Ch04/out/production/Ch04/FormatDemo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch04/out/production/Ch04/FormatDemo.class -------------------------------------------------------------------------------- /Ch04/out/production/Ch04/Quiz_4_11.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch04/out/production/Ch04/Quiz_4_11.class -------------------------------------------------------------------------------- /Ch04/out/production/Ch04/Quiz_4_12.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch04/out/production/Ch04/Quiz_4_12.class -------------------------------------------------------------------------------- /Ch04/out/production/Ch04/Quiz_4_13.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch04/out/production/Ch04/Quiz_4_13.class -------------------------------------------------------------------------------- /Ch04/out/production/Ch04/Quiz_4_14.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch04/out/production/Ch04/Quiz_4_14.class -------------------------------------------------------------------------------- /Ch04/out/production/Ch04/Quiz_4_15.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch04/out/production/Ch04/Quiz_4_15.class -------------------------------------------------------------------------------- /Ch04/out/production/Ch04/Quiz_4_16.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch04/out/production/Ch04/Quiz_4_16.class -------------------------------------------------------------------------------- /Ch04/out/production/Ch04/Quiz_4_17.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch04/out/production/Ch04/Quiz_4_17.class -------------------------------------------------------------------------------- /Ch04/out/production/Ch04/Quiz_4_18.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch04/out/production/Ch04/Quiz_4_18.class -------------------------------------------------------------------------------- /Ch04/out/production/Ch04/Quiz_4_19.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch04/out/production/Ch04/Quiz_4_19.class -------------------------------------------------------------------------------- /Ch04/out/production/Ch04/Quiz_4_20.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch04/out/production/Ch04/Quiz_4_20.class -------------------------------------------------------------------------------- /Ch04/out/production/Ch04/Quiz_4_21.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch04/out/production/Ch04/Quiz_4_21.class -------------------------------------------------------------------------------- /Ch04/out/production/Ch04/Quiz_4_23.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch04/out/production/Ch04/Quiz_4_23.class -------------------------------------------------------------------------------- /Ch04/out/production/Ch04/Quiz_4_24.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch04/out/production/Ch04/Quiz_4_24.class -------------------------------------------------------------------------------- /Ch04/out/production/Ch04/Quiz_4_25.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch04/out/production/Ch04/Quiz_4_25.class -------------------------------------------------------------------------------- /Ch04/out/production/Ch04/TestPrintf.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch04/out/production/Ch04/TestPrintf.class -------------------------------------------------------------------------------- /Ch04/out/production/Ch04/TestString.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch04/out/production/Ch04/TestString.class -------------------------------------------------------------------------------- /Ch06/out/production/Ch06/Quiz_6_17.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch06/out/production/Ch06/Quiz_6_17.class -------------------------------------------------------------------------------- /Ch06/out/production/Ch06/Quiz_6_18.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch06/out/production/Ch06/Quiz_6_18.class -------------------------------------------------------------------------------- /Ch06/out/production/Ch06/Quiz_6_21.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch06/out/production/Ch06/Quiz_6_21.class -------------------------------------------------------------------------------- /Ch06/out/production/Ch06/Quiz_6_22.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch06/out/production/Ch06/Quiz_6_22.class -------------------------------------------------------------------------------- /Ch06/out/production/Ch06/Quiz_6_25.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch06/out/production/Ch06/Quiz_6_25.class -------------------------------------------------------------------------------- /Ch06/out/production/Ch06/Quiz_6_26.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch06/out/production/Ch06/Quiz_6_26.class -------------------------------------------------------------------------------- /Ch06/out/production/Ch06/Quiz_6_27.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch06/out/production/Ch06/Quiz_6_27.class -------------------------------------------------------------------------------- /Ch06/out/production/Ch06/Quiz_6_28.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch06/out/production/Ch06/Quiz_6_28.class -------------------------------------------------------------------------------- /Ch06/out/production/Ch06/Quiz_6_29.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch06/out/production/Ch06/Quiz_6_29.class -------------------------------------------------------------------------------- /Ch06/out/production/Ch06/Quiz_6_30.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch06/out/production/Ch06/Quiz_6_30.class -------------------------------------------------------------------------------- /Ch06/out/production/Ch06/Quiz_6_31.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch06/out/production/Ch06/Quiz_6_31.class -------------------------------------------------------------------------------- /Ch06/out/production/Ch06/Quiz_6_32.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch06/out/production/Ch06/Quiz_6_32.class -------------------------------------------------------------------------------- /Ch06/out/production/Ch06/Quiz_6_33.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch06/out/production/Ch06/Quiz_6_33.class -------------------------------------------------------------------------------- /Ch06/out/production/Ch06/Quiz_6_37.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch06/out/production/Ch06/Quiz_6_37.class -------------------------------------------------------------------------------- /Ch06/out/production/Ch06/TestMethod.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch06/out/production/Ch06/TestMethod.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/AnalyzeNum.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/AnalyzeNum.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/DeckOfCard.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/DeckOfCard.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/Quiz_7_10.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/Quiz_7_10.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/Quiz_7_12.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/Quiz_7_12.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/Quiz_7_13.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/Quiz_7_13.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/Quiz_7_15.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/Quiz_7_15.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/Quiz_7_16.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/Quiz_7_16.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/Quiz_7_17.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/Quiz_7_17.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/Quiz_7_18.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/Quiz_7_18.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/Quiz_7_19.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/Quiz_7_19.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/Quiz_7_20.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/Quiz_7_20.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/Quiz_7_21.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/Quiz_7_21.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/Quiz_7_23.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/Quiz_7_23.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/Quiz_7_24.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/Quiz_7_24.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/Quiz_7_28.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/Quiz_7_28.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/Quiz_7_29.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/Quiz_7_29.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/Quiz_7_30.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/Quiz_7_30.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/Quiz_7_32.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/Quiz_7_32.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/Quiz_7_34.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/Quiz_7_34.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/Quiz_7_35.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/Quiz_7_35.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/TestArray.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/TestArray.class -------------------------------------------------------------------------------- /Ch08/out/production/Ch08/GradeExam.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch08/out/production/Ch08/GradeExam.class -------------------------------------------------------------------------------- /Ch08/out/production/Ch08/Quiz_8_11.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch08/out/production/Ch08/Quiz_8_11.class -------------------------------------------------------------------------------- /Ch08/out/production/Ch08/Quiz_8_14.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch08/out/production/Ch08/Quiz_8_14.class -------------------------------------------------------------------------------- /Ch08/out/production/Ch08/Quiz_8_16.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch08/out/production/Ch08/Quiz_8_16.class -------------------------------------------------------------------------------- /Ch08/out/production/Ch08/Test2Array.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch08/out/production/Ch08/Test2Array.class -------------------------------------------------------------------------------- /Ch12/out/production/Ch12/WebCrawler.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch12/out/production/Ch12/WebCrawler.class -------------------------------------------------------------------------------- /Ch12/out/production/Ch12/WriteData.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch12/out/production/Ch12/WriteData.class -------------------------------------------------------------------------------- /Ch02/out/production/Ch02/ComputeChange.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch02/out/production/Ch02/ComputeChange.class -------------------------------------------------------------------------------- /Ch02/out/production/Ch02/ComputeLoan.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch02/out/production/Ch02/ComputeLoan.class -------------------------------------------------------------------------------- /Ch03/out/production/Ch03/AdditionQuiz.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch03/out/production/Ch03/AdditionQuiz.class -------------------------------------------------------------------------------- /Ch04/out/production/Ch04/HexDigit2Dec.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch04/out/production/Ch04/HexDigit2Dec.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/BinarySearch.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/BinarySearch.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/InputInteger.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/InputInteger.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/ReturnArrary.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/ReturnArrary.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/SelectionSort.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/SelectionSort.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/VarArgsDemo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/VarArgsDemo.class -------------------------------------------------------------------------------- /Ch09/out/production/Ch09/Quiz_9_3_Date.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch09/out/production/Ch09/Quiz_9_3_Date.class -------------------------------------------------------------------------------- /Ch11/out/production/Ch11/CastingDemo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch11/out/production/Ch11/CastingDemo.class -------------------------------------------------------------------------------- /Ch11/out/production/Ch11/TestArrayList.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch11/out/production/Ch11/TestArrayList.class -------------------------------------------------------------------------------- /Ch12/out/production/Ch12/ReplaceText.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch12/out/production/Ch12/ReplaceText.class -------------------------------------------------------------------------------- /Ch12/out/production/Ch12/TestFileClass.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch12/out/production/Ch12/TestFileClass.class -------------------------------------------------------------------------------- /Ch02/out/production/Ch02/ShowCurrentTime.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch02/out/production/Ch02/ShowCurrentTime.class -------------------------------------------------------------------------------- /Ch03/out/production/Ch03/SubtractionQuiz.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch03/out/production/Ch03/SubtractionQuiz.class -------------------------------------------------------------------------------- /Ch04/out/production/Ch04/OrderTwoCities.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch04/out/production/Ch04/OrderTwoCities.class -------------------------------------------------------------------------------- /Ch06/out/production/Ch06/PrimeNumMethod.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch06/out/production/Ch06/PrimeNumMethod.class -------------------------------------------------------------------------------- /Ch06/out/production/Ch06/RandomCharacter.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch06/out/production/Ch06/RandomCharacter.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/ArrayCopyMethod.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/ArrayCopyMethod.class -------------------------------------------------------------------------------- /Ch09/out/production/Ch09/Quiz_9_2_Stock.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch09/out/production/Ch09/Quiz_9_2_Stock.class -------------------------------------------------------------------------------- /Ch09/out/production/Ch09/Quiz_9_4_Random.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch09/out/production/Ch09/Quiz_9_4_Random.class -------------------------------------------------------------------------------- /Ch10/out/production/Ch10/LargeFactorial.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch10/out/production/Ch10/LargeFactorial.class -------------------------------------------------------------------------------- /Ch11/out/production/Ch11/DistincNumbers.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch11/out/production/Ch11/DistincNumbers.class -------------------------------------------------------------------------------- /Ch11/out/production/Ch11/Quiz_11_2_Staff.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch11/out/production/Ch11/Quiz_11_2_Staff.class -------------------------------------------------------------------------------- /Ch11/out/production/Ch11/TestInstanceOf.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch11/out/production/Ch11/TestInstanceOf.class -------------------------------------------------------------------------------- /Ch11/src/TestInstanceOf.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author callmezh 3 | */ 4 | public class TestInstanceOf extends SuperClassTestInstanceOf{ 5 | 6 | } 7 | -------------------------------------------------------------------------------- /Ch12/out/production/Ch12/ReadFileFromURL.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch12/out/production/Ch12/ReadFileFromURL.class -------------------------------------------------------------------------------- /Ch03/out/production/Ch03/DoubleEquivalence.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch03/out/production/Ch03/DoubleEquivalence.class -------------------------------------------------------------------------------- /Ch04/out/production/Ch04/LotteryUsingString.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch04/out/production/Ch04/LotteryUsingString.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Cost.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Cost.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Main.class -------------------------------------------------------------------------------- /Ch07/out/production/Ch07/CountLetterInArray.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch07/out/production/Ch07/CountLetterInArray.class -------------------------------------------------------------------------------- /Ch08/out/production/Ch08/FindNearestPoint.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch08/out/production/Ch08/FindNearestPoint.class -------------------------------------------------------------------------------- /Ch09/out/production/Ch09/Quiz_9_13_Location.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch09/out/production/Ch09/Quiz_9_13_Location.class -------------------------------------------------------------------------------- /Ch09/out/production/Ch09/Quiz_9_1_Rectangle.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch09/out/production/Ch09/Quiz_9_1_Rectangle.class -------------------------------------------------------------------------------- /Ch09/out/production/Ch09/Quiz_9_6_StopWatch.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch09/out/production/Ch09/Quiz_9_6_StopWatch.class -------------------------------------------------------------------------------- /Ch10/out/production/Ch10/TestStringBuilder.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch10/out/production/Ch10/TestStringBuilder.class -------------------------------------------------------------------------------- /Ch11/out/production/Ch11/Quiz11_1_Triangle.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch11/out/production/Ch11/Quiz11_1_Triangle.class -------------------------------------------------------------------------------- /Ch11/out/production/Ch11/Quiz_11_10_MyStack.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch11/out/production/Ch11/Quiz_11_10_MyStack.class -------------------------------------------------------------------------------- /Ch11/out/production/Ch11/Quiz_11_13_Remove.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch11/out/production/Ch11/Quiz_11_13_Remove.class -------------------------------------------------------------------------------- /Ch11/out/production/Ch11/Quiz_11_2_Employer.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch11/out/production/Ch11/Quiz_11_2_Employer.class -------------------------------------------------------------------------------- /Ch11/out/production/Ch11/Quiz_11_2_Faculty.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch11/out/production/Ch11/Quiz_11_2_Faculty.class -------------------------------------------------------------------------------- /Ch11/out/production/Ch11/Quiz_11_2_Person.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch11/out/production/Ch11/Quiz_11_2_Person.class -------------------------------------------------------------------------------- /Ch11/out/production/Ch11/Quiz_11_2_Student.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch11/out/production/Ch11/Quiz_11_2_Student.class -------------------------------------------------------------------------------- /Ch11/out/production/Ch11/Quiz_11_8_Account.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch11/out/production/Ch11/Quiz_11_8_Account.class -------------------------------------------------------------------------------- /Ch11/out/production/Ch11/Quiz_11_9_MaxNum.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch11/out/production/Ch11/Quiz_11_9_MaxNum.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Dec2Hex.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Dec2Hex.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/GuessNum.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/GuessNum.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/PrintNum.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/PrintNum.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Quiz_5_8.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Quiz_5_8.class -------------------------------------------------------------------------------- /Ch06/out/production/Ch06/TestRandomCharacter.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch06/out/production/Ch06/TestRandomCharacter.class -------------------------------------------------------------------------------- /Ch11/out/production/Ch11/ArrayListConverArray.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch11/out/production/Ch11/ArrayListConverArray.class -------------------------------------------------------------------------------- /Ch11/out/production/Ch11/Quiz_11_Transaction.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch11/out/production/Ch11/Quiz_11_Transaction.class -------------------------------------------------------------------------------- /Ch11/out/production/Ch11/TestCircleRectangle.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch11/out/production/Ch11/TestCircleRectangle.class -------------------------------------------------------------------------------- /Ch12/out/production/Ch12/ChainedExceptionDemo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch12/out/production/Ch12/ChainedExceptionDemo.class -------------------------------------------------------------------------------- /Ch03/out/production/Ch03/ComputeAndInterpretBMI.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch03/out/production/Ch03/ComputeAndInterpretBMI.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/ChangKG2B.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/ChangKG2B.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/ComputeCost.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/ComputeCost.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Palindrome.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Palindrome.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Quiz_5_10.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Quiz_5_10.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Quiz_5_14.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Quiz_5_14.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Quiz_5_15.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Quiz_5_15.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Quiz_5_16.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Quiz_5_16.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Quiz_5_17.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Quiz_5_17.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Quiz_5_18.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Quiz_5_18.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Quiz_5_19.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Quiz_5_19.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Quiz_5_20.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Quiz_5_20.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Quiz_5_21.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Quiz_5_21.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Quiz_5_23.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Quiz_5_23.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Quiz_5_24.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Quiz_5_24.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Quiz_5_25.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Quiz_5_25.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Quiz_5_26.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Quiz_5_26.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Quiz_5_27.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Quiz_5_27.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Quiz_5_28.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Quiz_5_28.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Quiz_5_29.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Quiz_5_29.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Quiz_5_30.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Quiz_5_30.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Quiz_5_32.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Quiz_5_32.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Quiz_5_33.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Quiz_5_33.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Quiz_5_35.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Quiz_5_35.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Quiz_5_37.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Quiz_5_37.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Quiz_5_38.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Quiz_5_38.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Quiz_5_39.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Quiz_5_39.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Quiz_5_40.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Quiz_5_40.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Quiz_5_41.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Quiz_5_41.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Quiz_5_43.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Quiz_5_43.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Quiz_5_44.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Quiz_5_44.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Quiz_5_46.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Quiz_5_46.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Quiz_5_47.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Quiz_5_47.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Quiz_5_48.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Quiz_5_48.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Quiz_5_49.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Quiz_5_49.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Quiz_5_50.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Quiz_5_50.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Quiz_5_51.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Quiz_5_51.class -------------------------------------------------------------------------------- /Ch09/out/production/Ch09/Quiz_9_9_RegularPolygon.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch09/out/production/Ch09/Quiz_9_9_RegularPolygon.class -------------------------------------------------------------------------------- /Ch10/src/Parse.java: -------------------------------------------------------------------------------- 1 | public class Parse { 2 | static int printResult(){ 3 | int x = Integer.parseInt("11", 3); 4 | return x; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Ch11/out/production/Ch11/Quiz11_1_TestTriangle.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch11/out/production/Ch11/Quiz11_1_TestTriangle.class -------------------------------------------------------------------------------- /Ch11/out/production/Ch11/SimpleGeometricObject.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch11/out/production/Ch11/SimpleGeometricObject.class -------------------------------------------------------------------------------- /Ch12/out/production/Ch12/InvalidRadiusException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch12/out/production/Ch12/InvalidRadiusException.class -------------------------------------------------------------------------------- /Ch12/out/production/Ch12/QuotientWithException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch12/out/production/Ch12/QuotientWithException.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/SentinelVaiue.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/SentinelVaiue.class -------------------------------------------------------------------------------- /Ch11/out/production/Ch11/Quiz_11_3_MaxOfArraylist.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch11/out/production/Ch11/Quiz_11_3_MaxOfArraylist.class -------------------------------------------------------------------------------- /Ch11/out/production/Ch11/SuperClassTestInstanceOf.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch11/out/production/Ch11/SuperClassTestInstanceOf.class -------------------------------------------------------------------------------- /Ch12/out/production/Ch12/CircleWithCustomException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch12/out/production/Ch12/CircleWithCustomException.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/ComputeAverage.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/ComputeAverage.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/Quiz_5_8_Student.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/Quiz_5_8_Student.class -------------------------------------------------------------------------------- /Ch06/out/production/Ch06/GreatestCommonDivisorMethod.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch06/out/production/Ch06/GreatestCommonDivisorMethod.class -------------------------------------------------------------------------------- /Ch09/out/production/Ch09/Quiz_9_5_GregroianCalendar.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch09/out/production/Ch09/Quiz_9_5_GregroianCalendar.class -------------------------------------------------------------------------------- /Ch10/out/production/Ch10/PalindromIgnoreNonAlphanumeric.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch10/out/production/Ch10/PalindromIgnoreNonAlphanumeric.class -------------------------------------------------------------------------------- /Ch12/out/production/Ch12/Quiz_12_4_IllArgumentException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch12/out/production/Ch12/Quiz_12_4_IllArgumentException.class -------------------------------------------------------------------------------- /Ch12/out/production/Ch12/TestCircleWithCustomException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch12/out/production/Ch12/TestCircleWithCustomException.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/MulitplicationTable.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/MulitplicationTable.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/SubtractionQuizLoop.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/SubtractionQuizLoop.class -------------------------------------------------------------------------------- /Ch11/out/production/Ch11/CircleFromSimpleGeometricObject.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch11/out/production/Ch11/CircleFromSimpleGeometricObject.class -------------------------------------------------------------------------------- /Ch05/out/production/Ch05/com/company/GfreatestCommonDivisor.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch05/out/production/Ch05/com/company/GfreatestCommonDivisor.class -------------------------------------------------------------------------------- /Ch11/out/production/Ch11/RectangleFromSimpleGeometricObject.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch11/out/production/Ch11/RectangleFromSimpleGeometricObject.class -------------------------------------------------------------------------------- /Ch12/out/production/Ch12/Quiz_12_1_NumberFormationException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch12/out/production/Ch12/Quiz_12_1_NumberFormationException.class -------------------------------------------------------------------------------- /Ch12/out/production/Ch12/Quiz_12_3_ArrayIndexOutBoundsException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch12/out/production/Ch12/Quiz_12_3_ArrayIndexOutBoundsException.class -------------------------------------------------------------------------------- /Ch12/out/production/Ch12/Quiz_12_4_ThrowIllegalArgumentException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHUISSZH/CodingJAVA/HEAD/Ch12/out/production/Ch12/Quiz_12_4_ThrowIllegalArgumentException.class -------------------------------------------------------------------------------- /Ch01/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Ch02/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Ch02/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Ch03/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Ch03/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Ch04/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Ch04/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Ch06/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Ch06/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Ch07/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Ch07/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Ch08/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Ch08/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Ch09/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Ch09/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Ch10/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Ch10/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Ch11/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Ch11/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Ch12/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Ch12/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Ch04/src/Quiz_4_16.java: -------------------------------------------------------------------------------- 1 | public class Quiz_4_16 { 2 | public void showLetters(){ 3 | char letter = (char)( 65 + Math.random() * 26 + 1); 4 | System.out.print("The letter is " + letter); 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Ch01/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Ch01/.idea/artifacts/unnamed.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | $PROJECT_DIR$/out/artifacts/unnamed 4 | 5 | 6 | -------------------------------------------------------------------------------- /Ch10/src/Test.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author callmezh 3 | * 数据域问题 4 | */ 5 | public class Test { 6 | String text; 7 | 8 | public Test(String str){ 9 | //test不是上面定义的test,而是这里的构造方法的局部变量 10 | String text = str; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Ch11/src/Quiz_11_14_Combination.java: -------------------------------------------------------------------------------- 1 | import java.util.ArrayList; 2 | 3 | public class Quiz_11_14_Combination { 4 | public static ArrayList union(ArrayList list1, ArrayList list2){ 5 | list2.addAll(list1); 6 | return list2; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Ch01/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Ch02/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Ch03/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Ch04/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Ch05/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Ch06/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Ch07/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Ch08/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Ch09/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Ch10/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Ch11/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Ch12/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Ch01/src/quiz_1_3.java: -------------------------------------------------------------------------------- 1 | public class quiz_1_3 { 2 | public static void StringTable(){ 3 | System.out.println("i i^2 i^3"); 4 | for(int i = 1; i < 5; i++){ 5 | System.out.println( i + " " + i*i + " " + i*i*i ); 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Ch11/src/Quiz_11_2_Staff.java: -------------------------------------------------------------------------------- 1 | public class Quiz_11_2_Staff extends Quiz_11_2_Employer { 2 | String postionTitle; 3 | 4 | Quiz_11_2_Staff(){ 5 | 6 | } 7 | 8 | @Override 9 | public String toString(){ 10 | return "Staff's title is " + postionTitle; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Ch11/src/ClassA.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author callmezh 3 | * 动态绑定 4 | */ 5 | public class ClassA { 6 | int i = 7; 7 | ClassA(){ 8 | setI(20); 9 | System.out.println("I from A is " + i); 10 | } 11 | 12 | public void setI(int i) { 13 | this.i = 2 * i; 14 | } 15 | } -------------------------------------------------------------------------------- /Ch05/src/com/company/ChangKG2B.java: -------------------------------------------------------------------------------- 1 | package com.company; 2 | 3 | public class ChangKG2B { 4 | public void chang(){ 5 | System.out.println(" 千克 磅"); 6 | for (int i = 1; i < 200; i++){ 7 | System.out.printf("%3d %.1f\n", i, (i * 2.2)); 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Ch03/src/DoubleEquivalence.java: -------------------------------------------------------------------------------- 1 | public class DoubleEquivalence { 2 | static final double EPSILON = 1E-14; 3 | public static void compareDouble(){ 4 | double x = 1 - 0.1 - 0.1 - 0.1 - 0.1 - 0.1; 5 | if (Math.abs(x - 0.5) < EPSILON){ 6 | System.out.print( x + " is approximately 0.5"); 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Ch06/src/Quiz_6_4.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | class Quiz_6_4 { 4 | void showPalindrome(){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("Enter the number: "); 7 | String num = input.nextLine(); 8 | System.out.printf("it's palindrome is %s", Quiz_5_3.reverse(num)); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Ch04/src/TestPrintf.java: -------------------------------------------------------------------------------- 1 | public class TestPrintf { 2 | public void text(){ 3 | boolean b = true; 4 | double amount = 1234.456; 5 | double rate = 0.1; 6 | double interest = amount* rate; 7 | System.out.println(interest); 8 | System.out.printf("%e %s %b", interest, "java is the best", b); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Ch11/src/Quiz_11_2_Employer.java: -------------------------------------------------------------------------------- 1 | import java.util.Date; 2 | 3 | public class Quiz_11_2_Employer extends Quiz_11_2_Person{ 4 | String workPlace; 5 | double salary; 6 | Date employeDate; 7 | 8 | Quiz_11_2_Employer(){ 9 | 10 | } 11 | 12 | @Override 13 | public String toString(){ 14 | return "Employee"; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Ch01/src/quiz_1_7.java: -------------------------------------------------------------------------------- 1 | public class quiz_1_7 { 2 | public static double practicePI(int n){ 3 | if (n==1){ 4 | System.out.println("请输入大于0的整数"); 5 | return 1; 6 | }else { 7 | System.out.println("no problem"); 8 | return practicePI(n - 2) + (Math.pow(-1, (n + 1) / 2 + 1) * (1.0 / n)); 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | *.jar 15 | *.war 16 | *.nar 17 | *.ear 18 | *.zip 19 | *.tar.gz 20 | *.rar 21 | 22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 23 | hs_err_pid* 24 | -------------------------------------------------------------------------------- /Ch05/src/com/company/Quiz_5_15.java: -------------------------------------------------------------------------------- 1 | package com.company; 2 | 3 | public class Quiz_5_15 { 4 | public void printACSII(){ 5 | for (int i = (int)'!'; i <= (int)'~'; i++){ 6 | if ((i - '!' + 1) % 10 == 0){ 7 | System.out.printf("%3c\n", (char)i); 8 | }else 9 | System.out.printf("%3c", (char)i); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Ch04/src/Quiz_4_20.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Quiz_4_20 { 4 | public void showLetters(){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.printf("Enter a string: "); 7 | String str = input.nextLine(); 8 | 9 | System.out.printf("%s's length is %d, its first letter is %c", str, str.length(), str.charAt(0)); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Ch04/src/Quiz_4_25.java: -------------------------------------------------------------------------------- 1 | public class Quiz_4_25 { 2 | public void showNum(){ 3 | char[]letter = new char[3]; 4 | for (int i = 0; i < 3; i++){ 5 | letter[i] = (char)(65 + Math.random() * 26 + 1); 6 | } 7 | int num = (int)(1000 + Math.random() * 8999 + 1); 8 | System.out.print("The result is " + letter[0] + letter[1] + letter[2] + num); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Ch11/src/ClassB.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author callmezh 3 | * 动态绑定 4 | */ 5 | public class ClassB extends ClassA { 6 | /** 7 | * ClassB 首先隐式调用 父类无参构造方法,在父类构造方法中调用重写后的setI方法 8 | * 动态绑定,先从本类中调用方法 9 | */ 10 | public ClassB(){ 11 | System.out.println("I from B is " + i) ; 12 | } 13 | 14 | @Override 15 | public void setI(int i){ 16 | this.i = 3 * i; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Ch07/src/Quiz_7_7.java: -------------------------------------------------------------------------------- 1 | import java.util.Arrays; 2 | 3 | public class Quiz_7_7 { 4 | void printRandomNum(){ 5 | int[] count = new int[10]; 6 | for (int i = 0; i < 100; i++){ 7 | count[createNum()]++; 8 | } 9 | 10 | System.out.print(Arrays.toString(count)); 11 | } 12 | 13 | static int createNum(){ 14 | return (int)(Math.random() * 10); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Ch12/src/TestFileClass.java: -------------------------------------------------------------------------------- 1 | import java.io.File; 2 | 3 | public class TestFileClass { 4 | static void printResult(){ 5 | File file = new File("C:\\Users\\callmezh\\Desktop\\ae.jpg"); 6 | System.out.println("Does it exits? " + file.exists()); 7 | System.out.printf("The file has %d bytes\n", file.length()); 8 | System.out.println("Absolute path is " + file.getAbsolutePath()); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Ch06/src/TestMethod.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | class TestMethod { 4 | void testMethod() { 5 | System.out.print("Java is the best language in the world!"); 6 | Scanner inpiut = new Scanner(System.in); 7 | int i = inpiut.nextInt(); 8 | if (i >= 10) { 9 | System.out.print("no"); 10 | if (i >= 100){ 11 | return; 12 | } 13 | } }} 14 | 15 | -------------------------------------------------------------------------------- /Ch05/src/com/company/Quiz_5_46.java: -------------------------------------------------------------------------------- 1 | package com.company; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Quiz_5_46 { 6 | void invertedString(){ 7 | Scanner input = new Scanner(System.in); 8 | System.out.print("Enter a string: "); 9 | String str = input.nextLine(); 10 | 11 | for (int i = str.length() - 1; i >= 0; i--){ 12 | System.out.print(str.charAt(i)); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Ch07/src/InputInteger.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class InputInteger { 4 | static int[] getArray(int num){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.printf("Enter %d integer: ", num); 7 | int[] array = new int[num]; 8 | 9 | for (int i = 0; i < array.length; i++){ 10 | array[i] = input.nextInt(); 11 | } 12 | 13 | return array; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Ch01/src/quiz_1_6.java: -------------------------------------------------------------------------------- 1 | public class quiz_1_6 { 2 | public static int sumNum(int n) { 3 | /** 4 | * 利用sum保存中间结果 5 | */ 6 | // int sum = 0; 7 | // for (int i = 0; i < n + 1; i++){ 8 | // sum +=i; 9 | // } 10 | // return sum; 11 | /** 12 | * 递归实现 13 | */ 14 | if (n == 0){ 15 | return 0; 16 | }else 17 | return sumNum(n - 1) + n; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /Ch07/src/VarArgsDemo.java: -------------------------------------------------------------------------------- 1 | public class VarArgsDemo { 2 | void printResult(){ 3 | int[] num = printList(1,3,3); 4 | for (int i = 0; i <= num.length - 1; i++){ 5 | System.out.print(num[i]); 6 | } 7 | 8 | } 9 | 10 | static int[] printList(int... num){ 11 | 12 | // for (int i = 0; i <= 10; i++){ 13 | // num[i] = (int)(Math.random() * 10); 14 | // } 15 | 16 | return num; 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /Ch07/src/ArrayCopyMethod.java: -------------------------------------------------------------------------------- 1 | public class ArrayCopyMethod { 2 | void printResult(){ 3 | arrayCopySystemMothod(); 4 | } 5 | 6 | static void arrayCopySystemMothod(){ 7 | int [] srcArray = {1, 2, 3, 4 , 5, 6}; 8 | int [] targetArray = new int[6]; 9 | 10 | System.arraycopy(srcArray, 0, targetArray, 0, 3); 11 | for (int i = 0; i < 6; i++){ 12 | System.out.print(targetArray[i]); 13 | } 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Ch01/Ch01.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Ch02/Ch02.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Ch02/src/SalesTax.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class SalesTax { 4 | public static void practiceTax() { 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("请输入营业额(¥):"); 7 | double amountOfsales = input.nextDouble(); 8 | double tax; 9 | final double RATE_OF_TAX = 0.006; 10 | tax = (int)(amountOfsales * RATE_OF_TAX * 1000) / 1000.0; 11 | System.out.print("所缴营业税为:" + tax + "¥"); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Ch03/Ch03.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Ch04/Ch04.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Ch05/Ch05.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Ch05/src/com/company/Cost.java: -------------------------------------------------------------------------------- 1 | package com.company; 2 | 3 | public class Cost { 4 | double price; 5 | double amount; 6 | 7 | public void setPrice(double price) { 8 | this.price = price; 9 | } 10 | 11 | public void setAmount(double amount) { 12 | this.amount = amount; 13 | } 14 | 15 | public double getPrice() { 16 | return price; 17 | } 18 | 19 | public double getAmount() { 20 | return amount; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Ch06/Ch06.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Ch07/Ch07.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Ch08/Ch08.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Ch09/Ch09.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Ch09/src/Quiz_9_4_Random.java: -------------------------------------------------------------------------------- 1 | import java.util.Random; 2 | 3 | /** 4 | * @author callmezh 5 | * Random类 6 | */ 7 | public class Quiz_9_4_Random { 8 | /** 9 | * 产生范围在0 - 100 的 50 个随机数 10 | */ 11 | void printRandom(){ 12 | Random myRandom = new Random(); 13 | myRandom.setSeed(1000); 14 | int count = 50; 15 | for (int i = 0; i <= count; i++){ 16 | System.out.println(myRandom.nextInt(100)); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Ch10/Ch10.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Ch11/Ch11.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Ch12/Ch12.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Ch05/src/com/company/Quiz_5_23.java: -------------------------------------------------------------------------------- 1 | package com.company; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Quiz_5_23 { 6 | public void sum(){ 7 | Scanner input = new Scanner(System.in); 8 | System.out.print("Enter the number: "); 9 | double num = input.nextDouble(); 10 | double sum = 0; 11 | for (; num >= 1; num -= 1){ 12 | sum += (1 / num); 13 | } 14 | System.out.printf("The sum is %f", sum); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Ch03/src/Quiz_3_14.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Quiz_3_14 { 4 | public static void guessCoin(){ 5 | int coin = 0; 6 | if (Math.random() >=0.5){ 7 | coin = 1; 8 | } 9 | Scanner input = new Scanner(System.in); 10 | System.out.print("请输入数字 0 或 1 :"); 11 | if (input.nextInt() == coin){ 12 | System.out.print("恭喜你猜对了!"); 13 | }else 14 | System.out.print("猜错了,不要灰心,再试一次!"); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Ch05/src/com/company/Quiz_5_37.java: -------------------------------------------------------------------------------- 1 | package com.company; 2 | 3 | import java.util.Scanner; 4 | 5 | class Quiz_5_37 { 6 | void D2B(){ 7 | Scanner input = new Scanner(System.in); 8 | System.out.print("Enter a d number: "); 9 | int dNum = input.nextInt(); 10 | String bNum = ""; 11 | do { 12 | bNum = dNum % 2 + bNum; 13 | dNum /= 2; 14 | }while (dNum != 0); 15 | System.out.printf("The result is %s", bNum); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Ch11/src/Quiz_11_2_Faculty.java: -------------------------------------------------------------------------------- 1 | public class Quiz_11_2_Faculty extends Quiz_11_2_Employer{ 2 | private static int LECTURER = 1; 3 | private static int ASSISTANT_PROFESSOR = 2; 4 | private static int ASSOCIATE_PROFESSOR = 3; 5 | private static int PROFESSOR = 4; 6 | 7 | private double workTime = 8; 8 | private int rank; 9 | 10 | Quiz_11_2_Faculty(){ 11 | 12 | } 13 | 14 | @Override 15 | public String toString() { 16 | return "Faculty"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Ch05/src/com/company/Quiz_5_24.java: -------------------------------------------------------------------------------- 1 | package com.company; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Quiz_5_24 { 6 | public void computeSum(){ 7 | double sum = 0; 8 | Scanner input = new Scanner(System.in); 9 | System.out.print("Enter a number: "); 10 | int num = input.nextInt(); 11 | for (int i = 3; i <= num; i += 2){ 12 | sum += (double)(i - 2) / i; 13 | } 14 | System.out.printf("The sum is %.8f", sum); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Ch05/src/com/company/Quiz_5_35.java: -------------------------------------------------------------------------------- 1 | package com.company; 2 | 3 | import java.util.Scanner; 4 | 5 | class Quiz_5_35 { 6 | void sum(){ 7 | double sum = 0; 8 | Scanner input = new Scanner(System.in); 9 | System.out.print("Enter the number: "); 10 | int n = input.nextInt(); 11 | for (int i = 1; i <= n; i++){ 12 | sum += (double) 1 / (Math.sqrt(i) + Math.sqrt(i + 1)); 13 | } 14 | System.out.printf("The result is %f", sum); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Ch11/src/Quiz_11_2_Person.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author callmezh 3 | * person类,定义基本属性 4 | */ 5 | public class Quiz_11_2_Person { 6 | String name; 7 | String address; 8 | String phoneNum; 9 | String emailAddress; 10 | 11 | Quiz_11_2_Person(){ 12 | 13 | } 14 | 15 | @Override 16 | public String toString(){ 17 | return "Person's name: " + name + " address: " + address + " phoneNum: " 18 | + phoneNum + " email address: " + emailAddress; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /Ch05/src/com/company/Quiz_5_38.java: -------------------------------------------------------------------------------- 1 | package com.company; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Quiz_5_38 { 6 | void D2E(){ 7 | Scanner input = new Scanner(System.in); 8 | System.out.print("Enter a d number: "); 9 | int dNum = input.nextInt(); 10 | String bNum = ""; 11 | do { 12 | bNum = dNum % 8 + bNum; 13 | dNum /= 8; 14 | }while (dNum != 0); 15 | System.out.printf("The result is %s", bNum); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Ch05/src/com/company/Quiz_5_8_Student.java: -------------------------------------------------------------------------------- 1 | package com.company; 2 | 3 | public class Quiz_5_8_Student { 4 | private String name; 5 | private double grade; 6 | 7 | public void setName(String name) { 8 | this.name = name; 9 | } 10 | 11 | public void setGrade(double grade) { 12 | this.grade = grade; 13 | } 14 | 15 | public String getName() { 16 | return name; 17 | } 18 | 19 | public double getGrade() { 20 | return grade; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /Ch04/src/Quiz_4_1.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Quiz_4_1 { 4 | public void computeCover(){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("Enter the length from the center to a vertex: "); 7 | double length = input.nextDouble(); 8 | 9 | double s = 2 * length * Math.sin(Math.PI / 5); 10 | double cover = 5 * s * s / (4 * Math.tan(Math.PI /5)); 11 | System.out.printf("The area of the pentagon is %2.2f", cover); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Ch11/src/Quiz_11_3_MaxOfArraylist.java: -------------------------------------------------------------------------------- 1 | import java.util.ArrayList; 2 | import java.util.Random; 3 | 4 | public class Quiz_11_3_MaxOfArraylist { 5 | public static void printResult(){ 6 | Random random = new Random(); 7 | ArrayList list = new ArrayList<>(); 8 | int sizeOfList = 10; 9 | for (int i = 0; i < sizeOfList; i++){ 10 | list.add(i, random.nextInt()); 11 | } 12 | System.out.print(java.util.Collections.max(list)); 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Ch05/src/com/company/Quiz_5_25.java: -------------------------------------------------------------------------------- 1 | package com.company; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Quiz_5_25 { 6 | public void computePI(){ 7 | double PI = 0; 8 | Scanner input = new Scanner(System.in); 9 | System.out.print("Enter a number: "); 10 | int num = input.nextInt(); 11 | for (; num > 0; num -= 1){ 12 | PI += 4 * Math.pow(-1, num + 1) / (double)(2 * num - 1); 13 | } 14 | System.out.printf("PI is %.20f", PI); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Ch01/src/quiz_1_11.java: -------------------------------------------------------------------------------- 1 | import java.text.DecimalFormat; 2 | 3 | public class quiz_1_11 { 4 | public static String PeopleNum(int year){ 5 | final int STATE_PEOPLE_NUM = 312032486; 6 | final int SECOND_OF_YEAR = 365 * 24 * 60 * 60; 7 | int peopleNum = STATE_PEOPLE_NUM + year * SECOND_OF_YEAR / 5 + year * SECOND_OF_YEAR / 45; 8 | DecimalFormat addDecFormat = new DecimalFormat(); 9 | addDecFormat.applyPattern("#,###"); 10 | return addDecFormat.format(peopleNum); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Ch01/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Ch02/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Ch03/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Ch04/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Ch05/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Ch06/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Ch06/src/TestRandomCharacter.java: -------------------------------------------------------------------------------- 1 | public class TestRandomCharacter { 2 | void test() { 3 | final int NUM_OF_CHARS = 175; 4 | final int CHARS_PER_LINE = 5; 5 | 6 | for (int i = 1; i <= NUM_OF_CHARS; i++) { 7 | char ch = RandomCharacter.getRandomUpperCaseLetter(); 8 | if (i % CHARS_PER_LINE == 0) { 9 | System.out.println(ch); 10 | } else 11 | System.out.print(ch); 12 | } 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /Ch07/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Ch07/src/ReturnArrary.java: -------------------------------------------------------------------------------- 1 | public class ReturnArrary { 2 | void printResult(){ 3 | int[] list = {1,2,2,3,5}; 4 | 5 | for (int e: reverse(list)) { 6 | System.out.print(e); 7 | } 8 | } 9 | 10 | //翻转数组元素 11 | static int[] reverse(int[] list){ 12 | int[] result = new int[list.length]; 13 | 14 | for (int i = 0, j = result.length - 1; i <= list.length - 1; i++, j--){ 15 | result[j] = list[i]; 16 | } 17 | 18 | return result; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Ch08/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Ch09/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Ch10/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Ch11/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Ch12/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Ch03/src/Quiz_3_8.java: -------------------------------------------------------------------------------- 1 | import java.lang.reflect.Array; 2 | import java.util.Arrays; 3 | import java.util.Scanner; 4 | 5 | public class Quiz_3_8 { 6 | public static void sort(){ 7 | Scanner input = new Scanner(System.in); 8 | double[] num = new double[3]; 9 | for (int i = 0; i < 3; i++) { 10 | System.out.print("请输入第" + (i + 1) + "个整数:"); 11 | num[i] = input.nextDouble(); 12 | } 13 | Arrays.sort(num); 14 | for (int i = 0; i < 3; i++){ 15 | System.out.println(num[i]); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /Ch06/src/Quiz_6_29.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Quiz_6_29 { 4 | void printDoublePrime(){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("Enter a number:"); 7 | int num = input.nextInt(); 8 | 9 | int i = 2; 10 | while (i <= num){ 11 | if(PrimeNumMethod.isPrimeNum(i) && PrimeNumMethod.isPrimeNum(i + 2)){ 12 | System.out.printf("(%d, %d)\n", i, i + 2); 13 | } 14 | i++; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Ch04/src/Quiz_4_8.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Quiz_4_8 { 4 | public void showASCII(){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("Enter an ASCII code: "); 7 | byte code = input.nextByte(); 8 | if (code >=0 && code <= 127){ 9 | char ch = (char)code; 10 | System.out.printf("The character for ASCII code %d is %c", code, ch); 11 | }else 12 | System.out.print("Please enter a ASCII code between 0 to 127!"); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Ch12/src/InvalidRadiusException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author callmezh 3 | */ 4 | public class InvalidRadiusException extends Exception{ 5 | private double radius; 6 | 7 | /** 8 | * Construct an exception 9 | */ 10 | public InvalidRadiusException(double radius){ 11 | //调用Exception父类有参构造方法 12 | super("Invalid radius" + radius); 13 | this.radius = radius; 14 | } 15 | 16 | /** 17 | * Return the radius 18 | */ 19 | public double getRadius(){ 20 | return radius; 21 | } 22 | } -------------------------------------------------------------------------------- /Ch11/src/Quiz_11_13_Remove.java: -------------------------------------------------------------------------------- 1 | import java.util.ArrayList; 2 | 3 | public class Quiz_11_13_Remove { 4 | public static void removeDuplicate(ArrayList list){ 5 | for (int i = 0; i < list.size(); i++){ 6 | for (int j = i + 1; j < list.size(); j++){ 7 | if (list.get(i).equals(list.get(j))){ 8 | list.remove(i); 9 | //下一次继续从i开始排查 10 | i--; 11 | break; 12 | } 13 | } 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Ch05/src/com/company/Quiz_5_48.java: -------------------------------------------------------------------------------- 1 | package com.company; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Quiz_5_48 { 6 | void showOddChart(){ 7 | Scanner input = new Scanner(System.in); 8 | System.out.print("Enter a string: "); 9 | String str = input.next(); 10 | 11 | for (int i = 0; i <= str.length() - 1; i++){ 12 | if ((i + 1) % 2 != 0){ 13 | System.out.printf("%s", str.charAt(i)); 14 | } 15 | } 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /Ch06/src/Quiz_6_32.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Quiz_6_32 { 4 | void printResult(){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("Enter the times: "); 7 | int n = input.nextInt(); 8 | int countWin = 0; 9 | for (int i = 1; i <= n; i++){ 10 | if (Quiz_6_30.printCrapsResult()){ 11 | countWin++; 12 | } 13 | } 14 | 15 | System.out.printf("Win times are %d, lose times are %d", countWin, n - countWin); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Ch12/src/Quiz_12_4_IllArgumentException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author callmezh 3 | * 自定义异常类 4 | * 仅仅只对构造方法进行了实现,显示调用父类构造方法对子类构造方法进行扩展 5 | */ 6 | public class Quiz_12_4_IllArgumentException extends Exception { 7 | // double amount; 8 | // double rate; 9 | 10 | Quiz_12_4_IllArgumentException(){ 11 | 12 | } 13 | 14 | Quiz_12_4_IllArgumentException(double amount, double rate){ 15 | super("Invalid amount: " + amount + "\nInvalid rate: " + rate); 16 | // this.amount = amount; 17 | // this.rate = rate; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /Ch05/src/com/company/Quiz_5_44.java: -------------------------------------------------------------------------------- 1 | package com.company; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Quiz_5_44 { 6 | void show0x(){ 7 | Scanner input = new Scanner(System.in); 8 | System.out.print("Enter an integer: "); 9 | int value = input.nextInt(); 10 | 11 | System.out.print("The 16 bits are "); 12 | int mask = 1; 13 | for (int i = 15; i >= 0; i--) { 14 | int temp = value >> i; 15 | int bit = temp & mask; 16 | System.out.print(bit); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Ch11/src/Quiz_11_2_Student.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author callmezh 3 | * student类 4 | */ 5 | public class Quiz_11_2_Student extends Quiz_11_2_Person { 6 | public static int FRESHMAN = 1; 7 | public static int SOPHOMORE = 2; 8 | public static int SENIOR = 3; 9 | 10 | private int state; 11 | 12 | Quiz_11_2_Student(){ 13 | 14 | } 15 | 16 | Quiz_11_2_Student(int state){ 17 | this.state = state; 18 | } 19 | 20 | @Override 21 | public String toString(){ 22 | return "Student's name: " + name + " state " + state; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Ch05/src/com/company/SentinelVaiue.java: -------------------------------------------------------------------------------- 1 | package com.company; 2 | 3 | import java.util.Scanner; 4 | 5 | public class SentinelVaiue { 6 | public void sentinelValue(){ 7 | Scanner input = new Scanner(System.in); 8 | System.out.print("Enter a number: "); 9 | int num = input.nextInt(); 10 | 11 | int sum = 0; 12 | while (num != 0){ 13 | sum += num; 14 | System.out.print("Enter a number: "); 15 | num = input.nextInt(); 16 | } 17 | System.out.printf("The addition is %d", sum); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Ch09/src/Quiz_9_3_Date.java: -------------------------------------------------------------------------------- 1 | import java.util.Date; 2 | 3 | /** 4 | * @author callmezh 5 | * 用户自定义时间 6 | */ 7 | public class Quiz_9_3_Date { 8 | /** 9 | * 调用date.setDate(time)方法设定时间 10 | */ 11 | void printDate(){ 12 | Date date = new Date(); 13 | 14 | int count = 1; 15 | long time = 10000; 16 | final int countBound = 8; 17 | while (count <= countBound){ 18 | date.setTime(time); 19 | System.out.println(date.toString()); 20 | count++; 21 | time *= 10; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Ch03/src/AdditionQuiz.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class AdditionQuiz { 4 | public static void addition(){ 5 | double num1 = System.currentTimeMillis() % 2; 6 | double num2 = System.currentTimeMillis() % 7; 7 | System.out.print(num1 + "+" + num2 + " = "); 8 | Scanner input = new Scanner(System.in); 9 | double result = input.nextDouble(); 10 | if(num1 + num2 == result){ 11 | System.out.print ("The answer is correct"); 12 | }else 13 | System.out.print ("The answer is incorrect"); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Ch11/src/Quiz_11_8_Account.java: -------------------------------------------------------------------------------- 1 | public class Quiz_11_8_Account { 2 | double rate; 3 | String name; 4 | int id; 5 | double cost; 6 | double store; 7 | Quiz_11_Transaction transaction; 8 | 9 | Quiz_11_8_Account(){ 10 | 11 | } 12 | 13 | Quiz_11_8_Account(String name, int id, double cost, double store, double rate, Quiz_11_Transaction transaction){ 14 | this.name = name; 15 | this.cost = cost; 16 | this.id = id; 17 | this.store = store; 18 | this.rate = rate; 19 | this.transaction = transaction; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Ch04/src/Quiz_4_5.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | import static java.lang.StrictMath.tan; 4 | 5 | public class Quiz_4_5 { 6 | public void computeCover(){ 7 | Scanner input = new Scanner(System.in); 8 | System.out.print("Enter the number of sides: "); 9 | int numOfSide = input.nextInt(); 10 | System.out.print("Enter the side: "); 11 | double side = input.nextDouble(); 12 | 13 | double cover = numOfSide * side * side / (4 * tan(Math.PI / numOfSide)); 14 | System.out.printf("The area of the polygon is %2.4f", cover); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Ch04/src/Quiz_4_9.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Quiz_4_9 { 4 | public void showUnicode(){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("Enter a character: "); 7 | String str = input.nextLine(); 8 | 9 | if (str.length() != 1){ 10 | System.out.print("You must enter exactly one character1"); 11 | System.exit(1); 12 | } 13 | 14 | char ch = str.charAt(0); 15 | int unicode = ch; 16 | System.out.printf("The Unicode for the character %c is %d", ch, unicode); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Ch10/src/LargeFactorial.java: -------------------------------------------------------------------------------- 1 | import java.math.BigInteger; 2 | 3 | /** 4 | * @author callmezh 5 | * 阶乘 6 | */ 7 | class LargeFactorial { 8 | void printResult(){ 9 | System.out.println("50! = " + factorial(50)); 10 | } 11 | 12 | /** 13 | * for循环实现阶乘 14 | * @param num 15 | * @return 16 | */ 17 | private static BigInteger factorial(int num){ 18 | BigInteger result = BigInteger.ONE; 19 | for (int i = 1; i < num; i++){ 20 | result = result.multiply(new BigInteger(i + "")); 21 | } 22 | return result; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Ch05/src/com/company/Quiz_5_16.java: -------------------------------------------------------------------------------- 1 | package com.company; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Quiz_5_16 { 6 | public void computeFactor(){ 7 | Scanner input = new Scanner(System.in); 8 | System.out.printf("Enter a integer: "); 9 | int num = input.nextInt(); 10 | 11 | System.out.printf("The %d's factors are ", num); 12 | for (int k = 2; k <= num; ){ 13 | if (num % k == 0){ 14 | num /= k; 15 | System.out.printf(" %d", k); 16 | }else 17 | k++; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Ch07/src/Quiz_7_34.java: -------------------------------------------------------------------------------- 1 | import java.util.Arrays; 2 | import java.util.Scanner; 3 | 4 | public class Quiz_7_34 { 5 | void printSortString(){ 6 | Scanner input = new Scanner(System.in); 7 | System.out.print("Enter a string: "); 8 | String str = input.nextLine(); 9 | String[] strCharArray = new String[str.length()]; 10 | for (int i =0; i < str.length(); i++){ 11 | strCharArray[i] = String.valueOf(str.charAt(i)); 12 | } 13 | 14 | Arrays.sort(strCharArray); 15 | System.out.print(Arrays.toString(strCharArray)); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Ch05/src/com/company/Quiz_5_26.java: -------------------------------------------------------------------------------- 1 | package com.company; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Quiz_5_26 { 6 | public void computeE(){ 7 | Scanner input = new Scanner(System.in); 8 | System.out.print("Enter the number: "); 9 | int num = input.nextInt(); 10 | double sum = 0; 11 | for (; num > 0; num -= 1){ 12 | double n = 1; 13 | for (int i = num; i > 0; i -= 1){ 14 | n *= i; 15 | } 16 | sum += 1 / n; 17 | } 18 | System.out.printf("The sum is %f", sum); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Ch05/src/com/company/Quiz_5_50.java: -------------------------------------------------------------------------------- 1 | package com.company; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Quiz_5_50 { 6 | void capitalCount(){ 7 | Scanner input = new Scanner(System.in); 8 | System.out.print("Enter a string: "); 9 | String str = input.nextLine(); 10 | int count = 0; 11 | 12 | for (int i = 0; i <= str.length() - 1; i++){ 13 | if (str.charAt(i) >= 'A' && str.charAt(i) <= 'Z'){ 14 | count++; 15 | } 16 | } 17 | System.out.printf("The number of uppercase letters is %d", count); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Ch05/src/com/company/Quiz_5_10.java: -------------------------------------------------------------------------------- 1 | package com.company; 2 | 3 | class Quiz_5_10 { 4 | void findNum(){ 5 | int count = 0; 6 | for (int k = 100; k <= 1000; k++){ 7 | boolean isGoodNum = false; 8 | if ((k % 5 == 0) && (k % 6 == 0)){ 9 | isGoodNum = true; 10 | } 11 | if (isGoodNum){ 12 | count++; 13 | if (count % 5 == 0){ 14 | System.out.printf("%5d\n", k); 15 | }else 16 | System.out.printf("%5d", k); 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Ch06/src/Quiz_5_2.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Quiz_5_2 { 4 | void sum(){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("Enter an integer: "); 7 | int num = input.nextInt(); 8 | 9 | System.out.printf("The sum is %d", sumDigits(num)); 10 | } 11 | 12 | private static int sumDigits(int n){ 13 | int sum = 0; 14 | int temp = n; 15 | while (temp != 0){ 16 | int remainder = temp % 10; 17 | sum += remainder; 18 | temp /= 10; 19 | } 20 | return sum; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Ch04/src/Quiz_4_11.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Quiz_4_11 { 4 | public void showHex(){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("Enter a decimal value (0 to 15): "); 7 | byte dec = input.nextByte(); 8 | 9 | if (dec >=0 && dec <= 9){ 10 | System.out.print("The hex value is " + dec); 11 | }else if (dec >=10 && dec <= 15){ 12 | char ch = (char)(55 + dec); 13 | System.out.print("The hex value is " + ch); 14 | }else 15 | System.out.print( dec + " is an invalid input!"); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Ch06/src/Quiz_6_28.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Quiz_6_28 { 4 | void printMSPrimeNum(){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("Enter a number: "); 7 | int num = input.nextInt(); 8 | 9 | System.out.print("P 2^P - 1\n"); 10 | int i = 2; 11 | //大于等于2,因为这样可以直接排除1的可能性 12 | while (i <= num){ 13 | if (PrimeNumMethod.isPrimeNum(i) && Math.sqrt(i + 1) % 1 == 0){ 14 | System.out.printf("%.0f %4d\n", Math.sqrt(i + 1), i); 15 | } 16 | i++; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Ch05/src/com/company/Quiz_5_33.java: -------------------------------------------------------------------------------- 1 | package com.company; 2 | 3 | public class Quiz_5_33 { 4 | public void findNum(){ 5 | int resultNum = 6; 6 | System.out.print("result number is "); 7 | while (resultNum <= 10000){ 8 | int temp = 1; 9 | for (int i = 2; i <= resultNum / 2; i++){ 10 | if (resultNum % i == 0){ 11 | temp += i; 12 | } 13 | } 14 | if (temp == resultNum){ 15 | System.out.printf("%6d", resultNum); 16 | } 17 | resultNum++; 18 | } 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Ch03/src/Quiz_3_23.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Quiz_3_23 { 4 | public static void checkPoint(){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("Enter a point with two coordinates: "); 7 | double point_x = input.nextDouble(); 8 | double point_y = input.nextDouble(); 9 | if (Math.abs(point_x) > 5 || Math.abs(point_y) > 2.5){ 10 | System.out.print("Point (" + point_x + "," + point_y + ") is not in the rectangle"); 11 | }else 12 | System.out.print("Point (" + point_x + "," + point_y + ") is in the rectangle"); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Ch07/src/Quiz_7_23.java: -------------------------------------------------------------------------------- 1 | public class Quiz_7_23 { 2 | void PrintOpen(){ 3 | boolean[] isOpen = new boolean[100]; 4 | openCloseDoor(isOpen); 5 | for (int i = 0; i < isOpen.length; i++){ 6 | if (isOpen[i]){ 7 | System.out.print(i + 1 + " is open\n"); 8 | } 9 | } 10 | } 11 | 12 | static void openCloseDoor(boolean[] isOpen){ 13 | for (int i = 1; i <= 100; i++){ 14 | for (int j = i - 1; j < isOpen.length; j = j + (i - 1)){ 15 | isOpen[j] = !isOpen[j]; 16 | j++; 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Ch03/src/Quiz_3_19.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Quiz_3_19 { 4 | public static void computeSingel(){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("请输入三角形的三条边:"); 7 | double line1 = input.nextDouble(); 8 | double line2 = input.nextDouble(); 9 | double line3 = input.nextDouble(); 10 | if (line1 + line2 <= line3 11 | || line1 + line3 <= line2 12 | || line2 + line3 <= line1){ 13 | System.out.print("所输入的三条边无法构成三角形!"); 14 | }else 15 | System.out.print("周长为:" +(line1 + line2 + line3)); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Ch06/src/Quiz_6_1.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Quiz_6_1 { 4 | void printPentagonalNum(){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("Enter the number of pentagonal: "); 7 | int num = input.nextInt(); 8 | 9 | for (int i = 1; i <= num; i++){ 10 | if (i % 10 == 0){ 11 | System.out.printf("%10d\n", getPentagonalNum(i)); 12 | }else 13 | System.out.printf("%10d", getPentagonalNum(i)); 14 | } 15 | } 16 | 17 | private int getPentagonalNum(int n){ 18 | return n * (3 * n - 1) / 2; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /Ch06/src/Quiz_6_17.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | class Quiz_6_17 { 4 | void printMatrix(){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("Enter a number: "); 7 | int num = input.nextInt(); 8 | 9 | for (int row = 1; row <= num; row++){ 10 | for (int k = 1; k <= num; k++){ 11 | double randomNum = Math.rint(Math.random()); 12 | if (k == num){ 13 | System.out.printf("%3.0f\n", randomNum); 14 | }else 15 | System.out.printf("%3.0f", randomNum); 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Ch07/src/BinarySearch.java: -------------------------------------------------------------------------------- 1 | public class BinarySearch { 2 | void printSeachResult(){ 3 | 4 | } 5 | 6 | //二分查找 7 | static int binarySearch(int[] num, int key){ 8 | int low = 0; 9 | int high = num.length - 1; 10 | 11 | while (high >= low){ 12 | int mid = (low + high) / 2; 13 | 14 | if (key < num[mid]){ 15 | high = mid - 1; 16 | }else if (key == num[mid]){ 17 | return mid; 18 | }else if (key > num[mid]){ 19 | low = mid + 1; 20 | } 21 | } 22 | return -low - 1;//low 是key可以插入的位置 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Ch08/src/Quiz_8_2.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author callmezh 3 | * 求 N X N 矩阵主对角线元素的和 4 | */ 5 | public class Quiz_8_2 { 6 | void printResult(){ 7 | int [][] array = Array.createArray(4); 8 | Array.printArray(array); 9 | System.out.printf("The sum of major diagonal is %d", sumMajorDiagonal(array)); 10 | } 11 | 12 | /** 13 | * @param array 二维数组 14 | * @return sum 对角元素和 15 | */ 16 | private static int sumMajorDiagonal(int[][] array){ 17 | int sum = 0; 18 | for (int row = 0; row < array.length; row++){ 19 | sum += array[row][row]; 20 | } 21 | return sum; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Ch02/src/Quiz_2_6.java: -------------------------------------------------------------------------------- 1 | import static java.lang.Math.random; 2 | 3 | public class Quiz_2_6 { 4 | public static void sumNum(){ 5 | int oldDum = (int) (random() * 100000); 6 | int newNum = oldDum; 7 | int tenThured = newNum / 10000; 8 | newNum %= 10000; 9 | int thured = newNum / 1000; 10 | newNum %= 1000; 11 | int hundred = newNum / 100; 12 | newNum %= 100; 13 | int ten = newNum / 10; 14 | int singel = newNum % 10; 15 | 16 | System.out.println("随机得到的数字为:" + oldDum); 17 | System.out.println("各数位相加得:" + ( tenThured + thured + hundred + ten + singel)); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Ch02/src/Quiz_2_17.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | import static java.lang.Math.pow; 4 | 5 | public class Quiz_2_17 { 6 | public static void computeTwc(){ 7 | Scanner input = new Scanner(System.in); 8 | System.out.print("请输入温度(摄氏度,范围为-58 — 41):"); 9 | double temperature = input.nextDouble(); 10 | System.out.print("请输入风速(km/h):"); 11 | double speedOfWind = input.nextDouble(); 12 | double twc = 35.74 + 0.6215 * temperature - 35.75 * pow(speedOfWind, 0.16) + 0.4275 * temperature * pow(speedOfWind ,0.16); 13 | twc = (int)(twc * 100) / 100.0; 14 | System.out.print("风寒温度为:" + twc); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Ch06/src/RandomCharacter.java: -------------------------------------------------------------------------------- 1 | public class RandomCharacter { 2 | private static char getRandomChar(char ch1, char ch2){ 3 | return (char)(ch1 + Math.random() * (ch2 - ch1) + 1); 4 | } 5 | 6 | public static char getRandomLowwerCaseLetter(){ 7 | return getRandomChar('a', 'z'); 8 | } 9 | 10 | public static char getRandomUpperCaseLetter(){ 11 | return getRandomChar('A', 'Z'); 12 | } 13 | 14 | public static char getRandomDigitCharacter(){ 15 | return getRandomChar('0', '9'); 16 | } 17 | 18 | public static char getRandomCharacter(){ 19 | return getRandomChar('\u0000', '\uFFFF'); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Ch09/src/Quiz_9_6_StopWatch.java: -------------------------------------------------------------------------------- 1 | public class Quiz_9_6_StopWatch { 2 | private long startTime; 3 | private long endTime; 4 | 5 | Quiz_9_6_StopWatch(){ 6 | startTime = System.currentTimeMillis(); 7 | } 8 | 9 | void startTime(){ 10 | startTime = System.currentTimeMillis(); 11 | } 12 | 13 | void endTime(){ 14 | endTime = System.currentTimeMillis(); 15 | } 16 | 17 | long getElapsedTime(){ 18 | return endTime - startTime; 19 | } 20 | 21 | public long getStartTime() { 22 | return startTime; 23 | } 24 | 25 | public long getEndTime() { 26 | return endTime; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Ch01/src/quiz_1_10.java: -------------------------------------------------------------------------------- 1 | public class quiz_1_10 { 2 | public static double practiceSpeedPerHour(String time, double length){ 3 | double speed; 4 | String[] hour_min_sec = time.split(":|:"); //字符串分割符后面不能加空格,加了空格表示分割依据中包含空格 5 | double[] times = new double[3]; 6 | // for (String element :hour_min_sec) { 7 | // double times = Double.parseDouble(element); 8 | // System.out.println(times); 9 | // } 10 | for (int i = 0; i < 3; i++){ 11 | times[i] = Double.parseDouble(hour_min_sec[i]); 12 | } 13 | speed = length / (times[0] + times[1]/60 + times[2]/3600); 14 | return speed; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Ch07/src/Quiz_7_2.java: -------------------------------------------------------------------------------- 1 | 2 | import java.util.Arrays; 3 | import java.util.Scanner; 4 | 5 | public class Quiz_7_2 { 6 | void rever(){ 7 | Scanner input = new Scanner(System.in); 8 | int[] num = new int[4]; 9 | for (int i = 0; i < 4; i ++){ 10 | System.out.printf("Enter the %d number: ", i); 11 | num[i] = input.nextInt(); 12 | } 13 | 14 | int[] reverNum = new int[4]; 15 | for (int i = 3, j = 0; i >= 0 && j < 4; i--, j++){ 16 | reverNum[j] = num[i]; 17 | } 18 | 19 | System.out.println(Arrays.toString(num)); 20 | System.out.print(Arrays.toString(reverNum)); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Ch06/src/Quiz_6_22.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Quiz_6_22 { 4 | void printSqrt(){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("Enter a number: "); 7 | double num = input.nextDouble(); 8 | 9 | System.out.printf("The result is %f", sqrt(num)); 10 | } 11 | 12 | double sqrt(double num){ 13 | double nextGuess = 1.0; 14 | double lastGuess; 15 | do { 16 | lastGuess = nextGuess; 17 | nextGuess = (lastGuess + num / lastGuess) / 2; 18 | } 19 | while (Math.abs(nextGuess - lastGuess) > 0.00001); 20 | 21 | return nextGuess; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Ch02/src/Quiz_2_23.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Quiz_2_23 { 4 | public static void computeCost(){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("Enter the driving distance (mile):"); 7 | double distance = input.nextDouble(); 8 | System.out.print("Enter miles per gallon:"); 9 | double milesOfGallon = input.nextDouble(); 10 | System.out.print("Enter price of per gallon($):"); 11 | double priceOfGallon = input.nextDouble(); 12 | 13 | double cost = (int)(distance / milesOfGallon * priceOfGallon * 1000) / 1000.0; 14 | System.out.print("The cost of driving is $" + cost); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Ch12/src/ChainedExceptionDemo.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author callmezh 3 | */ 4 | class ChainedExceptionDemo { 5 | void printResult() { 6 | try { 7 | method1(); 8 | } catch (Exception ex) { 9 | ex.printStackTrace(); 10 | } 11 | } 12 | 13 | private static void method1() throws Exception { 14 | try { 15 | method2(); 16 | } catch (Exception ex) { 17 | //捕获method2抛出的异常,并被包装成一个新异常 18 | throw new Exception("New information from method1", ex); 19 | } 20 | } 21 | 22 | static void method2() throws Exception{ 23 | throw new Exception("New information from method2"); 24 | } 25 | } -------------------------------------------------------------------------------- /Ch05/src/com/company/MulitplicationTable.java: -------------------------------------------------------------------------------- 1 | package com.company; 2 | 3 | public class MulitplicationTable { 4 | public void printMultiplicationTable(){ 5 | System.out.println(" Multiplication Table"); 6 | System.out.print(" "); 7 | for (int i = 1; i <= 9; i++){ 8 | System.out.printf(" " + i); 9 | } 10 | 11 | System.out.print("\n--------------------------------------------------"); 12 | for (int j = 1; j < 10; j++){ 13 | System.out.printf("\n %d | ", j); 14 | for (int i = 1; i <= j; i++){ 15 | System.out.printf("%4d", j * i); 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Ch08/src/Quiz_8_6.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 矩阵乘法 3 | * @author callmezh 4 | */ 5 | public class Quiz_8_6 { 6 | void printResult(){ 7 | int [][] arrayA = Array.createArray(2); 8 | int [][] arrayB = Array.createArray(2); 9 | Array.printArray(arrayA); 10 | Array.printArray(arrayB); 11 | int [][] result = new int[2][2]; 12 | 13 | for (int i = 0; i < arrayA.length; i++){ 14 | for (int j = 0; j < arrayA[i].length; j++){ 15 | for (int k = 0; k < result[0].length; k++){ 16 | result[i][j] += arrayA[i][k] * arrayB[k][j]; 17 | } 18 | } 19 | } 20 | Array.printArray(result); 21 | } 22 | } -------------------------------------------------------------------------------- /Ch02/src/Quiz_2_13.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Quiz_2_13 { 4 | public static void getInterest(){ 5 | double interest = 0; 6 | double allMoney = 0; 7 | Scanner input = new Scanner(System.in); 8 | System.out.print("请输入每月定投金额(¥):"); 9 | double amount = input.nextDouble(); 10 | System.out.print("请输入存期(月):"); 11 | int months = input.nextInt(); 12 | for(int i = 1; i < months + 1; i ++){ 13 | allMoney = (amount + allMoney) * 1.00417; 14 | interest = allMoney - amount * months; 15 | } 16 | System.out.print("到期得利息" + interest + "元,本金加利息共得" + (int)(allMoney * 100) / 100.0 + "元"); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Ch03/src/Quiz_3_12.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Quiz_3_12 { 4 | public static void computeNum(){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("Enter a three-digit integer :"); 7 | int oldNum = input.nextInt(); 8 | 9 | int num = oldNum; 10 | int h = num / 100; 11 | num %= 100; 12 | int t = num / 10; 13 | num %= 10; 14 | int s = num; 15 | 16 | int newNum = s * 100 + t * 10 + h * 1; 17 | if (newNum == oldNum){ 18 | System.out.print( newNum + " is a palindrome"); 19 | }else 20 | System.out.print( newNum + " is not a palindrome"); 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Ch05/src/com/company/Quiz_5_41.java: -------------------------------------------------------------------------------- 1 | package com.company; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Quiz_5_41 { 6 | void maxNumCount(){ 7 | Scanner input = new Scanner(System.in); 8 | System.out.print("Enter the number, end with 0: "); 9 | int num = input.nextInt(); 10 | int max = num; 11 | int count = 0; 12 | while (num != 0){ 13 | num = input.nextInt(); 14 | if (max >= num){ 15 | count++; 16 | }else { 17 | max = num; 18 | count = 0; 19 | } 20 | } 21 | System.out.printf("The largest number is %d, the count is %d", max, count); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Ch07/src/Quiz_7_9.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Quiz_7_9 { 4 | void printMinNum(){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("Enter 5 integer: "); 7 | int[] array = new int[5]; 8 | 9 | for (int i = 0; i < 5; i++){ 10 | array[i] = input.nextInt(); 11 | } 12 | 13 | System.out.printf("The min number is %d", min(array)); 14 | 15 | } 16 | 17 | static int min(int[] array){ 18 | int min = array[0]; 19 | for (int i = 1; i < array.length; i++){ 20 | if (min > array[i]){ 21 | min = array[i]; 22 | } 23 | } 24 | return min; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Ch04/src/FormatDemo.java: -------------------------------------------------------------------------------- 1 | public class FormatDemo { 2 | public void printTable(){ 3 | int age = 20; 4 | System.out.printf("%-10s%-10s%-10s\n", "姓名", "性别", "年龄"); 5 | System.out.printf("%-10s%-10s%-10d\n", "徐泽林", "男", 20); 6 | System.out.printf("%-10s%-10s%-10d\n", "张光军", "男", age); 7 | System.out.printf("%-10s%-10s%-10d\n", "张圣航", "男", age); 8 | System.out.printf("%-10s%-10s%-10d\n", "王悟信", "男", age); 9 | System.out.printf("%5.2f%% %5.4e\n", 32.327, 32.32); 10 | 11 | short i = 'a'; 12 | long k = 's'; 13 | int x = 0; 14 | int y = x + i; 15 | double z = k; 16 | System.out.print( "" + y + " " + z); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Ch07/src/Quiz_7_3.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Quiz_7_3 { 4 | void countNum(){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("Enter the numbers and end with 0: "); 7 | int[] count = new int[100]; 8 | int num; 9 | do { 10 | num = input.nextInt(); 11 | if (num > 0 && num <= 100){ 12 | count[num - 1]++; 13 | } 14 | }while (num != 0); 15 | 16 | for (int i = 0; i < 100; i++){ 17 | if (count[i] != 0){ 18 | System.out.printf("%d occurs %d %s\n", i + 1, count[i], (count[i] == 1 ? "time" : "times")); 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Ch05/src/com/company/Quiz_5_14.java: -------------------------------------------------------------------------------- 1 | package com.company; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Quiz_5_14 { 6 | public void computeMaxConventionNum(){ 7 | Scanner input = new Scanner(System.in); 8 | System.out.printf("Enter an integer: "); 9 | int num1 = input.nextInt(); 10 | System.out.printf("Enter another integer: "); 11 | int num2 = input.nextInt(); 12 | 13 | int min = Math.min(num1, num2); 14 | for (int k = min; k > 0; k--){ 15 | if (num1 % k == 0 && num2 % k == 0){ 16 | System.out.printf("The max number of convention is %d", k); 17 | System.exit(1); 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Ch04/src/OrderTwoCities.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class OrderTwoCities { 4 | public void orderTwoCities(){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("Enter two cities' name: "); 7 | String name1 = input.next(); 8 | String name2 = input.next(); 9 | 10 | char firstCharacterOfName1 = name1.charAt(0); 11 | char firstCharacterOfName2 = name2.charAt(0); 12 | 13 | if (firstCharacterOfName2 > firstCharacterOfName1){ 14 | System.out.println("The cities in alphabetical order are " + name1 + " " + name2); 15 | }else 16 | System.out.println("The cities in alphabetical order are " + name2 + " " + name1); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Ch04/src/Quiz_4_7.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Quiz_4_7 { 4 | public void showCoordinat(){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("Enter the radius of the bounding circle: "); 7 | double ridius = input.nextDouble(); 8 | System.out.print("Enter the number of sides: "); 9 | int numOfSide = input.nextInt(); 10 | 11 | double angle = Math.toRadians(360 / numOfSide); 12 | System.out.println("The coordinates of five points on the pentagon are: "); 13 | for (int i = 0; i < numOfSide; i++){ 14 | System.out.printf("(%3.4f, %3.4f)\n", ridius * Math.sin(angle * i), ridius * Math.cos(angle * i)); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Ch06/src/Quiz_6_25.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Quiz_6_25 { 4 | void printTime(){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("Enter the millis: "); 7 | long millis = input.nextLong(); 8 | 9 | System.out.printf("The time is %s", convertMillis(millis)); 10 | } 11 | 12 | static String convertMillis(long millis){ 13 | 14 | long totalSecond = millis / 1000; 15 | long second = totalSecond % 60; 16 | 17 | long totalMin = totalSecond / 60; 18 | long min = totalMin % 60; 19 | 20 | long totalHour = totalMin / 60; 21 | long hour = totalHour; 22 | 23 | return "" + hour + ":" + min + ":" + second; 24 | } 25 | } -------------------------------------------------------------------------------- /Ch03/src/SubtractionQuiz.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class SubtractionQuiz { 4 | public static void subtract(){ 5 | int num1 = (int)(Math.random() * 100); 6 | int num2 = (int)(Math.random() * 100); 7 | 8 | if(num1 < num2){ 9 | int temp = num1; 10 | num1 = num2; 11 | num2 = temp; 12 | } 13 | System.out.print(num1 + "-" + num2 + "="); 14 | Scanner input = new Scanner(System.in); 15 | int result = input.nextInt(); 16 | if(num1 - num2 ==result){ 17 | System.out.print("The result is correct"); 18 | }else 19 | System.out.print("The result is incorrect, right answer is " + (num1 - num2)); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Ch12/src/WriteData.java: -------------------------------------------------------------------------------- 1 | import java.io.File; 2 | import java.io.FileNotFoundException; 3 | import java.io.IOException; 4 | import java.io.PrintWriter; 5 | 6 | public class WriteData { 7 | static void printResult() throws IOException { 8 | File file = new File("score.txt"); 9 | if (file.exists()){ 10 | System.out.println("File already exists"); 11 | System.exit(1); 12 | } 13 | 14 | PrintWriter output = new PrintWriter(file); 15 | 16 | //write formatted output to the file 17 | output.print("zh"); 18 | output.println(99); 19 | output.print("wf"); 20 | output.println(89); 21 | 22 | //close the file 23 | output.close(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Ch11/src/CastingDemo.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author callmezh 3 | * instanceof应用举例 4 | */ 5 | public class CastingDemo { 6 | public static void displayObject(Object object){ 7 | if (object instanceof CircleFromSimpleGeometricObject){ 8 | System.out.println("The circle area is " + 9 | ((CircleFromSimpleGeometricObject)object).getArea()); 10 | System.out.println("The circle diameter is " + 11 | ((CircleFromSimpleGeometricObject)object).getDiameter()); 12 | }else if (object instanceof RectangleFromSimpleGeometricObject){ 13 | System.out.println("The rectangle area is " + 14 | ((RectangleFromSimpleGeometricObject)object).getArea()); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /Ch07/src/Quiz_7_20.java: -------------------------------------------------------------------------------- 1 | import java.util.Arrays; 2 | 3 | class Quiz_7_20 { 4 | void printSelectionSort(){ 5 | int[] numArray = {3, 4, 6, 8 ,9 , 0, 5, 2}; 6 | System.out.print(Arrays.toString(selectionSort(numArray))); 7 | } 8 | 9 | private static int[] selectionSort(int[] list){ 10 | for (int i = list.length - 1; i >= 0; i--){ 11 | int max = list[i]; 12 | 13 | for (int j = i - 1; j >= 0; j--){ 14 | if (list[j] > max){ 15 | max = list[j]; 16 | 17 | int temp = list[i]; 18 | list[i] = list[j]; 19 | list[j] = temp; 20 | } 21 | } 22 | } 23 | return list; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Ch06/src/Quiz_6_26.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Quiz_6_26 { 4 | void printPalindromePrimeNum(){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("Enter a number: "); 7 | int num = input.nextInt(); 8 | 9 | int count = 0; 10 | int i = 2; 11 | //大于等于2,因为这样可以直接排除1的可能性 12 | while (i <= num){ 13 | if (PrimeNumMethod.isPrimeNum(i) && Quiz_5_3.isPalindrome(String.valueOf(i))){ 14 | count++; 15 | 16 | if (count % 10 == 0){ 17 | System.out.printf("%4d\n", i); 18 | }else 19 | System.out.printf("%4d", i); 20 | } 21 | 22 | i++; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Ch06/src/Quiz_6_6.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Quiz_6_6 { 4 | void printPattern(){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("Enter the number: "); 7 | int num = input.nextInt(); 8 | dipalyPattren(num); 9 | } 10 | 11 | static void dipalyPattren(int num){ 12 | for (int i = 1; i <= num; i++){ 13 | 14 | for (int k = i; k < num; k++){ 15 | System.out.print(" "); 16 | } 17 | 18 | for (int j = i; j >= 1; j --){ 19 | if (j == 1){ 20 | System.out.printf("%4d\n", j); 21 | }else 22 | System.out.printf("%4d", j); 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Ch07/src/Quiz_7_10.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Quiz_7_10 { 4 | void printMinNumIndex(){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("Enter the number of number: "); 7 | int n = input.nextInt(); 8 | 9 | int[] array = InputInteger.getArray(n); 10 | 11 | System.out.printf("The smallest number's index is %d", min(array)); 12 | } 13 | 14 | static int min(int[] array){ 15 | int min = array[0]; 16 | int minNumIndex = 1; 17 | for (int i = 1; i < array.length; i++){ 18 | if (min > array[i]){ 19 | min = array[i]; 20 | minNumIndex = i + 1; 21 | } 22 | } 23 | return minNumIndex; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Ch11/src/MyStack.java: -------------------------------------------------------------------------------- 1 | import java.util.ArrayList; 2 | 3 | public class MyStack { 4 | private ArrayList list = new ArrayList<>(); 5 | 6 | public boolean isEmpty(){ 7 | return list.isEmpty(); 8 | } 9 | 10 | public int getSize(){ 11 | return list.size(); 12 | } 13 | 14 | public Object peek(){ 15 | return list.get(list.size() - 1); 16 | } 17 | 18 | public Object pop(){ 19 | Object peekObject = list.get(list.size() - 1); 20 | list.remove( peekObject); 21 | return peekObject; 22 | } 23 | 24 | public void push(Object o){ 25 | list.add(o); 26 | } 27 | 28 | @Override 29 | public String toString(){ 30 | return "stack: " + list.toString(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Ch03/src/Quiz_3_18.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Quiz_3_18 { 4 | public static void computeCost(){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("Please enter the weight of package: "); 7 | double weight = input.nextDouble(); 8 | if (weight > 0 && weight <= 1){ 9 | System.out.print("The cost is 3.5$"); 10 | }else if (weight <= 3){ 11 | System.out.print("The cost is 5.5$"); 12 | }else if (weight <= 10){ 13 | System.out.print("The cost is 8.5$"); 14 | }else if (weight <= 20){ 15 | System.out.print("The cost is 10.5$"); 16 | }else 17 | System.out.print("The package overweight and cannot be shipped!"); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Ch05/src/com/company/Dec2Hex.java: -------------------------------------------------------------------------------- 1 | package com.company; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Dec2Hex { 6 | public void Dec2Hex() { 7 | Scanner input = new Scanner(System.in); 8 | String hex = ""; 9 | System.out.print("Enter a decimal number: "); 10 | int dec = input.nextInt(); 11 | int count = 0; 12 | while (dec != 0) { 13 | int hexValue = dec % 16; 14 | char hexCharValue = (hexValue >= 0 && hexValue <= 9) ? 15 | (char) (hexValue + '0') : (char) (hexValue - 10 + 'A'); 16 | hex = hexCharValue + hex; 17 | dec /= 16; 18 | 19 | count++; 20 | } 21 | System.out.printf("The hex number is %s, time is %d", hex, count); 22 | } 23 | } -------------------------------------------------------------------------------- /Ch05/src/com/company/Quiz_5_40.java: -------------------------------------------------------------------------------- 1 | package com.company; 2 | 3 | import java.util.Scanner; 4 | 5 | class Quiz_5_40 { 6 | void simulatedCoinToss(){ 7 | int countUP = 0; 8 | int countDown = 0; 9 | Scanner input = new Scanner(System.in); 10 | System.out.print("Enter the times of coin toss: "); 11 | int times = input.nextInt(); 12 | for (int i = 1; i <= times; i++){ 13 | double randomNum = Math.random(); 14 | if (randomNum >= 0 && randomNum < 0.5){ 15 | countUP++; 16 | }else 17 | countDown++; 18 | } 19 | System.out.print("\tup times\tdown times\tratio\n"); 20 | System.out.printf("%10d%10d%15.10f", countUP, countDown, (double)countUP / countDown); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Ch05/src/com/company/Quiz_5_20.java: -------------------------------------------------------------------------------- 1 | package com.company; 2 | 3 | public class Quiz_5_20 { 4 | public void printPrimeNum(){ 5 | int num = 2; 6 | int count = 0; 7 | while (num <= 1000){ 8 | boolean isPrimeNum = true; 9 | for (int k = 2; k <= num / 2; k++){ 10 | if (num % k == 0){ 11 | isPrimeNum = false; 12 | break; 13 | } 14 | } 15 | if (isPrimeNum){ 16 | count++; 17 | if (count % 8 == 0){ 18 | System.out.printf("%5d\n", num); 19 | }else 20 | System.out.printf("%5d", num); 21 | } 22 | num++; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Ch07/src/Quiz_7_12.java: -------------------------------------------------------------------------------- 1 | import java.util.Arrays; 2 | import java.util.Scanner; 3 | 4 | public class Quiz_7_12 { 5 | void printReverseResult(){ 6 | Scanner input = new Scanner(System.in); 7 | System.out.print("Enter the number of number: "); 8 | int n = input.nextInt(); 9 | 10 | int[] array = InputInteger.getArray(n); 11 | 12 | 13 | System.out.println(Arrays.toString(array)); 14 | System.out.print(Arrays.toString(reverseArray(array))); 15 | } 16 | 17 | static int[] reverseArray(int[] array){ 18 | for (int i = 0; i < array.length / 2; i++){ 19 | int temp = array[i]; 20 | array[i] = array[array.length - i - 1]; 21 | array[array.length - i - 1] = temp; 22 | } 23 | return array; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Ch03/src/Quiz_3_22.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Quiz_3_22 { 4 | public static void checkPoint(){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("Enter a point with two coordinates: "); 7 | double point_x = input.nextInt(); 8 | double point_y = input.nextInt(); 9 | double s = Math.pow(Math.pow(point_x, 2) + Math.pow(point_y, 2), 0.5); 10 | if (s < 10){ 11 | System.out.print("Point (" + point_x + "," + point_y + ") is in the circle"); 12 | }else if (s == 10){ 13 | System.out.print("Point (" + point_x + "," + point_y + ") is on the circle"); 14 | }else if (s > 10){ 15 | System.out.print("Point (" + point_x + "," + point_y + ") is not in the circle"); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Ch01/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Ch02/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Ch03/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Ch03/src/Quiz_3_27.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Quiz_3_27 { 4 | public static void checkPoint(){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("Enter a point with two coordinates: "); 7 | double point_x = input.nextDouble(); 8 | double point_y = input.nextDouble(); 9 | double border_y = -0.5 * point_x + 100; 10 | if (point_x < 0 || point_y <0){ 11 | System.out.print("Point (" + point_x + "," + point_y + ") is not in the triangle"); 12 | }else if (point_x > 200 || point_y > border_y){ 13 | System.out.print("Point (" + point_x + "," + point_y + ") is not in the triangle"); 14 | }else 15 | System.out.print("Point (" + point_x + "," + point_y + ") is in the triangle"); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Ch04/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Ch06/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Ch06/src/Quiz_6_27.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | class Quiz_6_27 { 4 | void printReverPrimeNum(){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("Enter a number: "); 7 | int num = input.nextInt(); 8 | int count = 0; 9 | 10 | int i = 2; 11 | //大于等于2,因为这样可以直接排除1的可能性 12 | while (i <= num){ 13 | if (PrimeNumMethod.isPrimeNum(i) && !Quiz_5_3.isPalindrome(String.valueOf(i)) && PrimeNumMethod.isPrimeNum(Integer.parseInt(Quiz_5_3.reverse(String.valueOf(i))))){ 14 | count++; 15 | if (count % 10 == 0){ 16 | System.out.printf("%4d\n", i); 17 | }else 18 | System.out.printf("%4d", i); 19 | } 20 | i++; 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /Ch07/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Ch08/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Ch09/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Ch10/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Ch11/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Ch12/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Ch05/src/com/company/Quiz_5_18.java: -------------------------------------------------------------------------------- 1 | package com.company; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Quiz_5_18 { 6 | public void printPattern(){ 7 | Scanner input = new Scanner(System.in); 8 | System.out.printf("Enter the number of the lines: "); 9 | int lines = input.nextInt(); 10 | int count = 1; 11 | 12 | while (count <= lines){ 13 | for (int i = 1; i <= 3 * (count - 1); i++){ 14 | System.out.printf(" "); 15 | } 16 | 17 | for (int i = 1; i <= lines - count + 1; i++){ 18 | if (i == lines - count + 1) 19 | System.out.printf("%3d\n", i); 20 | else 21 | System.out.printf("%3d", i); 22 | } 23 | count++; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Ch05/src/com/company/Quiz_5_39.java: -------------------------------------------------------------------------------- 1 | package com.company; 2 | 3 | import java.util.Scanner; 4 | 5 | class Quiz_5_39 { 6 | void computeCommission(){ 7 | Scanner input = new Scanner(System.in); 8 | System.out.print("Enter the commission you want to make: "); 9 | double commission = input.nextDouble(); 10 | double minSales; 11 | if (commission >= 0.01 * 0.08 && commission <= 5000 * 0.08){ 12 | minSales = commission / 0.08; 13 | }else if (commission <= 10000 * 0.08){ 14 | minSales = 5000 + (commission - 5000 * 0.08) / 0.1; 15 | }else 16 | minSales = 10000 + (commission - 5000 * 0.08 - 5000 * 0.1) / 0.12; 17 | System.out.printf("If you want to make %.2f$, your sales should have %.2f$ at least", commission, minSales); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Ch06/src/Quiz_6_37.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | class Quiz_6_37 { 4 | void printFormatNum(){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("Enter a number: "); 7 | int num = input.nextInt(); 8 | System.out.print("Enter the width: "); 9 | int width = input.nextInt(); 10 | 11 | System.out.printf("%s", format(num, width)); 12 | } 13 | 14 | private static String format(int num, int width){ 15 | String formatNum = num + ""; 16 | if (formatNum.length() >= width){ 17 | return formatNum; 18 | }else{ 19 | for (int i = 1; i <= width - String.valueOf(num).length(); i++){ 20 | formatNum = "0" + formatNum; 21 | } 22 | } 23 | 24 | return formatNum; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Ch06/src/Hex2Dec.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Hex2Dec { 4 | void printDec(){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("Enter a hex number: "); 7 | String hex = input.next(); 8 | System.out.printf("The dec number is: %d", hex2Dec(hex.toUpperCase())); 9 | } 10 | 11 | private int hex2Dec(String hex){ 12 | int dec = 0; 13 | for (int i = 0; i <= hex.length() - 1; i++){ 14 | char hexChar = hex.charAt(i); 15 | dec = dec * 16 + hexChar2Dec(hexChar); 16 | } 17 | return dec; 18 | } 19 | 20 | private int hexChar2Dec(char hexChar){ 21 | if (hexChar >= 'A' && hexChar <= 'Z'){ 22 | return 10 + hexChar - 'A'; 23 | }else 24 | return hexChar - '0'; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Ch08/src/GradeExam.java: -------------------------------------------------------------------------------- 1 | import java.util.Arrays; 2 | 3 | @SuppressWarnings("ALL") 4 | public class GradeExam { 5 | void printGrade(){ 6 | char[][] answersAndStudents = { 7 | {'A', 'B', 'C', 'D'}, 8 | {'C', 'D', 'A', 'C'}, 9 | {'A', 'B', 'B', 'C'}}; 10 | 11 | char[] key = {'A', 'C', 'A', 'C'}; 12 | 13 | for (int i = 0; i < answersAndStudents.length; i++){ 14 | int correctCount = 0; 15 | for (int j = 0; j < answersAndStudents[i].length - 1; j++){ 16 | if (answersAndStudents[i][j] == key[j]){ 17 | correctCount++; 18 | } 19 | } 20 | System.out.printf("The %c's student correct count is %d\n", answersAndStudents[i][4], correctCount); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Ch05/src/com/company/Quiz_5_29.java: -------------------------------------------------------------------------------- 1 | package com.company; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Quiz_5_29 { 6 | public void comuteInterest(){ 7 | Scanner input = new Scanner(System.in); 8 | System.out.print("Enter the money you save per month: "); 9 | double moneyPreMonth = input.nextDouble(); 10 | System.out.print("Enter the save time(month): "); 11 | int month = input.nextInt(); 12 | System.out.print("Enter the rate per year(%): "); 13 | double rate = input.nextDouble(); 14 | double allMoney = 0; 15 | System.out.println("month\t\tall money"); 16 | for (int i = 1; i <= month; i++){ 17 | allMoney = (allMoney + moneyPreMonth) * (1 + rate / 1200); 18 | System.out.printf("%3d\t\t\t%.4f\n", i, allMoney); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Ch07/src/Quiz_7_18.java: -------------------------------------------------------------------------------- 1 | import java.util.Arrays; 2 | 3 | public class Quiz_7_18 { 4 | void printBubbleSort(){ 5 | int[] numArray = {2, 3, 5, 6, 3, 9, 0}; 6 | System.out.println(Arrays.toString(numArray)); 7 | System.out.print(Arrays.toString(bubbleSort(numArray))); 8 | } 9 | 10 | static int[] bubbleSort(int[] numArray){ 11 | 12 | for (int i = 0; i < numArray.length - 1; i++){ 13 | //交换相邻两个数, 还要减去1 是因为 j+1 会超出数组边界 14 | for (int j = 0; j < numArray.length - 1 - i; j++){ 15 | if (numArray[j] > numArray[j + 1]){ 16 | int temp = numArray[j]; 17 | numArray[j] = numArray[j + 1]; 18 | numArray[j + 1] = temp; 19 | } 20 | } 21 | } 22 | 23 | return numArray; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Ch05/src/com/company/Quiz_5_43.java: -------------------------------------------------------------------------------- 1 | package com.company; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Quiz_5_43 { 6 | void Combination(){ 7 | Scanner input = new Scanner(System.in); 8 | System.out.print("Enter the number:"); 9 | int num = input.nextInt(); 10 | int combinationNum; 11 | int count = 0; 12 | for (int i = 1; i <= num; i++){ 13 | for (int j = 1; j <= num; j++){ 14 | combinationNum = i * 10 + j; 15 | count++; 16 | if (count % num == 0) 17 | System.out.printf("%3d\n", combinationNum); 18 | else 19 | System.out.printf("%3d", combinationNum); 20 | } 21 | } 22 | System.out.printf("The total number of all combinationNum is %d", count); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Ch01/src/quiz_1_13.java: -------------------------------------------------------------------------------- 1 | public class quiz_1_13 { 2 | public static void practiceResult(String equation_one, String equation_two){ 3 | String[] abe = equation_one.split("x+|y="); 4 | String[] cdf = equation_two.split("x+|y="); 5 | double[] abe1 = new double[3]; 6 | double[] cdf1 = new double[3]; 7 | double result_x, result_y; 8 | for (int i = 0; i < 3; i++){ 9 | abe1[i] = Double.parseDouble(abe[i]); 10 | cdf1[i] = Double.parseDouble(cdf[i]); 11 | } 12 | result_x = (abe1[2] * cdf1[1] - abe1[1] * cdf1[2]) / (abe1[0] * cdf1[1] - abe1[1] * cdf1[0]); 13 | result_y = (abe1[0] * cdf1[2] - abe1[2] * cdf1[0]) / (abe1[0] * cdf1[1] - abe1[1]*cdf1[0]); 14 | System.out.println("The answer is " + "\n" + "x = " + result_x + "\n" + "y = " + result_y); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Ch05/src/com/company/GuessNum.java: -------------------------------------------------------------------------------- 1 | package com.company; 2 | 3 | import java.util.Scanner; 4 | 5 | public class GuessNum { 6 | public void guessNum(){ 7 | int num = (int)(Math.random() * 100 + 1); 8 | 9 | Scanner input = new Scanner(System.in); 10 | System.out.println("Guess a number between 0 to 100"); 11 | 12 | int guess = -1; 13 | while (guess != num){ 14 | System.out.print("\nEnter you guess: "); 15 | guess = input.nextInt(); 16 | 17 | if (guess == num){ 18 | System.out.printf("Yes, the number is %d", num); 19 | }else if (guess >= num){ 20 | System.out.print("Your guess is higher"); 21 | }else if (guess <= num){ 22 | System.out.print("Your guess is lower"); 23 | } 24 | } 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /Ch03/src/Quiz_3_11.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Quiz_3_11 { 4 | public static void showDays(){ 5 | int days = 31; 6 | Scanner input = new Scanner(System.in); 7 | System.out.print("请输入年份:"); 8 | int year = input.nextInt(); 9 | System.out.print("请输入月份:"); 10 | int month = input.nextInt(); 11 | switch (month){ 12 | case 2: 13 | if ((year % 4 ==0 && year % 100 != 0) || year % 400 ==0){ 14 | days = 29; 15 | }else 16 | days = 28; 17 | break; 18 | case 4: 19 | case 6: 20 | case 9: 21 | case 11: 22 | days = 30; 23 | break; 24 | } 25 | System.out.print( year + "年" + month + "月有" + days + "天"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Ch05/src/com/company/Palindrome.java: -------------------------------------------------------------------------------- 1 | package com.company; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Palindrome { 6 | public void checkPalindrome(){ 7 | Scanner input = new Scanner(System.in); 8 | System.out.print("Enter a word: "); 9 | String word = input.nextLine(); 10 | 11 | int high = word.length() - 1; 12 | int low = 0; 13 | boolean isPalindrome = true; 14 | 15 | while (low <= high){ 16 | if (word.charAt(low) != word.charAt(high)){ 17 | isPalindrome = false; 18 | break; 19 | } 20 | high--; 21 | low++; 22 | } 23 | 24 | if (isPalindrome){ 25 | System.out.printf("%s is a palindrome", word); 26 | }else 27 | System.out.printf("%s is not a palindrome", word); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Ch09/src/Quiz_9_1_Rectangle.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author callmezh 3 | * 定义rectangle类 4 | */ 5 | public class Quiz_9_1_Rectangle { 6 | private double width = 1; 7 | private double height = 1; 8 | 9 | /** 10 | * 默认构造类,不写的话就只能使用下面那个构造方法了 11 | */ 12 | public Quiz_9_1_Rectangle(){ 13 | 14 | } 15 | 16 | /** 17 | * 重写构造函数 18 | * @param width 用户自定义宽度 19 | * @param height 用户自定义高度 20 | */ 21 | Quiz_9_1_Rectangle(double width, double height){ 22 | this.width = width; 23 | this.height = height; 24 | } 25 | 26 | /** 27 | * 返回矩形面积 28 | * @return 29 | */ 30 | double getArea(){ 31 | return width * height; 32 | } 33 | 34 | /** 35 | * 返回矩形周长 36 | * @return 37 | */ 38 | public double getPerimeter(){ 39 | return 2 * (width + height); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /Ch05/src/com/company/PrintNum.java: -------------------------------------------------------------------------------- 1 | package com.company; 2 | 3 | public class PrintNum { 4 | public void printNum(){ 5 | final int NUM_OF_PRIMES = 50; 6 | final int NUM_OF_PER_LINE = 10; 7 | 8 | int num = 2; 9 | int count = 0; 10 | 11 | while (count < NUM_OF_PRIMES){ 12 | boolean isPrime = true; 13 | for (int k = 2; k <= num / 2; k++){ 14 | if (num % k == 0){ 15 | isPrime = false; 16 | break; 17 | } 18 | } 19 | if (isPrime){ 20 | count++; 21 | if (count % NUM_OF_PER_LINE == 0){ 22 | System.out.printf("%4d\n", num); 23 | }else 24 | System.out.printf("%4d", num); 25 | } 26 | num++; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Ch12/src/Quiz_12_3_ArrayIndexOutBoundsException.java: -------------------------------------------------------------------------------- 1 | import java.sql.SQLSyntaxErrorException; 2 | import java.util.Random; 3 | import java.util.Scanner; 4 | 5 | /** 6 | * @author callmezh 7 | * 数组越界 8 | */ 9 | public class Quiz_12_3_ArrayIndexOutBoundsException { 10 | private final int length = 100; 11 | void printResult(){ 12 | int [] randomNum = new int[100]; 13 | Random random = new Random(); 14 | for (int i = 0; i < length; i++){ 15 | randomNum[i] = random.nextInt(); 16 | } 17 | System.out.print("Enter a index of array: "); 18 | Scanner input = new Scanner(System.in); 19 | int index = input.nextInt(); 20 | try{ 21 | System.out.print(randomNum[index]); 22 | }catch (ArrayIndexOutOfBoundsException ex){ 23 | System.out.print("Out of bounds"); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Ch06/src/Quiz_6_7.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Quiz_6_7 { 4 | void printInvestmentValue(){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("Enter the investment amount($): "); 7 | double investment = input.nextDouble(); 8 | System.out.print("Enter the monthly rate(%): "); 9 | double yearRate = input.nextDouble(); 10 | 11 | System.out.print("Years Future Value\n"); 12 | futureInvestmentValue(investment, yearRate); 13 | } 14 | 15 | static void futureInvestmentValue(double investment, double yearRate){ 16 | double futureInvestmentValue = investment; 17 | for (int years = 1; years <= 30; years++){ 18 | futureInvestmentValue *= (1 + yearRate / 100); 19 | System.out.printf("%3d %.3f\n", years, futureInvestmentValue); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Ch09/src/Quiz_9_5_GregroianCalendar.java: -------------------------------------------------------------------------------- 1 | import java.util.GregorianCalendar; 2 | 3 | /** 4 | * @author callmezh 5 | * 公历类 6 | */ 7 | public class Quiz_9_5_GregroianCalendar { 8 | /** 9 | * 打印日期 10 | */ 11 | void printGregroianCalendar(){ 12 | GregorianCalendar calendar = new GregorianCalendar(); 13 | System.out.println("Year is " + calendar.get(GregorianCalendar.YEAR)); 14 | System.out.println("Month is " + calendar.get(GregorianCalendar.MONTH)); 15 | System.out.println("Date is " + calendar.get(GregorianCalendar.DATE)); 16 | 17 | calendar.setTimeInMillis(1234567898765L); 18 | System.out.println("Year is " + calendar.get(GregorianCalendar.YEAR)); 19 | System.out.println("Month is " + calendar.get(GregorianCalendar.MONTH)); 20 | System.out.println("Date is " + calendar.get(GregorianCalendar.DATE)); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Ch07/src/Quiz_7_8.java: -------------------------------------------------------------------------------- 1 | import java.sql.SQLSyntaxErrorException; 2 | import java.util.Scanner; 3 | 4 | public class Quiz_7_8 { 5 | void printAverage(){ 6 | Scanner input = new Scanner(System.in); 7 | System.out.print("Enter 3 double number: "); 8 | int[] array = new int[3]; 9 | 10 | for (int i = 0; i < 3; i++){ 11 | array[i] = input.nextInt(); 12 | } 13 | 14 | System.out.printf("%.2f", average(array)); 15 | } 16 | 17 | static int average(int[] array){ 18 | int sum = 0; 19 | for (int anArray : array) { 20 | sum += anArray; 21 | } 22 | return sum / array.length; 23 | } 24 | 25 | static double average(double[] array){ 26 | double sum = 0; 27 | for (double anArray : array) { 28 | sum += anArray; 29 | } 30 | return sum / array.length; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Ch11/src/Quiz_11_10_MyStack.java: -------------------------------------------------------------------------------- 1 | import java.util.ArrayList; 2 | import java.util.Scanner; 3 | 4 | /** 5 | * @author callmezh 6 | * 利用继承实现栈类 7 | */ 8 | public class Quiz_11_10_MyStack extends ArrayList { 9 | 10 | Quiz_11_10_MyStack(){ 11 | 12 | } 13 | 14 | @Override 15 | public boolean isEmpty(){ 16 | return super.isEmpty(); 17 | } 18 | 19 | public int getSize(){ 20 | return size(); 21 | } 22 | 23 | public Object peek(){ 24 | return get(size() - 1); 25 | } 26 | 27 | public Object pop(){ 28 | return remove(getSize() - 1); 29 | } 30 | 31 | public Object push(Object o){ 32 | add(o); 33 | return o; 34 | } 35 | 36 | public int search(Object o){ 37 | return indexOf(o); 38 | } 39 | 40 | @Override 41 | public String toString(){ 42 | return "stack: " + toString(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Ch03/src/Quiz_3_33.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Quiz_3_33 { 4 | public static void compareCost(){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("Enter weight and price for the package 1: "); 7 | double weight1 = input.nextDouble(); 8 | double price1 = input.nextDouble(); 9 | System.out.print("Enter weight and price for the package 2: "); 10 | double weight2 = input.nextDouble(); 11 | double price2 = input.nextDouble(); 12 | 13 | if (price1 / weight1 == price2 / weight2){ 14 | System.out.print("Two package is the same!"); 15 | }else if (price1 / weight1 > price2 / weight2){ 16 | System.out.print("Package 2 has a better price"); 17 | }else if (price1 / weight1 < price2 / weight2){ 18 | System.out.print("Package 1 has a better price"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Ch08/src/Quiz_8_1.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | /** 4 | * @author callmezh 5 | * 6 | * 求矩阵各列的和 7 | * 8 | */ 9 | public class Quiz_8_1 { 10 | void printResult(){ 11 | int [][] array = Array.createArray(4); 12 | Array.printArray(array); 13 | Scanner input = new Scanner(System.in); 14 | System.out.print("Enter the column index between 0 - 2 : "); 15 | int columnIndex = input.nextInt(); 16 | System.out.printf("The sum of %d column is %d", columnIndex, sumColumn(array, columnIndex)); 17 | } 18 | 19 | /** 20 | * @param array 二维数组 21 | * @param columnIndex 求和目标列 22 | * @retuen 目标列的和 23 | */ 24 | static int sumColumn(int [][] array, int columnIndex){ 25 | int sum = 0; 26 | for (int row = 0; row < array.length; row++){ 27 | sum += array[row][columnIndex]; 28 | } 29 | return sum; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Ch12/src/Quiz_12_4_ThrowIllegalArgumentException.java: -------------------------------------------------------------------------------- 1 | import com.sun.deploy.util.SyncAccess; 2 | 3 | import java.net.SecureCacheResponse; 4 | import java.util.Scanner; 5 | 6 | public class Quiz_12_4_ThrowIllegalArgumentException { 7 | static void printResult() throws Quiz_12_4_IllArgumentException { 8 | Scanner input = new Scanner(System.in); 9 | System.out.print("Enter the loan amount: "); 10 | double amount = input.nextDouble(); 11 | System.out.print("Enter the loan rate: "); 12 | double rate = input.nextDouble(); 13 | 14 | if (amount <= 0 || rate <= 0){ 15 | throw new Quiz_12_4_IllArgumentException(amount, rate); 16 | } 17 | } 18 | 19 | void catchException(){ 20 | try { 21 | printResult(); 22 | } 23 | catch (Quiz_12_4_IllArgumentException ex){ 24 | ex.getMessage(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Ch06/src/GreatestCommonDivisorMethod.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class GreatestCommonDivisorMethod { 4 | void printGreatestcommonDivisor(){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("Enter first integer: "); 7 | int num1 = input.nextInt(); 8 | System.out.print("Enter second integer: "); 9 | int num2 = input.nextInt(); 10 | 11 | System.out.printf("The greatest common divisor for %d, %d is %d", num1, num2, gcd(num1, num2)); 12 | } 13 | 14 | //这里静态用不用都一样?gcd在同一个类中被另一个方法调用时,没有差别。 15 | //在类外调用时,这里是否是static就会对其调用方式有影响 16 | int gcd(int num1, int num2){ 17 | int gcd = 1; 18 | int k = 2; 19 | 20 | while (k <= num1 && k <= num2){ 21 | if (num1 % k == 0 && num2 % k == 0){ 22 | gcd = k; 23 | } 24 | k++; 25 | } 26 | return gcd; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Ch07/src/AnalyzeNum.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class AnalyzeNum { 4 | void printAnalyzeResult(){ 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("Enter the number of items: "); 7 | int n = input.nextInt(); 8 | 9 | double [] nums = new double[n]; 10 | double sum = 0; 11 | 12 | System.out.print("Enter the numbers: "); 13 | for (int i = 0; i < n; i++){ 14 | nums[i] = input.nextDouble(); 15 | sum += nums[i]; 16 | } 17 | 18 | double average = sum / n; 19 | 20 | int count = 0; 21 | for (int i = 0; i < n; i++){ 22 | if (nums[i] > average){ 23 | count++; 24 | } 25 | } 26 | 27 | System.out.printf("Average is %f\n", average); 28 | System.out.printf("Number of elements above the average is %d", count); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /Ch07/src/SelectionSort.java: -------------------------------------------------------------------------------- 1 | import java.util.Arrays; 2 | 3 | public class SelectionSort { 4 | void selectionSort(){ 5 | double[] list = {3, 2, 5, 4, 5, 9, 7, 1}; 6 | 7 | for (int i = 0; i <= list.length - 1; i++){ 8 | //find the min number in the list 9 | double currentMin = list[i]; 10 | int currentMinIndex = i; 11 | for (int j = i + 1; j <= list.length - 1; j++){ 12 | if (currentMin > list[j]){ 13 | currentMin = list[j]; 14 | currentMinIndex = j; 15 | } 16 | } 17 | 18 | //swap list[i] with list[currentMinIndex] if necessary 19 | if (currentMinIndex != i){ 20 | list[currentMinIndex] = list[i]; 21 | list[i] = currentMin; 22 | } 23 | } 24 | 25 | System.out.println(Arrays.toString(list)); 26 | } 27 | } -------------------------------------------------------------------------------- /Ch09/src/Quiz_9_2_Stock.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author callmezh 3 | * 定义股票类 4 | */ 5 | public class Quiz_9_2_Stock { 6 | private String symbol; 7 | private String name; 8 | private double previousClosingPrice; 9 | private double currentPrice; 10 | 11 | /** 12 | * 重写构造函数 13 | * @param symbol 股票代码 14 | * @param name 股票名称 15 | * @param previousClosingPrice 昨日收盘价 16 | * @param currentPrice 现价 17 | */ 18 | Quiz_9_2_Stock(String symbol, String name, double previousClosingPrice, double currentPrice){ 19 | this.symbol = symbol; 20 | this.name = name; 21 | this.previousClosingPrice = previousClosingPrice; 22 | this.currentPrice = currentPrice; 23 | } 24 | 25 | 26 | /** 27 | * 返回盈亏百分比 28 | * @return 盈亏百分比 29 | */ 30 | String getChangePercent(){ 31 | return (currentPrice - previousClosingPrice) / previousClosingPrice + "%"; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Ch02/src/Main.java: -------------------------------------------------------------------------------- 1 | public class Main { 2 | 3 | public static void main(String[] args) { 4 | 5 | // ShowCurrentTime showCurrentTime = new ShowCurrentTime(); 6 | // showCurrentTime.practiceCurrentTime(); 7 | 8 | // SalesTax salesTax = new SalesTax(); 9 | // salesTax.practiceTax(); 10 | 11 | // ComputeLoan computeLoan = new ComputeLoan(); 12 | // computeLoan.computeLoan(); 13 | 14 | ComputeChange computeChange = new ComputeChange(); 15 | computeChange.computeChane(); 16 | 17 | // for (int i = 0; i < 3; i ++){ 18 | // Quiz_2_6 sumNum = new Quiz_2_6(); 19 | // sumNum.sumNum(); 20 | // } 21 | 22 | // Quiz_2_13 money = new Quiz_2_13(); 23 | // money.getInterest(); 24 | 25 | // Quiz_2_17 twc = new Quiz_2_17(); 26 | // twc.computeTwc(); 27 | 28 | // Quiz_2_23 cost = new Quiz_2_23(); 29 | // cost.computeCost(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Ch05/src/com/company/GfreatestCommonDivisor.java: -------------------------------------------------------------------------------- 1 | package com.company; 2 | 3 | import java.util.Scanner; 4 | 5 | public class GfreatestCommonDivisor { 6 | public void computeCommon(){ 7 | Scanner input = new Scanner(System.in); 8 | int gcd = 1; 9 | // int k = 2; 10 | System.out.print("Enter first integer: "); 11 | int num1 = input.nextInt(); 12 | System.out.print("Enter second integer: "); 13 | int num2 = input.nextInt(); 14 | 15 | // while (k <= num1 && k<= num2){ 16 | // if (num1 % k == 0 && num2 % k == 0){ 17 | // gcd = k; 18 | // } 19 | // k++; 20 | // } 21 | 22 | for (int k = 2; k <= num1 /2 && k <= num2 / 2; k++){ 23 | if (num1 % k ==0 && num2 % k == 0) 24 | gcd = k; 25 | } 26 | System.out.printf("The greatest common divisor for %d and %d is %d", num1, num2, gcd); 27 | } 28 | 29 | } 30 | --------------------------------------------------------------------------------