├── .idea
├── compiler.xml
├── inspectionProfiles
│ └── Project_Default.xml
├── misc.xml
├── modules.xml
├── uiDesigner.xml
├── vcs.xml
└── workspace.xml
├── Java Programming (A step to step guide).iml
├── out
└── production
│ ├── Java Programming (A step to step guide)
│ ├── CAI
│ │ └── Computer_Assisted_Instruction.class
│ ├── LinkedLists
│ │ └── Main.class
│ ├── _10_ObjectOrientedThinking
│ │ ├── BigIntegerAndBigDecimalClasses.class
│ │ ├── BmiNew.class
│ │ ├── ComputeLoanNew.class
│ │ ├── Course.class
│ │ ├── NotesOnOOP.class
│ │ ├── StackOfIntegers.class
│ │ └── UsingWrapperClasses.class
│ ├── _1_IntroToComputerAndPrograms
│ │ ├── ComputeExpression.class
│ │ ├── Welcome.class
│ │ └── WelcomeWithThreeMessages.class
│ ├── _2_ElementaryProgramming
│ │ ├── ComputeArea.class
│ │ ├── ComputeAreaWithConsoleInput.class
│ │ ├── ComputeAverage.class
│ │ ├── ComputeChange.class
│ │ ├── ComputeLoan.class
│ │ ├── DisplayTime.class
│ │ ├── ExponentOperations.class
│ │ ├── FahrenheitToCelsius.class
│ │ ├── PrintF.class
│ │ ├── SalesTax.class
│ │ ├── ShowCurrentTime.class
│ │ └── SwapValuesOfVariables.class
│ ├── _3_Selections
│ │ ├── AdditionQuiz.class
│ │ ├── BMI.class
│ │ ├── ChineseZodiac.class
│ │ ├── ComputeTax.class
│ │ ├── DetermineToday.class
│ │ ├── LeapYear.class
│ │ ├── Lottery.class
│ │ ├── SimpleIfDemo.class
│ │ ├── SubtractionQuiz.class
│ │ └── TestBooleanOperators.class
│ ├── _4_MathFunctionsCharactersAndStrings
│ │ ├── AlphabeticalOrderInJava.class
│ │ ├── CharAt.class
│ │ ├── GettingStringLength.class
│ │ ├── ReadingStringsFromTheConsole.class
│ │ └── UsingIncrementAndDecrementInChar.class
│ ├── _5_Loops
│ │ ├── DietelChapter5Exercise.class
│ │ ├── Displays.class
│ │ ├── ForEachLoop.class
│ │ ├── FutureTuition.class
│ │ ├── GreatestCommonDivisor.class
│ │ ├── GuessTheNumber.class
│ │ ├── MultiplicationTable.class
│ │ ├── NestedForLoops.class
│ │ ├── RepeatAdditionQuiz.class
│ │ ├── SentinelValue.class
│ │ ├── SentinelValue2.class
│ │ ├── SubtractionQuizLoop.class
│ │ └── TestBreak.class
│ ├── _7_SingleDimensionalArrays
│ │ ├── AnalyzeNumbers.class
│ │ ├── CopyArray.class
│ │ ├── CountLettersInArray.class
│ │ ├── DisplayingMonths.class
│ │ ├── LinearSearch.class
│ │ ├── ProcessingArrays.class
│ │ ├── ReverseArray.class
│ │ ├── SortingIntegerArray.class
│ │ ├── SortingStringArray.class
│ │ └── SwapArrayElements.class
│ ├── _8_MultiDimensionalArrays
│ │ ├── ArraysLists.class
│ │ ├── Display.class
│ │ ├── Display2.class
│ │ ├── Employee.class
│ │ ├── GradeExam.class
│ │ ├── PassTwoDimensionalArray.class
│ │ └── ProcessingTwoDimensionalArrays.class
│ └── _9_ObjectsAndClasses
│ │ ├── Bike.class
│ │ ├── Circle.class
│ │ ├── CircleClass.class
│ │ ├── DateAndTimeClassAndObject.class
│ │ ├── DateClass.class
│ │ ├── Dogs.class
│ │ ├── Factors.class
│ │ ├── MyFirstTdd.class
│ │ ├── Native.class
│ │ ├── NotesOnClassesObjectsAndMethods.class
│ │ ├── RandomClassAndObject.class
│ │ ├── Television.class
│ │ └── Time.class
│ └── Java Programming (Step to Step Guide)
│ ├── Factors.class
│ ├── MyFirstTdd.class
│ ├── Reverse.class
│ ├── _1_IntroToComputerAndPrograms
│ ├── ComputeExpression.class
│ ├── Welcome.class
│ └── WelcomeWithThreeMessages.class
│ ├── _2_ElementaryProgramming
│ ├── ComputeArea.class
│ ├── ComputeAreaWithConsoleInput.class
│ ├── ComputeAverage.class
│ ├── ComputeChange.class
│ ├── ComputeLoan.class
│ ├── DisplayTime.class
│ ├── ExponentOperations.class
│ ├── FahrenheitToCelsius.class
│ ├── PrintF.class
│ ├── SalesTax.class
│ └── ShowCurrentTime.class
│ ├── _3_Selections
│ ├── AdditionQuiz.class
│ ├── ChineseZodiac.class
│ ├── ComputeAndInterpretBMI.class
│ ├── ComputeTax.class
│ ├── LeapYear.class
│ ├── Lottery.class
│ ├── SimpleIfDemo.class
│ ├── SubtractionQuiz.class
│ └── TestBooleanOperators.class
│ ├── _4_MathFunctionsCharactersAndStrings
│ ├── AlphabeticalOrderInJava.class
│ ├── DietelChapter2Exercise.class
│ ├── GettingStringLength.class
│ ├── ReadingStringsFromTheConsole.class
│ └── UsingIncrementAndDecrementInChar.class
│ ├── _5_Loops
│ ├── DietelChapter5Exercise.class
│ ├── ForEachLoop.class
│ ├── FutureTuition.class
│ ├── GreatestCommonDivisor.class
│ ├── GuessTheNumber.class
│ ├── MultiplicationTable.class
│ ├── RepeatAdditionQuiz.class
│ ├── SentinelValue.class
│ ├── SentinelValue2.class
│ ├── SubtractionQuizLoop.class
│ └── TestBreak.class
│ ├── _6_Methods
│ ├── GreatestCommonDivisorMethod.class
│ ├── Increment.class
│ ├── RandomCharacter.class
│ ├── TestMax.class
│ ├── TestMethodOverloading.class
│ ├── TestPassByValue.class
│ ├── TestReturningMethod.class
│ └── TestVoidMethod.class
│ ├── _7_SingleDimensionalArrays
│ ├── AnalyzeNumbers.class
│ ├── CountLettersInArray.class
│ ├── DisplayingMonths.class
│ ├── LinearSearch.class
│ ├── ProcessingArrays.class
│ ├── ReverseArray.class
│ ├── SortingAnArray.class
│ └── SwapArrayElements.class
│ ├── _8_MultiDimensionalArrays
│ ├── ArraysLists.class
│ ├── GradeExam.class
│ ├── PassTwoDimensionalArray.class
│ └── ProcessingTwoDimensionalArrays.class
│ └── _9_ObjectsAndClasses
│ ├── Circle.class
│ ├── CircleClass.class
│ ├── DateAndTimeClassAndObject.class
│ ├── NotesOnClassesObjectsAndMethods.class
│ ├── RandomClassAndObject.class
│ └── Television.class
├── src
├── AnimalInheritance
│ └── Cat.java
├── CAI
│ └── Computer_Assisted_Instruction.java
├── Dietel_Exercise
│ └── Account.java
├── ExceptionsHandling
│ ├── ExceptionHandling.java
│ ├── StudentPoll.java
│ └── StudentPoll2.java
├── HumbleMe
│ ├── Humble1.java
│ ├── Nokia.java
│ ├── humble2.java
│ ├── humble3.java
│ └── packingGarage.java
├── John_Enum
│ ├── DaysOfTheWeek.java
│ └── EnumTutorial.java
├── John_Genereics
│ ├── GenericPrinter.java
│ └── NormalPrinter.java
├── Kunal
│ ├── AbstractDemo
│ │ ├── Daughter.java
│ │ ├── Main.java
│ │ ├── Parent.java
│ │ └── Son.java
│ ├── Extends_ImplementDemo
│ │ ├── Child.java
│ │ ├── Father.java
│ │ └── GrandFather.java
│ ├── Generics
│ │ ├── CustomArrayList.java
│ │ ├── CustomArrayList2.java
│ │ └── GenericsWithOOP
│ │ │ └── Printer.java
│ └── Interface
│ │ ├── CDPlayer.java
│ │ ├── Car.java
│ │ ├── ElectricEngine.java
│ │ ├── MyCar.java
│ │ ├── NotesOnInterface
│ │ ├── PowerEngine.java
│ │ ├── interfaces
│ │ ├── Brake.java
│ │ ├── Engine.java
│ │ └── Media.java
│ │ ├── main
│ │ └── Main.java
│ │ └── nested
│ │ └── A.java
├── LinkedLists
│ └── Main.java
├── PD
│ └── Time.java
├── TodoApp
│ └── Main.java
├── _10_ObjectOrientedThinking
│ ├── AutoBoxingAndUnboxing.java
│ ├── BigIntegerAndBigDecimalClasses.java
│ ├── BmiNew.java
│ ├── ComputeLoanNew.java
│ ├── Course.java
│ ├── ImmutableStrings.java
│ ├── IsDigit.java
│ ├── NotesOnOOP.java
│ ├── Stack.java
│ ├── StackOfIntegers.java
│ ├── TheStringClass.java
│ ├── UsingWrapperClasses.java
│ └── WrapperClasses.java
├── _12_ExceptionHandlingAndTextIO
│ ├── CircleWithCustomException.java
│ ├── CircleWithException.java
│ ├── InputMismatchExceptionDemo.java
│ ├── InvalidRadiusException.java
│ ├── Quotient.java
│ ├── QuotientWithException.java
│ ├── QuotientWithMethod.java
│ └── QuotientWith_IFStatement.java
├── _1_IntroToComputerAndPrograms
│ ├── ComputeExpression.java
│ ├── Welcome.java
│ └── WelcomeWithThreeMessages.java
├── _2_ElementaryProgramming
│ ├── ComputeArea.java
│ ├── ComputeAreaWithConsoleInput.java
│ ├── ComputeAverage.java
│ ├── ComputeChange.java
│ ├── ComputeLoan.java
│ ├── DisplayTime.java
│ ├── ExponentOperations.java
│ ├── FahrenheitToCelsius.java
│ ├── PrintF.java
│ ├── SalesTax.java
│ ├── ShowCurrentTime.java
│ └── SwapValuesOfVariables.java
├── _3_Selections
│ ├── AdditionQuiz.java
│ ├── BMI.java
│ ├── ChineseZodiac.java
│ ├── ComputeTax.java
│ ├── DetermineToday.java
│ ├── LeapYear.java
│ ├── Lottery.java
│ ├── SimpleIfDemo.java
│ ├── SubtractionQuiz.java
│ └── TestBooleanOperators.java
├── _4_MathFunctionsCharactersAndStrings
│ ├── AlphabeticalOrderInJava.java
│ ├── CharAt.java
│ ├── GettingStringLength.java
│ ├── ReadingStringsFromTheConsole.java
│ └── UsingIncrementAndDecrementInChar.java
├── _5_Loops
│ ├── DietelChapter5Exercise.java
│ ├── Displays.java
│ ├── ForEachLoop.java
│ ├── FutureTuition.java
│ ├── GreatestCommonDivisor.java
│ ├── GuessTheNumber.java
│ ├── MultiplicationTable.java
│ ├── NestedForLoops.java
│ ├── RepeatAdditionQuiz.java
│ ├── SentinelValue.java
│ ├── SentinelValue2.java
│ ├── SubtractionQuizLoop.java
│ └── TestBreak.java
├── _6_Methods_Stepwise_Refinement
│ ├── GreatestCommonDivisorMethod.java
│ ├── Human.java
│ ├── Increment.java
│ ├── MultiplicationTable_MethodCall.java
│ ├── RandomCharacter.java
│ ├── TestMax.java
│ ├── TestMethodOverloading.java
│ ├── TestPassByValue.java
│ ├── TestReturningMethod.java
│ └── TestVoidMethod.java
├── _7_SingleDimensionalArrays
│ ├── AnalyzeNumbers.java
│ ├── AnalyzeNumbers_MethodCall.java
│ ├── CopyArray.java
│ ├── CountLettersInArray.java
│ ├── DisplayingMonths.java
│ ├── LinearSearch.java
│ ├── ProcessingArrays.java
│ ├── ReverseArray.java
│ ├── SortingIntegerArray.java
│ ├── SortingStringArray.java
│ └── SwapArrayElements.java
├── _8_MultiDimensionalArrays
│ ├── ArraysLists.java
│ ├── Display.java
│ ├── Display2.java
│ ├── Employee.java
│ ├── GradeExam.java
│ ├── PassTwoDimensionalArray.java
│ └── ProcessingTwoDimensionalArrays.java
├── _9_ObjectsAndClasses
│ ├── Bike.java
│ ├── Circle.java
│ ├── CircleClass.java
│ ├── DateAndTimeClassAndObject.java
│ ├── DateClass.java
│ ├── Dogs.java
│ ├── Factors.java
│ ├── MyFirstTdd.java
│ ├── Native.java
│ ├── NotesOnClassesObjectsAndMethods.java
│ ├── RandomClassAndObject.java
│ ├── ReverseNumber.java
│ ├── Television.java
│ └── Time.java
└── org
│ └── junit
│ └── jupiter
│ └── api
│ ├── Ben_Billion_Explanation.java
│ ├── Ben_Billion_Notes.java
│ ├── Ben_Billion_Test.java
│ └── Key_Point.java
└── test
├── BikeTest.java
├── BmiTest.java
├── ComputeLoanTest.java
├── CopyArrayTest.java
├── NativeTest.java
├── OutlierTest.java
├── TelevisionTest.java
└── com
└── unicornsWimps
├── Animal.java
├── Hare.java
├── RaceCourse.java
├── RaceSimulator.java
├── RaceSimulatorTest.java
└── Tortoise.java
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/inspectionProfiles/Project_Default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Java Programming (A step to step guide).iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/CAI/Computer_Assisted_Instruction.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/CAI/Computer_Assisted_Instruction.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/LinkedLists/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/LinkedLists/Main.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_10_ObjectOrientedThinking/BigIntegerAndBigDecimalClasses.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_10_ObjectOrientedThinking/BigIntegerAndBigDecimalClasses.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_10_ObjectOrientedThinking/BmiNew.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_10_ObjectOrientedThinking/BmiNew.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_10_ObjectOrientedThinking/ComputeLoanNew.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_10_ObjectOrientedThinking/ComputeLoanNew.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_10_ObjectOrientedThinking/Course.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_10_ObjectOrientedThinking/Course.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_10_ObjectOrientedThinking/NotesOnOOP.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_10_ObjectOrientedThinking/NotesOnOOP.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_10_ObjectOrientedThinking/StackOfIntegers.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_10_ObjectOrientedThinking/StackOfIntegers.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_10_ObjectOrientedThinking/UsingWrapperClasses.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_10_ObjectOrientedThinking/UsingWrapperClasses.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_1_IntroToComputerAndPrograms/ComputeExpression.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_1_IntroToComputerAndPrograms/ComputeExpression.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_1_IntroToComputerAndPrograms/Welcome.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_1_IntroToComputerAndPrograms/Welcome.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_1_IntroToComputerAndPrograms/WelcomeWithThreeMessages.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_1_IntroToComputerAndPrograms/WelcomeWithThreeMessages.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_2_ElementaryProgramming/ComputeArea.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_2_ElementaryProgramming/ComputeArea.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_2_ElementaryProgramming/ComputeAreaWithConsoleInput.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_2_ElementaryProgramming/ComputeAreaWithConsoleInput.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_2_ElementaryProgramming/ComputeAverage.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_2_ElementaryProgramming/ComputeAverage.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_2_ElementaryProgramming/ComputeChange.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_2_ElementaryProgramming/ComputeChange.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_2_ElementaryProgramming/ComputeLoan.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_2_ElementaryProgramming/ComputeLoan.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_2_ElementaryProgramming/DisplayTime.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_2_ElementaryProgramming/DisplayTime.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_2_ElementaryProgramming/ExponentOperations.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_2_ElementaryProgramming/ExponentOperations.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_2_ElementaryProgramming/FahrenheitToCelsius.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_2_ElementaryProgramming/FahrenheitToCelsius.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_2_ElementaryProgramming/PrintF.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_2_ElementaryProgramming/PrintF.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_2_ElementaryProgramming/SalesTax.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_2_ElementaryProgramming/SalesTax.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_2_ElementaryProgramming/ShowCurrentTime.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_2_ElementaryProgramming/ShowCurrentTime.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_2_ElementaryProgramming/SwapValuesOfVariables.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_2_ElementaryProgramming/SwapValuesOfVariables.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_3_Selections/AdditionQuiz.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_3_Selections/AdditionQuiz.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_3_Selections/BMI.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_3_Selections/BMI.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_3_Selections/ChineseZodiac.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_3_Selections/ChineseZodiac.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_3_Selections/ComputeTax.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_3_Selections/ComputeTax.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_3_Selections/DetermineToday.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_3_Selections/DetermineToday.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_3_Selections/LeapYear.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_3_Selections/LeapYear.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_3_Selections/Lottery.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_3_Selections/Lottery.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_3_Selections/SimpleIfDemo.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_3_Selections/SimpleIfDemo.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_3_Selections/SubtractionQuiz.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_3_Selections/SubtractionQuiz.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_3_Selections/TestBooleanOperators.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_3_Selections/TestBooleanOperators.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_4_MathFunctionsCharactersAndStrings/AlphabeticalOrderInJava.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_4_MathFunctionsCharactersAndStrings/AlphabeticalOrderInJava.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_4_MathFunctionsCharactersAndStrings/CharAt.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_4_MathFunctionsCharactersAndStrings/CharAt.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_4_MathFunctionsCharactersAndStrings/GettingStringLength.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_4_MathFunctionsCharactersAndStrings/GettingStringLength.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_4_MathFunctionsCharactersAndStrings/ReadingStringsFromTheConsole.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_4_MathFunctionsCharactersAndStrings/ReadingStringsFromTheConsole.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_4_MathFunctionsCharactersAndStrings/UsingIncrementAndDecrementInChar.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_4_MathFunctionsCharactersAndStrings/UsingIncrementAndDecrementInChar.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_5_Loops/DietelChapter5Exercise.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_5_Loops/DietelChapter5Exercise.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_5_Loops/Displays.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_5_Loops/Displays.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_5_Loops/ForEachLoop.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_5_Loops/ForEachLoop.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_5_Loops/FutureTuition.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_5_Loops/FutureTuition.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_5_Loops/GreatestCommonDivisor.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_5_Loops/GreatestCommonDivisor.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_5_Loops/GuessTheNumber.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_5_Loops/GuessTheNumber.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_5_Loops/MultiplicationTable.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_5_Loops/MultiplicationTable.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_5_Loops/NestedForLoops.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_5_Loops/NestedForLoops.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_5_Loops/RepeatAdditionQuiz.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_5_Loops/RepeatAdditionQuiz.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_5_Loops/SentinelValue.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_5_Loops/SentinelValue.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_5_Loops/SentinelValue2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_5_Loops/SentinelValue2.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_5_Loops/SubtractionQuizLoop.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_5_Loops/SubtractionQuizLoop.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_5_Loops/TestBreak.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_5_Loops/TestBreak.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_7_SingleDimensionalArrays/AnalyzeNumbers.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_7_SingleDimensionalArrays/AnalyzeNumbers.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_7_SingleDimensionalArrays/CopyArray.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_7_SingleDimensionalArrays/CopyArray.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_7_SingleDimensionalArrays/CountLettersInArray.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_7_SingleDimensionalArrays/CountLettersInArray.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_7_SingleDimensionalArrays/DisplayingMonths.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_7_SingleDimensionalArrays/DisplayingMonths.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_7_SingleDimensionalArrays/LinearSearch.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_7_SingleDimensionalArrays/LinearSearch.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_7_SingleDimensionalArrays/ProcessingArrays.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_7_SingleDimensionalArrays/ProcessingArrays.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_7_SingleDimensionalArrays/ReverseArray.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_7_SingleDimensionalArrays/ReverseArray.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_7_SingleDimensionalArrays/SortingIntegerArray.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_7_SingleDimensionalArrays/SortingIntegerArray.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_7_SingleDimensionalArrays/SortingStringArray.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_7_SingleDimensionalArrays/SortingStringArray.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_7_SingleDimensionalArrays/SwapArrayElements.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_7_SingleDimensionalArrays/SwapArrayElements.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_8_MultiDimensionalArrays/ArraysLists.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_8_MultiDimensionalArrays/ArraysLists.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_8_MultiDimensionalArrays/Display.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_8_MultiDimensionalArrays/Display.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_8_MultiDimensionalArrays/Display2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_8_MultiDimensionalArrays/Display2.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_8_MultiDimensionalArrays/Employee.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_8_MultiDimensionalArrays/Employee.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_8_MultiDimensionalArrays/GradeExam.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_8_MultiDimensionalArrays/GradeExam.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_8_MultiDimensionalArrays/PassTwoDimensionalArray.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_8_MultiDimensionalArrays/PassTwoDimensionalArray.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_8_MultiDimensionalArrays/ProcessingTwoDimensionalArrays.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_8_MultiDimensionalArrays/ProcessingTwoDimensionalArrays.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_9_ObjectsAndClasses/Bike.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_9_ObjectsAndClasses/Bike.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_9_ObjectsAndClasses/Circle.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_9_ObjectsAndClasses/Circle.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_9_ObjectsAndClasses/CircleClass.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_9_ObjectsAndClasses/CircleClass.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_9_ObjectsAndClasses/DateAndTimeClassAndObject.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_9_ObjectsAndClasses/DateAndTimeClassAndObject.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_9_ObjectsAndClasses/DateClass.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_9_ObjectsAndClasses/DateClass.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_9_ObjectsAndClasses/Dogs.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_9_ObjectsAndClasses/Dogs.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_9_ObjectsAndClasses/Factors.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_9_ObjectsAndClasses/Factors.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_9_ObjectsAndClasses/MyFirstTdd.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_9_ObjectsAndClasses/MyFirstTdd.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_9_ObjectsAndClasses/Native.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_9_ObjectsAndClasses/Native.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_9_ObjectsAndClasses/NotesOnClassesObjectsAndMethods.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_9_ObjectsAndClasses/NotesOnClassesObjectsAndMethods.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_9_ObjectsAndClasses/RandomClassAndObject.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_9_ObjectsAndClasses/RandomClassAndObject.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_9_ObjectsAndClasses/Television.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_9_ObjectsAndClasses/Television.class
--------------------------------------------------------------------------------
/out/production/Java Programming (A step to step guide)/_9_ObjectsAndClasses/Time.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (A step to step guide)/_9_ObjectsAndClasses/Time.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/Factors.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/Factors.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/MyFirstTdd.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/MyFirstTdd.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/Reverse.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/Reverse.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_1_IntroToComputerAndPrograms/ComputeExpression.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_1_IntroToComputerAndPrograms/ComputeExpression.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_1_IntroToComputerAndPrograms/Welcome.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_1_IntroToComputerAndPrograms/Welcome.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_1_IntroToComputerAndPrograms/WelcomeWithThreeMessages.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_1_IntroToComputerAndPrograms/WelcomeWithThreeMessages.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_2_ElementaryProgramming/ComputeArea.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_2_ElementaryProgramming/ComputeArea.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_2_ElementaryProgramming/ComputeAreaWithConsoleInput.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_2_ElementaryProgramming/ComputeAreaWithConsoleInput.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_2_ElementaryProgramming/ComputeAverage.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_2_ElementaryProgramming/ComputeAverage.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_2_ElementaryProgramming/ComputeChange.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_2_ElementaryProgramming/ComputeChange.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_2_ElementaryProgramming/ComputeLoan.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_2_ElementaryProgramming/ComputeLoan.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_2_ElementaryProgramming/DisplayTime.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_2_ElementaryProgramming/DisplayTime.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_2_ElementaryProgramming/ExponentOperations.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_2_ElementaryProgramming/ExponentOperations.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_2_ElementaryProgramming/FahrenheitToCelsius.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_2_ElementaryProgramming/FahrenheitToCelsius.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_2_ElementaryProgramming/PrintF.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_2_ElementaryProgramming/PrintF.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_2_ElementaryProgramming/SalesTax.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_2_ElementaryProgramming/SalesTax.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_2_ElementaryProgramming/ShowCurrentTime.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_2_ElementaryProgramming/ShowCurrentTime.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_3_Selections/AdditionQuiz.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_3_Selections/AdditionQuiz.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_3_Selections/ChineseZodiac.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_3_Selections/ChineseZodiac.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_3_Selections/ComputeAndInterpretBMI.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_3_Selections/ComputeAndInterpretBMI.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_3_Selections/ComputeTax.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_3_Selections/ComputeTax.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_3_Selections/LeapYear.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_3_Selections/LeapYear.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_3_Selections/Lottery.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_3_Selections/Lottery.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_3_Selections/SimpleIfDemo.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_3_Selections/SimpleIfDemo.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_3_Selections/SubtractionQuiz.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_3_Selections/SubtractionQuiz.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_3_Selections/TestBooleanOperators.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_3_Selections/TestBooleanOperators.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_4_MathFunctionsCharactersAndStrings/AlphabeticalOrderInJava.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_4_MathFunctionsCharactersAndStrings/AlphabeticalOrderInJava.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_4_MathFunctionsCharactersAndStrings/DietelChapter2Exercise.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_4_MathFunctionsCharactersAndStrings/DietelChapter2Exercise.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_4_MathFunctionsCharactersAndStrings/GettingStringLength.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_4_MathFunctionsCharactersAndStrings/GettingStringLength.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_4_MathFunctionsCharactersAndStrings/ReadingStringsFromTheConsole.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_4_MathFunctionsCharactersAndStrings/ReadingStringsFromTheConsole.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_4_MathFunctionsCharactersAndStrings/UsingIncrementAndDecrementInChar.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_4_MathFunctionsCharactersAndStrings/UsingIncrementAndDecrementInChar.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_5_Loops/DietelChapter5Exercise.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_5_Loops/DietelChapter5Exercise.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_5_Loops/ForEachLoop.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_5_Loops/ForEachLoop.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_5_Loops/FutureTuition.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_5_Loops/FutureTuition.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_5_Loops/GreatestCommonDivisor.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_5_Loops/GreatestCommonDivisor.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_5_Loops/GuessTheNumber.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_5_Loops/GuessTheNumber.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_5_Loops/MultiplicationTable.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_5_Loops/MultiplicationTable.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_5_Loops/RepeatAdditionQuiz.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_5_Loops/RepeatAdditionQuiz.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_5_Loops/SentinelValue.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_5_Loops/SentinelValue.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_5_Loops/SentinelValue2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_5_Loops/SentinelValue2.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_5_Loops/SubtractionQuizLoop.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_5_Loops/SubtractionQuizLoop.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_5_Loops/TestBreak.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_5_Loops/TestBreak.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_6_Methods/GreatestCommonDivisorMethod.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_6_Methods/GreatestCommonDivisorMethod.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_6_Methods/Increment.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_6_Methods/Increment.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_6_Methods/RandomCharacter.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_6_Methods/RandomCharacter.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_6_Methods/TestMax.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_6_Methods/TestMax.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_6_Methods/TestMethodOverloading.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_6_Methods/TestMethodOverloading.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_6_Methods/TestPassByValue.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_6_Methods/TestPassByValue.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_6_Methods/TestReturningMethod.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_6_Methods/TestReturningMethod.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_6_Methods/TestVoidMethod.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_6_Methods/TestVoidMethod.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_7_SingleDimensionalArrays/AnalyzeNumbers.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_7_SingleDimensionalArrays/AnalyzeNumbers.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_7_SingleDimensionalArrays/CountLettersInArray.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_7_SingleDimensionalArrays/CountLettersInArray.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_7_SingleDimensionalArrays/DisplayingMonths.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_7_SingleDimensionalArrays/DisplayingMonths.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_7_SingleDimensionalArrays/LinearSearch.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_7_SingleDimensionalArrays/LinearSearch.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_7_SingleDimensionalArrays/ProcessingArrays.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_7_SingleDimensionalArrays/ProcessingArrays.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_7_SingleDimensionalArrays/ReverseArray.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_7_SingleDimensionalArrays/ReverseArray.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_7_SingleDimensionalArrays/SortingAnArray.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_7_SingleDimensionalArrays/SortingAnArray.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_7_SingleDimensionalArrays/SwapArrayElements.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_7_SingleDimensionalArrays/SwapArrayElements.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_8_MultiDimensionalArrays/ArraysLists.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_8_MultiDimensionalArrays/ArraysLists.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_8_MultiDimensionalArrays/GradeExam.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_8_MultiDimensionalArrays/GradeExam.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_8_MultiDimensionalArrays/PassTwoDimensionalArray.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_8_MultiDimensionalArrays/PassTwoDimensionalArray.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_8_MultiDimensionalArrays/ProcessingTwoDimensionalArrays.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_8_MultiDimensionalArrays/ProcessingTwoDimensionalArrays.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_9_ObjectsAndClasses/Circle.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_9_ObjectsAndClasses/Circle.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_9_ObjectsAndClasses/CircleClass.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_9_ObjectsAndClasses/CircleClass.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_9_ObjectsAndClasses/DateAndTimeClassAndObject.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_9_ObjectsAndClasses/DateAndTimeClassAndObject.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_9_ObjectsAndClasses/NotesOnClassesObjectsAndMethods.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_9_ObjectsAndClasses/NotesOnClassesObjectsAndMethods.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_9_ObjectsAndClasses/RandomClassAndObject.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_9_ObjectsAndClasses/RandomClassAndObject.class
--------------------------------------------------------------------------------
/out/production/Java Programming (Step to Step Guide)/_9_ObjectsAndClasses/Television.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnyedikaBenjamin/JavaProgramming-A-Step-to-Step-guide-/11ef9f56a554a81a8a5738f7db96dc7af20f801b/out/production/Java Programming (Step to Step Guide)/_9_ObjectsAndClasses/Television.class
--------------------------------------------------------------------------------
/src/AnimalInheritance/Cat.java:
--------------------------------------------------------------------------------
1 | package AnimalInheritance;
2 |
3 | public class Cat extends Animal{
4 | int tail;
5 |
6 | public Cat(String name, int brain, int body, int size, int weight, int tail) {
7 | super(name, brain, body, size, weight);
8 | this.tail = tail;
9 | }
10 |
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/src/ExceptionsHandling/ExceptionHandling.java:
--------------------------------------------------------------------------------
1 | package ExceptionsHandling;
2 | import java.util.Scanner;
3 |
4 | public class ExceptionHandling {
5 | public static void main(String[] args) {
6 | Scanner input = new Scanner(System.in);
7 |
8 | try {
9 | int e = 5 / 0;
10 | System.out.println("This statement won't run because there is an exception preceding it");
11 | } catch (NumberFormatException nfe) {
12 | System.err.println("See his big head!!! " +
13 | " Come-on input something right");
14 | } catch (ArithmeticException ae) {
15 | System.err.println("Just know that is not gonna work ever");
16 | } finally {
17 | System.out.println("The finally block is just used to write a statement after trying and catching");
18 | }
19 |
20 | System.out.println(printNumber());
21 | }
22 |
23 | // Say we have a method that returns a number
24 | public static int printNumber() {
25 | try {
26 | return 3; // let's try a number for exception
27 | } catch (Exception e) {
28 | return 4; // if the number could throw an exception, it should return 4.
29 | } finally {
30 | return 5;
31 | // Remember that the finally block always execute irrespective of any try or catch things.
32 | // A return statement in our finally block will override any statement in both our try and catch block
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/src/ExceptionsHandling/StudentPoll.java:
--------------------------------------------------------------------------------
1 | package ExceptionsHandling;
2 |
3 | import java.util.Scanner;
4 |
5 | public class StudentPoll {
6 |
7 | public static void main(String[] args) {
8 |
9 | Scanner input = new Scanner(System.in);
10 | System.out.print("How many Students rated the food quality? -> ");
11 | int noOfStudents = input.nextInt();
12 |
13 | int[] responses = new int[noOfStudents], frequency = new int[6];
14 |
15 | for (int i = 0; i < noOfStudents; i++) {
16 | System.out.print("What's Student" + (i + 1) + " response?? -> ");
17 | int userResponse = input.nextInt();
18 | responses[i] = userResponse;
19 | }
20 | for (int response : responses) {
21 | try {
22 | // Make element at frequency[0] to be = no Of Occurrence of 1
23 | ++frequency[response];
24 | } catch (ArrayIndexOutOfBoundsException e) {
25 | System.out.println(response + " is above the rating!!. please input a rating from 1 to 5.");
26 | }
27 | }
28 |
29 | System.out.print("Rating\t\tFrequency\n");
30 | for (int rating = 1; rating < frequency.length; rating++) {
31 | System.out.println(rating + "\t\t\t\t" + frequency[rating]);
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/src/ExceptionsHandling/StudentPoll2.java:
--------------------------------------------------------------------------------
1 | package ExceptionsHandling;
2 | public class StudentPoll2 {
3 | public static void main(String[] args) {
4 |
5 | int[] responses =
6 | {1, 2, 5, 4, 3, 5, 2, 1, 3, 3, 1, 4, 3, 3, 3, 2, 3, 3, 2, 14};
7 |
8 | int[] frequency = new int[6]; // array of frequency counters
9 | // for each answer, select responses element and use that value
10 | // as frequency index to determine element to increment
11 | for (int answer = 0; answer < responses.length; answer++) {
12 | try {
13 | ++frequency[responses[answer]];
14 | } catch (ArrayIndexOutOfBoundsException e) {
15 | System.out.println(e); // invokes toString method
16 | System.out.printf(" responses[%d] = %d%n%n",
17 | answer, responses[answer]);
18 | }
19 | }
20 |
21 | System.out.printf("%s%10s%n", "Rating", "Frequency");
22 | for (int rating = 1; rating < frequency.length; rating++) {
23 | System.out.printf("%6d%10d%n", rating, frequency[rating]);
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/src/HumbleMe/Humble1.java:
--------------------------------------------------------------------------------
1 | package HumbleMe;
2 |
3 | import java.util.Scanner;
4 |
5 | public class Humble1 {
6 | private static int number1, number2, userAnswer, correctAnswer;
7 | static Scanner input = new Scanner(System.in);
8 |
9 | public static void startProgram() {
10 | generateNumbers();
11 | promptUser();
12 | computeAndPrint();
13 | }
14 | public static void generateNumbers() {
15 | Scanner input = new Scanner(System.in);
16 | number1 = 10 + (int) (Math.random() * 9);
17 | number2 = 10 + (int) (Math.random() * 9);
18 | }
19 |
20 | public static void promptUser() {
21 | System.out.println("What is " + number1 + " + " + number2 + " ?? -> ");
22 | userAnswer = input.nextInt();
23 | correctAnswer = number1 + number2;
24 | }
25 |
26 | private static void computeAndPrint() {
27 | while (userAnswer != correctAnswer) {
28 | System.out.println("Wrong answer! Please try again, what is " + number1 + " + " + number2 + "?");
29 | userAnswer = input.nextInt();
30 | }
31 | System.out.println("You got it... continue comme cas");
32 | }
33 |
34 |
35 | public static void main(String[] args) {
36 | startProgram();
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/HumbleMe/humble2.java:
--------------------------------------------------------------------------------
1 | package HumbleMe;
2 | // Write a program that prompts the user to enter a number continuously until the number matches
3 | // the randomly generated number. For each user input, the program tells the user whether
4 | // the input is too low or too high, so the user can make the next guess intelligently. */
5 |
6 | import java.util.Scanner;
7 |
8 | public class humble2 {
9 | static Scanner input = new Scanner(System.in);
10 | static int randomNumber, userAnswer;
11 |
12 |
13 | public static void startProgram(){
14 | generateRandomNumber();
15 | promptUser();
16 | computeAndCheck();
17 | }
18 |
19 | public static void generateRandomNumber(){
20 | randomNumber = (int) (Math.random() * 100);
21 | }
22 | public static void promptUser(){
23 | System.out.println("Guess the number -> ");
24 | userAnswer = input.nextInt();
25 | }
26 | public static void computeAndCheck(){
27 | while (userAnswer != randomNumber ){
28 | if(userAnswer > randomNumber){
29 | System.out.print("Guess is too high, Please try again -> ");
30 | }
31 | else
32 | System.out.print("Guess is too low, Please try again -> ");
33 | userAnswer = input.nextInt();
34 | }
35 | System.out.println("Congrats!, you are correct.");
36 | }
37 |
38 | public static void main(String[] args) {
39 | startProgram();
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/HumbleMe/humble3.java:
--------------------------------------------------------------------------------
1 | package HumbleMe;
2 | // Create a program that generates five subtraction questions (i.e number1 - number2), and after a student
3 | // answers all five, the program reports the number of correct answers.
4 | // The program also displays the time spent on the test and lists all the questions.
5 |
6 | import java.util.Scanner;
7 | public class humble3 {
8 | static int number1, number2, userAnswer, correctAnswer, wrongCount, correctCount;
9 | static Scanner input = new Scanner(System.in);
10 | static long startTime, testTime;
11 |
12 | public static void main(String[] args){
13 | startProgram();
14 | }
15 |
16 | public static void startProgram(){
17 | startTime = System.currentTimeMillis();
18 | for(int i = 0; i < 5; i++){
19 | generateSubtractionQuestion();
20 | promptUser();
21 | computeAndPrint();
22 | }
23 | computeTime();
24 | resultReport();
25 | }
26 | public static void generateSubtractionQuestion(){
27 | number1 = (int) (Math.random() * 89);
28 | number2 = (int) (Math.random() * 99);
29 | if(number2 > number1){
30 | int temp = number1;
31 | number1 = number2;
32 | number2 = temp;
33 | }
34 | }
35 |
36 | private static void promptUser() {
37 | System.out.printf("What is " + number1 + " - " + number2 + "? -> ");
38 | userAnswer = input.nextInt();
39 | }
40 | public static void computeAndPrint(){
41 | correctAnswer = number1 - number2;
42 | if(userAnswer != correctAnswer){
43 | wrongCount++;
44 | }
45 | else
46 | correctCount++;
47 | }
48 | public static void computeTime(){
49 | long endTime = System.currentTimeMillis();
50 | testTime = (endTime - startTime) / 1000;
51 | }
52 | public static void resultReport(){
53 | System.out.println("You got " + correctCount + " questions correct and " + wrongCount + "wrong.");
54 | System.out.println("Your test time is : " + testTime + " seconds");
55 | }
56 |
57 |
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/src/John_Enum/DaysOfTheWeek.java:
--------------------------------------------------------------------------------
1 | package John_Enum;
2 |
3 | public enum DaysOfTheWeek {
4 | SUNDAY(4),
5 | MONDAY(5),
6 | TUESDAY(7),
7 | WEDNESDAY(2),
8 | THURSDAY(1),
9 | FRIDAY(3),
10 | SATURDAY(6);
11 | final int preferredDayRating; // We make this field final because we don't want it to be modified.
12 |
13 | DaysOfTheWeek(int preferredDayRating) { //creating a constructor in Enum, we use the default Access Modifier.
14 | this.preferredDayRating = preferredDayRating;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/John_Enum/EnumTutorial.java:
--------------------------------------------------------------------------------
1 | package John_Enum;
2 |
3 | import org.junit.jupiter.api.Ben_Billion_Notes;
4 |
5 | public class EnumTutorial{
6 | @Ben_Billion_Notes("Enums cannot be instantiated")
7 |
8 | public static void main(String[] args) {
9 |
10 | DaysOfTheWeek day = DaysOfTheWeek.MONDAY;
11 |
12 | if(day.equals(DaysOfTheWeek.FRIDAY)){
13 | System.out.println("Hello! its almost weekend");
14 | }
15 |
16 | DaysOfTheWeek.values(); // This is an array of all the days of the week.
17 |
18 | for(DaysOfTheWeek myDay : DaysOfTheWeek.values()){ // For each element in Days of the week,
19 | System.out.println(myDay); // print out the element(myDay).
20 | }
21 |
22 | // DaysOfTheWeek.valueOf("MONDAY");
23 |
24 |
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/John_Genereics/GenericPrinter.java:
--------------------------------------------------------------------------------
1 | package John_Genereics;
2 |
3 | import org.junit.jupiter.api.Ben_Billion_Explanation;
4 | import org.junit.jupiter.api.Ben_Billion_Notes;
5 | import org.junit.jupiter.api.Key_Point;
6 |
7 | @Ben_Billion_Notes("Diametrical to our NormalPrinter class, Here we have an angle bracket beside the class name" +
8 | " Which means our Type parameter, it defines the type of thing this printer is going to hold and print")
9 |
10 | @Key_Point("Generics don't work with primitives types, all we are to use is the Wrapper classes." +
11 | " i.e Integer instead of int, Double instead of Double")
12 |
13 | public class GenericPrinter{
14 | T thingToPrint; @Ben_Billion_Explanation("What we want to print is of type T")
15 |
16 |
17 | public GenericPrinter(T thingToPrint){
18 | this.thingToPrint = thingToPrint;
19 | }
20 |
21 | public static void main(String[] args) {
22 |
23 | @Key_Point("Here (in the angle-brackets) we specify the type of thing our GenericPrinter object will print ... i.e Integer, String")
24 | GenericPrinter genericPrinter1 = new GenericPrinter<>("Ben-Billion");
25 | GenericPrinter genericPrinter2 = new GenericPrinter<>(2022);
26 |
27 | System.out.println("genericPrinter1 prints -> " + genericPrinter1.thingToPrint);
28 | System.out.println("genericPrinter2 prints -> " + genericPrinter2.thingToPrint);
29 | }
30 |
31 | public void print(){
32 | System.out.println(thingToPrint);
33 | }
34 |
35 | }
--------------------------------------------------------------------------------
/src/John_Genereics/NormalPrinter.java:
--------------------------------------------------------------------------------
1 | package John_Genereics;
2 |
3 | import org.junit.jupiter.api.Ben_Billion_Explanation;
4 |
5 | public class NormalPrinter {
6 | Integer thingToPrint; @Ben_Billion_Explanation("What we want to print is of the Integer type")
7 |
8 | public NormalPrinter(Integer thingToPrint) {
9 | this.thingToPrint = thingToPrint;
10 | }
11 |
12 | public static void main(String[] args) {
13 | @Ben_Billion_Explanation("We can now instantiate our printer object to print something of type integer")
14 | NormalPrinter printer = new NormalPrinter(777);
15 | printer.print();
16 | }
17 |
18 | public void print() {
19 | System.out.println(thingToPrint);
20 | }
21 |
22 | }
--------------------------------------------------------------------------------
/src/Kunal/AbstractDemo/Daughter.java:
--------------------------------------------------------------------------------
1 | package Kunal.AbstractDemo;
2 |
3 | public class Daughter extends Parent {
4 | int age;
5 |
6 | public Daughter(int age) {
7 | super(age);
8 | }
9 | @Override
10 | void career() {
11 | System.out.println("I am going to be a nurse");
12 | }
13 |
14 | @Override
15 | void partner() {
16 | System.out.println("I love my husband");
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Kunal/AbstractDemo/Main.java:
--------------------------------------------------------------------------------
1 | package Kunal.AbstractDemo;
2 |
3 | public class Main {
4 | public static void main(String[] args) {
5 |
6 | Daughter daughter = new Daughter(23);
7 | daughter.career();
8 |
9 | Son son = new Son(26);
10 | son.career();
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/Kunal/AbstractDemo/Parent.java:
--------------------------------------------------------------------------------
1 | package Kunal.AbstractDemo;
2 |
3 | import org.junit.jupiter.api.Ben_Billion_Explanation;
4 |
5 | @Ben_Billion_Explanation("For an abstract class, there must be at least one abstract method.\n" +
6 | " If we know that the functions in the parent class needs to be overridden, just make it abstract.\n" +
7 | " We cannot create objects of an abstract class.\n" +
8 | " Also, we cannot create an abstract constructor, being it methods or classes.\n" +
9 | " No final value can be overridden."
10 | )
11 |
12 | public abstract class Parent {
13 | int age;
14 |
15 | public Parent(int age) {
16 | this.age = age;
17 | }
18 | abstract void career();
19 | abstract void partner();
20 | }
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/src/Kunal/AbstractDemo/Son.java:
--------------------------------------------------------------------------------
1 | package Kunal.AbstractDemo;
2 |
3 | public class Son extends Parent {
4 | int age;
5 |
6 | public Son(int age) {
7 | super(age);
8 | }
9 |
10 | @Override
11 | void career() {
12 | System.out.println("I am going to be a Billionaire");
13 | }
14 |
15 | @Override
16 | void partner() {
17 | System.out.println("I love my wife ");
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Kunal/Extends_ImplementDemo/Child.java:
--------------------------------------------------------------------------------
1 | package Kunal.Extends_ImplementDemo;
2 |
3 | import org.junit.jupiter.api.Ben_Billion_Notes;
4 |
5 | public class Child implements Father{
6 | @Ben_Billion_Notes("Remember the Override Annotation denotes that a method has been overridden or an abstract method" +
7 | " has been implemented.\n" +
8 | " Now the child has the attributes of the father.... and now we can provide the implementation of" +
9 | " the abstract methods.")
10 |
11 | @Override
12 |
13 | public void shout() {
14 | System.out.println("Shouts aimlessly");
15 | }
16 |
17 | @Override
18 | public void fight() {
19 | System.out.println("He is a good Fighter");
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Kunal/Extends_ImplementDemo/Father.java:
--------------------------------------------------------------------------------
1 | package Kunal.Extends_ImplementDemo;
2 |
3 | import org.junit.jupiter.api.Ben_Billion_Notes;
4 |
5 | public interface Father extends GrandFather{
6 | @Ben_Billion_Notes("The father inherits the attribute of the Grand-Father, but he can also shout.")
7 | void shout();
8 | }
9 |
--------------------------------------------------------------------------------
/src/Kunal/Extends_ImplementDemo/GrandFather.java:
--------------------------------------------------------------------------------
1 | package Kunal.Extends_ImplementDemo;
2 |
3 | import org.junit.jupiter.api.Ben_Billion_Notes;
4 |
5 | public interface GrandFather {
6 | @Ben_Billion_Notes("Father can fight")
7 | void fight();
8 | }
9 |
--------------------------------------------------------------------------------
/src/Kunal/Generics/CustomArrayList.java:
--------------------------------------------------------------------------------
1 | package Kunal.Generics;
2 |
3 | public class CustomArrayList {
4 | private static int DEFAULT_CAPACITY = 5; // This marks how many items our ArrayList can entail.
5 | private int[] myArrayList; // An array list of type int.
6 | private int size =0; // This denotes the number of elements currently present in the array list
7 | public CustomArrayList(){
8 | this.myArrayList = new int[DEFAULT_CAPACITY];
9 | }
10 |
11 | public static void main(String[] args) {
12 |
13 | CustomArrayList list = new CustomArrayList();
14 | list.add(5); list.add(7); list.add(9); list.add(3); list.add(6);
15 |
16 | list.printArray();
17 | list.set(45, 2);
18 | list.printArray();
19 | list.add(89);
20 | list.printArray();
21 | System.out.printf("%s%d","The array size is ", list.getArraySize());
22 | System.out.println("");
23 | list.remove();
24 | list.printArray();
25 |
26 | list.add(4);
27 | list.printArray();
28 |
29 | }
30 |
31 | public void add(int value){
32 | if(isFull()){
33 | resize();
34 | }
35 | myArrayList[size] = value;
36 | size++;
37 | }
38 |
39 | private boolean isFull() {
40 | return size == myArrayList.length;
41 | }
42 |
43 | private void resize() {
44 | int[]temp = new int[myArrayList.length * 2];
45 | for(int i =0; i < myArrayList.length; i ++){
46 | temp[i] = myArrayList[i];
47 | }
48 | myArrayList = temp;
49 | }
50 |
51 | public void set(int value, int index){
52 | myArrayList[index] = value;
53 | }
54 |
55 | public int remove(){
56 | int removed = myArrayList[size--];
57 | return removed;
58 | }
59 |
60 | public int getArraySize(){
61 | return size;
62 | }
63 |
64 | public void printArray(){
65 | for(int i =0; i < myArrayList.length; i++){
66 | System.out.print(myArrayList[i]+ " ");
67 | }
68 | System.out.println("");
69 | }
70 |
71 | }
72 |
--------------------------------------------------------------------------------
/src/Kunal/Generics/GenericsWithOOP/Printer.java:
--------------------------------------------------------------------------------
1 | package Kunal.Generics.GenericsWithOOP;
2 |
3 | import org.junit.jupiter.api.Ben_Billion_Explanation;
4 | import org.junit.jupiter.api.Ben_Billion_Notes;
5 |
6 | public class Printer { @Ben_Billion_Notes("T means our type parameter, it defines the type of thing this printer is going to hold and print")
7 | T thingToPrint; @Ben_Billion_Notes("What we want to print is of type T")
8 |
9 | public Printer(T thingToPrint) {
10 | this.thingToPrint = thingToPrint;
11 | }
12 | public static void main(String[] args) {
13 | @Ben_Billion_Explanation("We can now instantiate our printer object to print something of type integer")
14 | Printer printer = new Printer<>(777);
15 | printer.print();
16 | }
17 |
18 | public void print() {
19 | System.out.println(thingToPrint);
20 | }
21 |
22 | }
23 |
24 |
25 |
--------------------------------------------------------------------------------
/src/Kunal/Interface/CDPlayer.java:
--------------------------------------------------------------------------------
1 | package Kunal.Interface;
2 |
3 | import Kunal.Interface.interfaces.Media;
4 |
5 | public class CDPlayer implements Media {
6 | @Override
7 | public void start() {
8 | System.out.println("Music Start");
9 | }
10 |
11 | @Override
12 | public void stop() {
13 | System.out.println("Music stop");
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Kunal/Interface/Car.java:
--------------------------------------------------------------------------------
1 | package Kunal.Interface;
2 |
3 | import Kunal.Interface.interfaces.Brake;
4 | import Kunal.Interface.interfaces.Engine;
5 |
6 | public class Car implements Engine, Brake {
7 | @Override
8 | public void start() {
9 | System.out.println("I start like a normal car");
10 | }
11 |
12 | @Override
13 | public void stop() {
14 | System.out.println("I stop like a normal car");
15 | }
16 |
17 | @Override
18 | public void accelerate() {
19 | System.out.println("I accelerate like a normal car");
20 | }
21 |
22 | @Override
23 | public void brake() {
24 | System.out.println("I brake like a normal car");
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Kunal/Interface/ElectricEngine.java:
--------------------------------------------------------------------------------
1 | package Kunal.Interface;
2 |
3 | import Kunal.Interface.interfaces.Engine;
4 |
5 | public class ElectricEngine implements Engine {
6 | @Override
7 | public void start() {
8 | for(int i =0; i < 200000; i++) {
9 | System.out.println("Starting...");
10 | }
11 | System.out.println("Electric Engine has started");
12 | }
13 | @Override
14 | public void stop() {
15 | System.out.println("Electric Engine Stop");
16 | }
17 |
18 | @Override
19 | public void accelerate() {
20 | System.out.println("Electric engine accelerate");
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Kunal/Interface/MyCar.java:
--------------------------------------------------------------------------------
1 | package Kunal.Interface;
2 |
3 | import Kunal.Interface.interfaces.Engine;
4 | import Kunal.Interface.interfaces.Media;
5 |
6 | public class MyCar implements Engine, Media{
7 | private Engine myCarEngine;
8 | private Media myCarPlayer;
9 |
10 | public MyCar(){ // I made my car to have a default engine of type Power engine
11 | this.myCarEngine = new PowerEngine();
12 | this.myCarPlayer = new CDPlayer(); // I made my car to have a default Media of type CDPlayer
13 | }
14 | public MyCar(Engine engine){ // I created a constructor to modify the car engine type whenever I want to.
15 | this.myCarEngine = engine;
16 | }
17 | public void start(){ // This will start the engine based on the engine type
18 | myCarEngine.start();
19 | }
20 | public void stop(){
21 | myCarEngine.stop();
22 | }
23 | public void startMusic(){
24 | myCarPlayer.start();
25 | }
26 | public void stopMusic(){
27 | myCarPlayer.stop();
28 | }
29 | public void upgradeToElectricEngine(){
30 | this.myCarEngine = new ElectricEngine();
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/src/Kunal/Interface/NotesOnInterface:
--------------------------------------------------------------------------------
1 | 1) All methods in an interface must be an abstract method.
2 | 2) Variables declared in the Java Interface are by default final.
3 | 3) An Interface cannot have a constructor, remember its variables are final which means it cannot be overridden.
4 | 4) An abstract class can provide the implementation of the interface
5 | but the interface cannot provide the implementation of the Abstract class
6 | 5) In the abstract class, we use 'Extends' keyword, but in the interface class, we use 'Implements' keyword.
7 | 6) An Interface can implement multiple interface but an abstract class can only extend one.
8 | 7) Interface to Interface, we use the keyword extends, Classes to Interface, we use the keyword implements.
9 | 8) Static interface methods should must have a body.
10 | 9) Interfaces are used in Java to achieve abstraction. By using the implements keyword, a java class can implement
11 | an interface. In general terms, an interface can be defined as a container that stores the signatures of the methods
12 | to be implemented in the code segment. It improves the levels of Abstraction.
--------------------------------------------------------------------------------
/src/Kunal/Interface/PowerEngine.java:
--------------------------------------------------------------------------------
1 | package Kunal.Interface;
2 |
3 | import Kunal.Interface.interfaces.Engine;
4 |
5 | public class PowerEngine implements Engine {
6 | @Override
7 | public void start() {
8 | System.out.println("Power Engine Start");
9 | }
10 |
11 | @Override
12 | public void stop() {
13 | System.out.println("Power Engine Stop");
14 | }
15 |
16 | @Override
17 | public void accelerate() {
18 | System.out.println("Power Engine Accelerate");
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Kunal/Interface/interfaces/Brake.java:
--------------------------------------------------------------------------------
1 | package Kunal.Interface.interfaces;
2 |
3 | public interface Brake {
4 | void brake();
5 | void start();
6 | }
7 |
--------------------------------------------------------------------------------
/src/Kunal/Interface/interfaces/Engine.java:
--------------------------------------------------------------------------------
1 | package Kunal.Interface.interfaces;
2 |
3 | public interface Engine {
4 | static final int PRICE = 78000;
5 |
6 | default void start() {
7 | System.out.println("Started");
8 | }
9 | default void stop() {
10 | System.out.println("Engine Stopped");
11 | }
12 | default void accelerate() {
13 | System.out.println("Accelerating...");
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Kunal/Interface/interfaces/Media.java:
--------------------------------------------------------------------------------
1 | package Kunal.Interface.interfaces;
2 |
3 | public interface Media {
4 | void start();
5 | void stop();
6 | }
7 |
--------------------------------------------------------------------------------
/src/Kunal/Interface/main/Main.java:
--------------------------------------------------------------------------------
1 | package Kunal.Interface.main;
2 |
3 | import Kunal.Interface.MyCar;
4 |
5 | public class Main {
6 | public static void main(String[] args) {
7 |
8 | MyCar car = new MyCar();
9 | car.start();
10 | car.stop();
11 | car.upgradeToElectricEngine();
12 | car.start();
13 | // car.startMusic();
14 | // car.stopMusic();
15 | // car.stop();
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Kunal/Interface/nested/A.java:
--------------------------------------------------------------------------------
1 | package Kunal.Interface.nested;
2 |
3 | public class A {
4 | public interface NestedInterface {
5 | boolean isOdd(int num);
6 | }
7 | }
8 | class B implements A.NestedInterface{
9 |
10 | @Override
11 | public boolean isOdd(int num) {
12 | return (num & 1) == 1;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/LinkedLists/Main.java:
--------------------------------------------------------------------------------
1 | package LinkedLists;
2 |
3 | import java.util.Iterator;
4 | import java.util.LinkedList;
5 |
6 | public class Main {
7 | public static void main(String[] args) {
8 | LinkedList placesToVisit = new LinkedList();
9 | placesToVisit.add("Sydney");
10 | placesToVisit.add("Melbourne");
11 | placesToVisit.add("Brisbane");
12 | placesToVisit.add("Perth");
13 | placesToVisit.add("Canberra");
14 | placesToVisit.add("Adelaide");
15 | placesToVisit.add("Darwin");
16 |
17 | placesToVisit.add(1, "Alice Springs");
18 | placesToVisit.remove(4);
19 |
20 | printList(placesToVisit);
21 | }
22 |
23 | private static void printList(LinkedList linkedList){
24 | Iterator i = linkedList.iterator();
25 | while(i.hasNext()){
26 | System.out.println("Now visiting " + i.next());
27 | }
28 | System.out.println("===============================");
29 | }
30 |
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/src/PD/Time.java:
--------------------------------------------------------------------------------
1 | package PD;
2 |
3 | public class Time {
4 | private int hour;
5 | private int minute;
6 | private int second;
7 |
8 | public static void main(String[] args) {
9 | Time time1 = new Time();
10 | System.out.print("After the time object is created -> "
11 | + time1.displayTime());
12 | System.out.println("");
13 | System.out.print("After Setting it with positive values -> ");
14 | time1.setTime(6, 16, 59);
15 | System.out.println(time1.displayTime());
16 | System.out.println("");
17 | System.out.println("Attempt to set time with values out of range -> ");
18 | time1.setTime(99, 80, 70);
19 | System.out.println(time1.displayTime());
20 | }
21 |
22 | // Set a new time, Throw an exception if the user inout is invalid.
23 | public void setTime(int hour, int minute, int second){
24 | if(hour < 0 || hour >= 24 || minute < 0 || minute > 59 || second < 0 || second > 59){
25 | throw new IllegalArgumentException("Hour, Minute or Second out of range");
26 | }
27 | this.hour = hour;
28 | this.minute = minute;
29 | this.second = second;
30 | }
31 |
32 | // Display in universal time format
33 | public String configureTimeToUniversalString(){
34 | return String.format("%02d:%02d:%02d", hour, minute, second);
35 | }
36 |
37 | public String displayTime(){
38 | if(hour == 0 || hour < 12){
39 | return configureTimeToUniversalString() + " AM";
40 | }
41 | return configureTimeToUniversalString() + " PM";
42 | }
43 |
44 |
45 |
46 |
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/src/TodoApp/Main.java:
--------------------------------------------------------------------------------
1 | package TodoApp;
2 |
3 | import TodoApp.App.TodoList;
4 |
5 | public class Main {
6 |
7 | /**
8 | * To run the program, we will create a TodoList Object
9 | * then we will run start on it
10 | *
11 | *
12 | * Example of a file path to read from or save to
13 | * /XXXX/XXXX/XXXX/file.txt
14 | *
15 | *
16 | * After reading press 5 to display the tasks that were read from the file.
17 | *
18 | * Enjoy using the program!
19 | *
20 | */
21 | public static void main(String[] args) {
22 |
23 |
24 | TodoList toDoList = new TodoList();
25 |
26 | toDoList.start();
27 | }
28 |
29 |
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/src/_10_ObjectOrientedThinking/AutoBoxingAndUnboxing.java:
--------------------------------------------------------------------------------
1 | package _10_ObjectOrientedThinking;
2 |
3 | public class AutoBoxingAndUnboxing {
4 | public static void main(String[] args) {
5 |
6 | // Converting a primitive value to a wrapper object is called boxing. The reverse conversion is called unboxing.
7 | // The compiler will automatically box a primitive value that appears in a context requiring an object, and will
8 | // unbox an object that appears in a context requiring a primitive value. This is called autoboxing and autoUnboxing.
9 |
10 | Integer intObject = new Integer(2);
11 | Integer intObject2 = 2; // This is referred to as auto-boxing.
12 |
13 | Integer[] intArray = {1, 2, 3}; //The primitives 1, 2, and 3 are automatically boxed into objects new Integer(1), new Integer(2), and new Integer(3).
14 |
15 | System.out.println(intArray[0] + intArray[1] + intArray[2]); // The objects intArray[ 0],intArray[1], and intArray[2] are automatically unboxed into int values that are added together.
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/_10_ObjectOrientedThinking/BigIntegerAndBigDecimalClasses.java:
--------------------------------------------------------------------------------
1 | package _10_ObjectOrientedThinking;
2 | //The BigInteger and BigDecimal classes can be used to represent integers or
3 | //decimal numbers of any size and precision.
4 |
5 | import java.math.*;
6 |
7 | public class BigIntegerAndBigDecimalClasses {
8 | public static void main(String[] args) {
9 | BigInteger a = new BigInteger("9223372036854775807");
10 | BigInteger b = new BigInteger("2");
11 | BigInteger c = a.multiply(b); // 9223372036854775807 * 2
12 | System.out.println(c);
13 |
14 | /*
15 | There is no limit to the precision of a BigDecimal object. The divide method may throw
16 | an ArithmeticException if the result cannot be terminated. However, you can use the overloaded
17 | divide(BigDecimal d, int scale, int roundingMode) method to specify a scale and a rounding mode to avoid this
18 | exception, where scale is the maximum number of digits after the decimal point. For example, the following code
19 | creates two BigDecimal objects and performs division with scale 20 and rounding mode BigDecimal.ROUND_UP.
20 | */
21 | BigDecimal d = new BigDecimal(1.0);
22 | BigDecimal e = new BigDecimal(3);
23 | // BigDecimal f = a.divide(e, 20, BigDecimal.ROUND_UP);
24 | System.out.println(d);
25 | }
26 | }
--------------------------------------------------------------------------------
/src/_10_ObjectOrientedThinking/Course.java:
--------------------------------------------------------------------------------
1 | package _10_ObjectOrientedThinking;
2 |
3 | public class Course{
4 | private String courseName;
5 | private String[] students = new String[100];
6 | private int noOfStudents;
7 |
8 | public Course(String courseName){
9 | this.courseName = "CourseName";
10 | }
11 |
12 | public static void main(String[] args) {
13 | Course course1 = new Course("Data Base Management");
14 | Course course2 = new Course("System Analysis and design");
15 |
16 | course1.addStudents("Benjamin");
17 | course1.addStudents("Billion");
18 | for (int i =0; i < course1.getNoOfStudents(); i++) {
19 | System.out.println(course1.students[i]);
20 | }
21 | System.out.println("Number of students in course1 is " + course1.getNoOfStudents());
22 |
23 |
24 | }
25 |
26 | public void addStudents(String student){
27 | students[noOfStudents] = student;
28 | noOfStudents++;
29 | }
30 |
31 | public String[] getStudents(){
32 | return students;
33 | }
34 |
35 | public int getNoOfStudents(){
36 | return noOfStudents;
37 | }
38 |
39 | public String getCourseName(){
40 | return courseName;
41 | }
42 |
43 | public void dropStudent(){}
44 |
45 | }
--------------------------------------------------------------------------------
/src/_10_ObjectOrientedThinking/ImmutableStrings.java:
--------------------------------------------------------------------------------
1 | package _10_ObjectOrientedThinking;
2 |
3 | public class ImmutableStrings {
4 | public static void main(String[] args) {
5 | String s = "Good day";
6 | s = "HTML";
7 | System.out.println(s);
8 | }
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/src/_10_ObjectOrientedThinking/IsDigit.java:
--------------------------------------------------------------------------------
1 | package _10_ObjectOrientedThinking;
2 |
3 | public class IsDigit {
4 |
5 | public static void main(String[] args) {
6 | String str = "2o";
7 | System.out.println(isDigit(str));
8 | }
9 | public static boolean isDigit(String s) {
10 | return s.matches("[-+]?\\d*\\.?\\d+");
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/_10_ObjectOrientedThinking/NotesOnOOP.java:
--------------------------------------------------------------------------------
1 | package _10_ObjectOrientedThinking;
2 | /**
3 | *ABSTRACTION :
4 | * Abstraction have to do with hiding the implementation of a method from the caller of the object.
5 | * i.e we have a method 'validateNumber()' the user can call the method without knowing the implementations behind it.
6 | *
7 | *INHERITANCE :
8 | * Inheritance uses the keyword 'extends' to show that a child class uses the attributes or methods of a Parent class
9 | * but can provide it own implementation on how the method should work(Overriding).
10 | *
11 | * POLYMORPHISM :
12 | * It has to do with
13 | *
14 | * ENCAPSULATION :
15 | *
16 | *
17 | * Interface specifies what a class must do. A class can have more than one interface.
18 | * While a class can only inherit one parent class.
19 | * */
20 |
21 | public class NotesOnOOP {
22 | }
23 |
--------------------------------------------------------------------------------
/src/_10_ObjectOrientedThinking/StackOfIntegers.java:
--------------------------------------------------------------------------------
1 | package _10_ObjectOrientedThinking;
2 |
3 | public class StackOfIntegers {
4 | public static final int defaultCapacity = 16;
5 | private int[] elements;
6 | private int size;
7 |
8 | // Construct a stack with the default capacity 16
9 | public StackOfIntegers() {
10 | this(defaultCapacity);
11 | }
12 |
13 | // Construct a stack with the specified maximum capacity
14 | public StackOfIntegers(int capacity) {
15 | elements = new int[capacity];
16 | }
17 |
18 | // Push a new integer to the top of the stack
19 |
20 | public void push(int value) {
21 | if (size >= elements.length) {
22 | int[] temp = new int[elements.length * 2];
23 | System.arraycopy(elements, 0, temp, 0, elements.length);
24 | elements = temp;
25 | }
26 |
27 | elements[size++] = value;
28 | }
29 |
30 | // Return and remove the top element from the stack
31 |
32 | public int pop() {
33 | return elements[--size];
34 | }
35 |
36 | // Return the top element from the stack
37 | public int peek() {
38 | return elements[size - 1];
39 | }
40 |
41 |
42 | // Test whether the stack is empty
43 | public boolean empty() {
44 | return size == 0;
45 | }
46 |
47 | // Return the number of elements in the stack
48 | public int getSize() {
49 | return size;
50 | }
51 |
52 | }
53 |
54 |
55 |
--------------------------------------------------------------------------------
/src/_10_ObjectOrientedThinking/TheStringClass.java:
--------------------------------------------------------------------------------
1 | package _10_ObjectOrientedThinking;
2 |
3 | public class TheStringClass {
4 | // charAt index
5 | // length()
6 | // subString
7 | // indexOf
8 | // lastIndexOf
9 | public static void main(String[] args) {
10 | String element = "Bananas";
11 |
12 | System.out.println(element.charAt(4));
13 | System.out.println(element.length());
14 | System.out.println(element.substring(2)); // This will return all the elements from index 2
15 | System.out.println(element.substring(1, 4)); // This will return all the element from index1 to index3
16 | System.out.println(element.indexOf("a"));
17 | System.out.println(element.indexOf('s'));
18 | System.out.println(element.lastIndexOf('n'));
19 | System.out.println(element.lastIndexOf("a"));
20 | }
21 | }
22 |
23 |
--------------------------------------------------------------------------------
/src/_10_ObjectOrientedThinking/UsingWrapperClasses.java:
--------------------------------------------------------------------------------
1 | package _10_ObjectOrientedThinking;
2 |
3 | public class UsingWrapperClasses {
4 | public static void main(String[] args) {
5 |
6 | // The numeric wrapper classes contain the "compareTo method" for comparing two numbers
7 | System.out.println(new Double(12.4).compareTo(new Double(12.3))); //returns 1;
8 | System.out.println(new Double(12.3).compareTo(new Double(12.3))); //returns 0;
9 | System.out.println(Double.compare(12.3, 12.51)); //returns -1;
10 |
11 | Integer x = 3, y = 7, z = 7;
12 | System.out.printf("%d%s%n",x.compareTo(y), " -> returns -1 because x is less than y");
13 | System.out.printf("%d%s%n",y.compareTo(x), " -> returns 1 because y is greater than x");
14 | System.out.printf("%d%s%n",z.compareTo(y), " -> returns 0 because z is equal to y");
15 |
16 |
17 | // The parseInt and parseDouble classes are used to parse a numeric figure into a digit or floating point value.
18 | String element = "345.78";
19 | // System.out.println(Integer.parseInt(element)); // this returns the numeric value in the String element.
20 | System.out.println(Double.parseDouble(element)); // This returns the double value of the String element.
21 |
22 | // Using the valueOf wrapper class
23 | String ID = "678.12";
24 | System.out.println(Double.valueOf(ID)); // This returns 678.12 that is the double value of ID.
25 |
26 | // Using the intValue() and doubleValue() wrapper classes..This will first compute the Double.valueOf or Int.valueOf
27 | // and then return the value in an int or doubleValue as specified.
28 | String amount = "919.789";
29 | System.out.println("a is " + Double.valueOf(amount).doubleValue()); // This will return 919.789
30 | System.out.println("b is " + Double.valueOf(amount).intValue()); // This will return 919
31 | System.out.println("c is " + Double.valueOf(amount).toString()); // This will return the string value of amount that is 919.789
32 |
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/_10_ObjectOrientedThinking/WrapperClasses.java:
--------------------------------------------------------------------------------
1 | package _10_ObjectOrientedThinking;
2 |
3 |
4 | public class WrapperClasses {
5 | public static void main(String[] args) {
6 |
7 |
8 | // The String class contain the compareTo method for comparing two strings.
9 | String password1 = "2300", password2 = "Phenomenally", password3 = "ZipDemon";
10 |
11 |
12 | // The numeric wrapper classes contain the compareTo method for comparing two numbers
13 | System.out.println(new Double(12.4).compareTo(new Double(12.3))); //returns 1;
14 | System.out.println(new Double(12.3).compareTo(new Double(12.3))); //returns 0;
15 | System.out.println(new Double(12.3).compareTo(new Double(12.51))); //returns -1;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/_12_ExceptionHandlingAndTextIO/CircleWithCustomException.java:
--------------------------------------------------------------------------------
1 | package _12_ExceptionHandlingAndTextIO;
2 |
3 | class CircleWithCustomException {
4 | private static int objects = 0;
5 | private double radius;
6 |
7 | public CircleWithCustomException() throws InvalidRadiusException {
8 | this(1.0);
9 | }
10 |
11 | public CircleWithCustomException(double newRadius)throws InvalidRadiusException{
12 | setRadius(newRadius);
13 | objects++;
14 | }
15 |
16 | public static void main(String[] args){
17 |
18 | try {
19 | CircleWithCustomException circle1 = new CircleWithCustomException(-5);
20 | new CircleWithCustomException(-5);
21 | new CircleWithCustomException(-5);
22 | } catch (InvalidRadiusException ex) {
23 | System.out.println(ex);
24 | }
25 | System.out.println("There are " + objects + " objects created.");
26 | }
27 |
28 | public double getRadius() {
29 | return radius;
30 | }
31 |
32 | public void setRadius(double newRadius)throws InvalidRadiusException {
33 | if(radius >= 0){
34 | radius = newRadius;
35 | }
36 | else {
37 | throw new InvalidRadiusException(newRadius);
38 | }
39 | }
40 |
41 | public int showNumberOfObjects(){
42 | return objects;
43 | }
44 |
45 | public double showArea(){
46 | return getRadius() * getRadius() * 3.14;
47 | }
48 | }
--------------------------------------------------------------------------------
/src/_12_ExceptionHandlingAndTextIO/CircleWithException.java:
--------------------------------------------------------------------------------
1 | package _12_ExceptionHandlingAndTextIO;
2 |
3 | public class CircleWithException {
4 | /** The number of the objects created */
5 | private static int numberOfObjects = 0;
6 | /** The radius of the circle */
7 | private double radius;
8 |
9 | /** Construct a circle with radius 1 */
10 | public CircleWithException() {
11 | this(1.0);
12 | }
13 |
14 | /** Construct a circle with a specified radius */
15 | public CircleWithException(double newRadius) {
16 | setRadius(newRadius);
17 | numberOfObjects++;
18 | }
19 |
20 | /** Return numberOfObjects */
21 | public static int getNumberOfObjects() {
22 | return numberOfObjects;
23 | }
24 |
25 | public static void main(String[] args) {
26 | try {
27 | CircleWithException c1 = new CircleWithException(5);
28 | CircleWithException c2 = new CircleWithException(-5);
29 | CircleWithException c3 = new CircleWithException(0);
30 | }
31 | catch (IllegalArgumentException ex) {
32 | System.out.println(ex);
33 | }
34 |
35 | System.out.println("Number of objects created: " +
36 | CircleWithException.getNumberOfObjects());
37 | }
38 |
39 | /** Return radius */
40 | public double getRadius() {
41 | return radius;
42 | }
43 |
44 | /** Set a new radius */
45 | public void setRadius(double newRadius)
46 | throws IllegalArgumentException {
47 | if (newRadius >= 0)
48 | radius = newRadius;
49 | else
50 | throw new IllegalArgumentException(
51 | "Radius cannot be negative");
52 | }
53 |
54 | /** Return the area of this circle */
55 | public double findArea() {
56 | return radius * radius * 3.14159;
57 | }
58 | }
--------------------------------------------------------------------------------
/src/_12_ExceptionHandlingAndTextIO/InputMismatchExceptionDemo.java:
--------------------------------------------------------------------------------
1 | package _12_ExceptionHandlingAndTextIO;
2 |
3 | import java.util.InputMismatchException;
4 | import java.util.Scanner;
5 |
6 | public class InputMismatchExceptionDemo{
7 | static final int GUESS_NUMBER = 4;
8 | static Scanner input = new Scanner(System.in);
9 | static int userInput;
10 |
11 | public static void main(String[] args) {
12 | startProgram();
13 | }
14 | public static void startProgram() {
15 | try{
16 | promptUser();
17 | while (inputDoesNotMatch()){
18 | System.out.println("You are wrong!");
19 | startProgram();}}
20 | catch(InputMismatchException ime){
21 | System.out.println("This is not a valid integer number.");}}
22 | private static boolean inputDoesNotMatch() {
23 | return userInput != GUESS_NUMBER;}
24 | public static void promptUser(){
25 | System.out.print("Enter the guess number -> ");
26 | userInput = input.nextInt();
27 | }
28 | }
--------------------------------------------------------------------------------
/src/_12_ExceptionHandlingAndTextIO/InvalidRadiusException.java:
--------------------------------------------------------------------------------
1 | package _12_ExceptionHandlingAndTextIO;
2 |
3 | public class InvalidRadiusException extends Exception{
4 | private double radius;
5 | public InvalidRadiusException(double radius){
6 | super("Invalid radius : " + radius); // This invokes the superclass’s constructor with a message. This message will be set in the exception object and can be obtained by invoking getMessage() on the object.
7 | this.radius = radius;
8 | }
9 | public double getRadius() {
10 | return radius;
11 | }
12 | }
--------------------------------------------------------------------------------
/src/_12_ExceptionHandlingAndTextIO/Quotient.java:
--------------------------------------------------------------------------------
1 | package _12_ExceptionHandlingAndTextIO;
2 |
3 | import java.util.Scanner;
4 |
5 | // Write a program that reads 2 integers and displays their quotient.
6 | public class Quotient {
7 | public static void main(String[] args) {
8 | Scanner input = new Scanner(System.in);
9 | System.out.print("Enter two numbers separated by spaces -> : ");
10 | int number1 = input.nextInt();
11 | int number2 = input.nextInt();
12 | int quotient = number1 / number2;
13 |
14 | // Let's say we input 3 and Zero
15 | System.out.println("The result of dividing 3 by zero is " + quotient);
16 | }
17 | }
--------------------------------------------------------------------------------
/src/_12_ExceptionHandlingAndTextIO/QuotientWithException.java:
--------------------------------------------------------------------------------
1 | package _12_ExceptionHandlingAndTextIO;
2 |
3 | import java.util.Scanner;
4 |
5 | public class QuotientWithException{
6 | public static void startProgram() {
7 | Scanner input = new Scanner(System.in);
8 | System.out.print("Enter two numbers separated by spaces -> : ");
9 | int number1 = input.nextInt();
10 | int number2 = input.nextInt();
11 |
12 | try {
13 | int quotient = number1 / number2;
14 | System.out.println("The quotient is " + quotient);
15 | } catch (ArithmeticException arithmeticException) {
16 | System.out.println("The divisor cannot be zero");
17 | startProgram();
18 | }
19 | System.out.println("Execution continues....");
20 | }
21 |
22 | public static void main(String[] args) {
23 | startProgram();
24 | }
25 | }
--------------------------------------------------------------------------------
/src/_12_ExceptionHandlingAndTextIO/QuotientWithMethod.java:
--------------------------------------------------------------------------------
1 | package _12_ExceptionHandlingAndTextIO;
2 |
3 | import java.util.Scanner;
4 |
5 | public class QuotientWithMethod {
6 | public static int showQuotient(int number1, int number2){
7 | if(number2 == 0){
8 | System.out.println("Divisor cannot be zero!");
9 | System.exit(5); // This command will terminate the program
10 | }
11 | return number1/number2;
12 | }
13 |
14 | public static void main(String[] args) {
15 | Scanner input = new Scanner(System.in);
16 | System.out.println("Enter 2 numbers separated by spaces -> : ");
17 | int number1 = input.nextInt();
18 | int number2 = input.nextInt();
19 | System.out.println(showQuotient(number1, number2));
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/_12_ExceptionHandlingAndTextIO/QuotientWith_IFStatement.java:
--------------------------------------------------------------------------------
1 | package _12_ExceptionHandlingAndTextIO;
2 |
3 | import java.util.Scanner;
4 |
5 | public class QuotientWith_IFStatement {
6 | public static void main(String[] args) {
7 | Scanner input = new Scanner(System.in);
8 | System.out.print("Enter two numbers separated by spaces -> : ");
9 | int number1 = input.nextInt();
10 | int number2 = input.nextInt();
11 | if(number2 != 0){
12 | System.out.println("The result of dividing " + number1 + " by " + number2 + " is : " + (number1/number2));}
13 | else {
14 | System.out.println("Divisor cannot be Zero");}
15 | }
16 | }
--------------------------------------------------------------------------------
/src/_1_IntroToComputerAndPrograms/ComputeExpression.java:
--------------------------------------------------------------------------------
1 | package _1_IntroToComputerAndPrograms;
2 |
3 | public class ComputeExpression {
4 |
5 | public static void main(String[] args) {
6 |
7 | System.out.println((10.5 + 2 * 3 )/ (45 - 3.5));
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/_1_IntroToComputerAndPrograms/Welcome.java:
--------------------------------------------------------------------------------
1 | package _1_IntroToComputerAndPrograms;
2 |
3 | public class Welcome {
4 |
5 | public static void main(String[] args) {
6 |
7 | System.out.println("Welcome to JAVA programming");
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/_1_IntroToComputerAndPrograms/WelcomeWithThreeMessages.java:
--------------------------------------------------------------------------------
1 | package _1_IntroToComputerAndPrograms;
2 |
3 | public class WelcomeWithThreeMessages {
4 |
5 | public static void main(String[] args) {
6 | System.out.println("Programming is fun!");
7 | System.out.println("Fundamentals First");
8 | System.out.println("Problem Driven");
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/_2_ElementaryProgramming/ComputeArea.java:
--------------------------------------------------------------------------------
1 | package _2_ElementaryProgramming;
2 |
3 | public class ComputeArea {
4 |
5 | public static void main(String[] args) {
6 | double radius = 20;
7 | double area = radius * radius * 3.14;
8 |
9 | System.out.println("The area for the circle of radius " + radius + " is " + area);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/_2_ElementaryProgramming/ComputeAreaWithConsoleInput.java:
--------------------------------------------------------------------------------
1 | package _2_ElementaryProgramming;
2 |
3 | import java.util.Scanner;
4 |
5 | public class ComputeAreaWithConsoleInput {
6 |
7 | public static void main(String[] args) {
8 | Scanner input = new Scanner(System.in);
9 |
10 | System.out.print("Enter a number for radius : ");
11 | double radius = input.nextDouble();
12 | double area = radius * radius * 3.14;
13 |
14 | System.out.println(area);
15 | }
16 | }
17 |
18 | // 'System.in' shows that Input is going in while 'System.out' shows that info is going out.
--------------------------------------------------------------------------------
/src/_2_ElementaryProgramming/ComputeAverage.java:
--------------------------------------------------------------------------------
1 | package _2_ElementaryProgramming;
2 |
3 | import java.util.Scanner;
4 |
5 | public class ComputeAverage {
6 | public static void main(String[] args) {
7 | Scanner input = new Scanner(System.in);
8 |
9 | System.out.print("Enter number 1 : ");
10 | double number1 = input.nextDouble();
11 |
12 | System.out.print("Enter number 2 : ");
13 | double number2 = input.nextDouble();
14 |
15 | System.out.print("Enter number3 : ");
16 | double number3 = input.nextDouble();
17 |
18 | double average = (number1 + number2 + number3) / 3;
19 |
20 | System.out.println("The average of the numbers is : " + average);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/_2_ElementaryProgramming/ComputeChange.java:
--------------------------------------------------------------------------------
1 | package _2_ElementaryProgramming;
2 | import java.util.Scanner;
3 | public class ComputeChange {
4 |
5 | public static void main(String[] args) {
6 | Scanner input = new Scanner(System.in);
7 |
8 | System.out.print(
9 | "Enter an amount in double, for example 34.56: ");
10 | double amount = input.nextDouble();
11 |
12 | int remainingAmount = (int) (amount * 100);
13 |
14 | // Find the number of one dollar
15 | int numberOfOneDollars = remainingAmount / 100;
16 | remainingAmount = remainingAmount % 100;
17 |
18 | // Find the number of quarters in the remaining amount
19 | int numberOfQuarters = remainingAmount / 25;
20 |
21 | remainingAmount = remainingAmount % 25;
22 |
23 | // Find the number of dimes in the remaining amount
24 | int numberOfDimes = remainingAmount / 10;
25 | remainingAmount = remainingAmount % 10;
26 | // Find the number of nickels in the remaining amount
27 | int numberOfNickels = remainingAmount / 5;
28 | remainingAmount = remainingAmount % 5;
29 |
30 | // Find the number of pennies in the remaining amount
31 | int numberOfPennies = remainingAmount;
32 |
33 | // Display results
34 | System.out.println("Your amount " + amount + " consists of");
35 | System.out.println(" " + numberOfOneDollars + " dollars");
36 | System.out.println(" " + numberOfQuarters + " quarters ");
37 | System.out.println(" " + numberOfDimes + " dimes");
38 | System.out.println(" " + numberOfNickels + " nickels");
39 | System.out.println(" " + numberOfPennies + " pennies");
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/_2_ElementaryProgramming/ComputeLoan.java:
--------------------------------------------------------------------------------
1 | package _2_ElementaryProgramming;
2 |
3 | import java.util.Scanner;
4 | public class ComputeLoan {
5 |
6 | public static void main(String[] args) {
7 |
8 | Scanner input = new Scanner(System.in);
9 |
10 | System.out.print("Enter annual interest rate, e.g., 7.25%: ");
11 | double annualInterestRate = input.nextDouble();
12 |
13 | // Obtain monthly interest rate
14 | double monthlyInterestRate = annualInterestRate / 1200;
15 |
16 | // Enter number of years
17 | System.out.print(
18 | "Enter number of years as an integer, e.g., 5: ");
19 | int numberOfYears = input.nextInt();
20 |
21 | // Enter loan amount
22 | System.out.print("Enter loan amount, e.g., 120000.95: ");
23 | double loanAmount = input.nextDouble();
24 |
25 | // Calculate payment
26 | double monthlyPayment = loanAmount * monthlyInterestRate / (1
27 | - 1 / Math.pow(1 + monthlyInterestRate, numberOfYears * 12));
28 |
29 | double totalPayment = monthlyPayment * numberOfYears * 12;
30 |
31 |
32 | System.out.println("The monthly payment is $" +
33 | monthlyPayment);
34 | System.out.println("The total payment is $" +
35 | totalPayment);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/_2_ElementaryProgramming/DisplayTime.java:
--------------------------------------------------------------------------------
1 | package _2_ElementaryProgramming;
2 |
3 | import java.util.Scanner;
4 |
5 | public class DisplayTime {
6 |
7 | public static void main(String[] args) {
8 | Scanner input = new Scanner(System.in);
9 |
10 | System.out.print("Enter seconds : ");
11 | int seconds = input.nextInt();
12 |
13 | int minutes = seconds / 60;
14 |
15 | int hour = minutes / 60;
16 |
17 | int remainingSeconds = seconds % 60; // remaining... is what is left after dividing seconds by 60.
18 |
19 | System.out.print(seconds + " seconds is " + hour + "hr, " + minutes + "mins and " + remainingSeconds + "secs." );
20 |
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/_2_ElementaryProgramming/ExponentOperations.java:
--------------------------------------------------------------------------------
1 | package _2_ElementaryProgramming;
2 |
3 | import java.util.Scanner;
4 |
5 | public class ExponentOperations {
6 | public static void main(String[] args) {
7 | Scanner input = new Scanner(System.in);
8 |
9 | // say we want to display x exponent y (X raise to the power of y) we use the Math.pow(x, y) function.
10 |
11 | System.out.print("Enter value for x : ");
12 | int x = input.nextInt();
13 |
14 | System.out.print("Enter value for y : ");
15 | int y = input.nextInt();
16 |
17 | System.out.println("The value of " + x + " raise to the power of " + y + " is : " + Math.pow(x, y));
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/_2_ElementaryProgramming/FahrenheitToCelsius.java:
--------------------------------------------------------------------------------
1 | package _2_ElementaryProgramming;
2 |
3 | import java.util.Scanner;
4 |
5 | public class FahrenheitToCelsius {
6 |
7 | public static void main(String[] args) {
8 | Scanner input = new Scanner(System.in);
9 |
10 |
11 | System.out.println("Enter value for fahrenheit : ");
12 | double fahrenheit = input.nextDouble();
13 |
14 | double celsius = (5.0/9) * (fahrenheit - 32); // Remember the reason behind making that value 5.0 and not 5
15 |
16 | System.out.println(fahrenheit + " fahrenheit is equal to " + celsius + " celsius.");
17 |
18 |
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/_2_ElementaryProgramming/PrintF.java:
--------------------------------------------------------------------------------
1 | package _2_ElementaryProgramming;
2 |
3 | public class PrintF {
4 |
5 | public static void main(String[] args) {
6 |
7 | boolean myBoolean = true;
8 | char myChar = '#';
9 | int myInt = 50;
10 | String myString = "Benjamin";
11 | double myDouble = 1047486.78654;
12 |
13 | // TODO
14 | // I will do my printing here using each of the data types specifier.
15 |
16 | System.out.printf("%b%n", myBoolean);
17 | System.out.printf("%c%n", myChar);
18 | System.out.printf("%d%n", myInt);
19 | System.out.printf("%s%n", myString);
20 | System.out.printf("%f%n", myDouble);
21 |
22 |
23 | System.out.printf("I have $%.3f %n", myDouble); // This will approximate the double value to 3 decimal place
24 | System.out.printf("I have $%,.3f", myDouble); // This will add a comma to make it readable.
25 |
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/_2_ElementaryProgramming/SalesTax.java:
--------------------------------------------------------------------------------
1 | // Write a program that calculates the sales tax of a given goods at a tax rate of 6%
2 |
3 | package _2_ElementaryProgramming;
4 |
5 | import java.util.Scanner;
6 |
7 | public class SalesTax {
8 |
9 | public static void main(String[] args) {
10 |
11 | final double taxRate = 6;
12 | double priceOfGoods;
13 |
14 | Scanner input = new Scanner(System.in);
15 |
16 | System.out.print("Enter the price of the Goods : ");
17 | priceOfGoods = input.nextDouble();
18 |
19 |
20 | double salesTax = taxRate/100 * priceOfGoods;
21 |
22 | System.out.println("The sales tax for a goods worth $" + priceOfGoods + " is $" + salesTax);
23 |
24 |
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/_2_ElementaryProgramming/ShowCurrentTime.java:
--------------------------------------------------------------------------------
1 | // We can show current time by invoking the "System.currentTimeMIlls()".
2 |
3 | package _2_ElementaryProgramming;
4 |
5 | public class ShowCurrentTime {
6 | public static void main(String[] args) {
7 | long totalMilliSeconds = System.currentTimeMillis();
8 |
9 |
10 | long totalSeconds = totalMilliSeconds / 1000;
11 | long currentSecond = totalSeconds % 60;
12 |
13 | long totalMinutes = totalSeconds / 60;
14 | long currentMinute = totalMinutes % 60;
15 |
16 | long totalHour = totalMinutes / 60;
17 | long currentHour = totalHour % 24;
18 |
19 | System.out.println("The current time is " + currentHour + ":" + currentMinute + ":" + currentSecond + " GMT");
20 |
21 | // Since this above function only returns the Greenwich mean time, we can calculate for another zone
22 | // say West-African time, which is an hour ahead of the Greenwich mean time.
23 | // We do that by adding an hour to the currentHour.
24 |
25 | System.out.println("The current time is " + (currentHour + 1) + ":" + currentMinute + ":" + currentSecond + " West-Africa Time.");
26 |
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/_2_ElementaryProgramming/SwapValuesOfVariables.java:
--------------------------------------------------------------------------------
1 | package _2_ElementaryProgramming;
2 |
3 | public class SwapValuesOfVariables {
4 | public static void main(String[] args) {
5 |
6 | int x = 1;
7 | int y = 2;
8 | System.out.println("Before the swap, x is " + x + " and y is " + y);
9 |
10 | int temp = x ; // Save x in a temp variable temp is now 1
11 | x = y; // Assign the value in y to x, x is now 1
12 | y = temp; // y is now 1
13 |
14 | System.out.println("After the swap, x is " + x + " and y is " + y);
15 |
16 | int a = 6;
17 | int b = 10;
18 | a = a ^ b ^ (b = a);
19 | System.out.println("After the swap, a is " + a + " and b is " + b);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/_3_Selections/AdditionQuiz.java:
--------------------------------------------------------------------------------
1 | // Suppose you want to develop a program for a first-grader to practice addition,
2 | // the program randomly selects two digits and displays to the student a statement such as what is 1 + 7?
3 | // After the student types an answer, it displays whether the answer is True or False.
4 | // For now Generate the first number using System.currentTimeMillis() % 10 and the second using
5 | // System.currentTimeMillis()/ 7 % 10.
6 |
7 | package _3_Selections;
8 |
9 | import java.util.Scanner;
10 |
11 | public class AdditionQuiz {
12 |
13 | public static void main(String[] args) {
14 |
15 | int number1 = (int) (System.currentTimeMillis() % 10);
16 | int number2 = (int) (System.currentTimeMillis()/ 7 % 10.);
17 |
18 | Scanner input = new Scanner(System.in);
19 |
20 | System.out.println("What is " + number1 + " + " + number2 + " ? : ");
21 | int userAnswer = input.nextInt();
22 |
23 | System.out.println(number1 + " + " + number2 + " = " + userAnswer + " is " + (number1 + number2==userAnswer));
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/_3_Selections/BMI.java:
--------------------------------------------------------------------------------
1 | // Body Mass Index (BMI) is a measure of health based on height and weight. It can be calculated by
2 | // taking your weight in kilograms and dividing it by the square of your height in meters.
3 | //______________________________________________________________________________________________________
4 | // BMI < 18.5 (Underweight)
5 | // 18.5 ≤ BMI < 25.0 (Normal)
6 | // 25.0 ≤ BMI < 30.0 (Overweight)
7 | // 30.0 ≤ BMI (Obese)
8 | //-------------------------------------------------------------------------------------------------------
9 | // Write a program that prompts the user to enter a weight in pounds and height in inches and
10 | // displays the BMI. Note that one pound is 0.45359237 kilograms and one inch is 0.0254 meters.
11 |
12 | package _3_Selections;
13 |
14 | import java.util.Scanner;
15 |
16 | public class BMI {
17 |
18 | // bmi = weightKG / (height * height) in meters.
19 | // 1 pounds = 0.4535kg that is to say X.kg = inch * 0.45359237
20 | // 1 inch = 0.0254meters X.meters = inch * 0.0254
21 |
22 |
23 | public static void main(String[] args) {
24 | Scanner input = new Scanner(System.in);
25 |
26 | System.out.print("Enter the weight in pounds : ");
27 | double weightInPounds = input.nextDouble();
28 | double weightInKilogram = weightInPounds * 0.45359237;
29 |
30 | System.out.print("Enter height in inches : ");
31 | double heightInInches = input.nextDouble();
32 | double heightInMeters = heightInInches * 0.0254;
33 |
34 | double bmi = weightInKilogram / (heightInMeters * heightInMeters);
35 | System.out.println("BMI is " + bmi);
36 |
37 | if (bmi < 18.5)
38 | System.out.println("Underweight");
39 | else if (18.5 <= bmi && bmi < 25.0)
40 | System.out.println("Normal");
41 | else if (25.0 <= bmi && bmi < 30.0)
42 | System.out.println("Overweight");
43 | else if (30.0 <= bmi)
44 | System.out.println("Obese");
45 |
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/_3_Selections/ChineseZodiac.java:
--------------------------------------------------------------------------------
1 | /* The Chinese Zodiac is based on a twelve-year cycle, with each year represented by an animal—
2 | monkey, rooster, dog, pig, rat, ox, tiger, rabbit, dragon, snake, horse, or sheep in this roster
3 | 0: monkey
4 | 1: rooster
5 | 2: dog
6 | 3: pig
7 | 4: rat
8 | 5: ox
9 | 6: tiger
10 | 7: rabbit
11 | 8: dragon
12 | 9: snake
13 | 10: horse
14 | 11: sheep
15 | Note that year % 12 determines the Zodiac sign. 1900 is the year of the rat because 1900
16 | % 12 is 4.
17 |
18 | */
19 | package _3_Selections;
20 |
21 | import java.util.Scanner;
22 |
23 | public class ChineseZodiac {
24 |
25 | public static void main(String[] args) {
26 | Scanner input = new Scanner(System.in);
27 |
28 |
29 | System.out.print("Enter the year i.e 2008 : ");
30 | int year = input.nextInt();
31 |
32 | int zodiacSign = year % 12;
33 |
34 | switch (zodiacSign) {
35 | case 0 -> System.out.println(year + " is the year of the Monkey");
36 | case 1 -> System.out.println(year + " is the year of the Rooster");
37 | case 2 -> System.out.println(year + " is the year of the Dog");
38 | case 3 -> System.out.println(year + " is the year of the Pig");
39 | case 4 -> System.out.println(year + " is the year of the Rat");
40 | case 5 -> System.out.println(year + " is the year of the Ox");
41 | case 6 -> System.out.println(year + " is the year of the Tiger");
42 | case 7 -> System.out.println(year + " is the year of the Rabbit");
43 | case 8 -> System.out.println(year + " is the year of the Dragon");
44 | case 9 -> System.out.println(year + " is the year of the Snake");
45 | case 10 -> System.out.println(year + " is the year of the Horse");
46 | case 11 -> System.out.println(year + " is the year of the Sheep");
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/_3_Selections/DetermineToday.java:
--------------------------------------------------------------------------------
1 | // If today is Tuesday, what day of the week will it be in 100 days?
2 | package _3_Selections;
3 |
4 | public class DetermineToday {
5 |
6 | public static void main(String[] args) {
7 |
8 | int daysTime = 100;
9 |
10 | if (daysTime % 7 == 1) {
11 | System.out.println("Wednesday");
12 | }
13 | else if (daysTime % 7 == 2) {
14 | System.out.println("Thursday");
15 | }
16 | else if (daysTime % 7 == 3) {
17 | System.out.println("Friday");
18 | }
19 | else if (daysTime % 7 == 4) {
20 | System.out.println("Saturday");
21 | }
22 | else if (daysTime % 7 == 5) {
23 | System.out.println("Sunday");
24 | }
25 | else if (daysTime % 7 == 6) {
26 | System.out.println("Monday");
27 | }
28 | else
29 | System.out.println("Tuesday");
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/_3_Selections/LeapYear.java:
--------------------------------------------------------------------------------
1 | // Create a program that executes this function..."
2 | // "A year is a leap year if it is divisible by 4 but not by 100, or if it is divisible by 400".
3 |
4 |
5 | package _3_Selections;
6 |
7 | import java.util.Scanner;
8 |
9 | public class LeapYear {
10 | public static void main(String[] args) {
11 | Scanner input = new Scanner(System.in);
12 | System.out.print("Enter the year : "); // i.e 2008 is 2008 a leap year ?...true
13 | int year = input.nextInt();
14 |
15 | boolean isLeapYear = (year % 4 ==0 && year % 100 !=0) || (year % 400 ==0);
16 |
17 | System.out.println("Is " + year + " a leap year? : " + isLeapYear);
18 |
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/_3_Selections/Lottery.java:
--------------------------------------------------------------------------------
1 | /* Create a program randomly generates a
2 | lottery of a two-digit number, prompts the user to enter a two-digit number, and determines
3 | whether the user wins according to the following rules:
4 | 1. If the user input matches the lottery number in the exact order, the award is $10,000.
5 | 2. If all digits in the user input match all digits in the lottery number, the award is $3,000.
6 | 3. If one digit in the user input matches a digit in the lottery number, the award is $1,000.
7 | Note that the digits of a two-digit number may be 0. If a number is less than 10, we assume
8 | the number is preceded by a 0 to form a two-digit number. For example, number 8 is treated
9 | as 08 and number 0 is treated as 00 in the program. */
10 | package _3_Selections;
11 |
12 | import java.util.Scanner;
13 |
14 | public class Lottery {
15 |
16 | public static void main(String[] args) {
17 | Scanner input = new Scanner(System.in);
18 |
19 | int winningNumber = (int) (Math.random() * 100); // Winning number ranges from 0 to 99.
20 | int lotteryDigit1 = winningNumber / 10; // The first digit of the winning number.
21 | int lotteryDigit2 = winningNumber % 10; // The Second digit of the winning number.
22 |
23 | System.out.println(winningNumber + " is the winning number");
24 |
25 | System.out.print("Enter your guess number : ");
26 | int guessNumber = input.nextInt();
27 | int guessDigit1 = guessNumber / 10;
28 | int guessDigit2 = guessNumber % 10;
29 |
30 | if(guessNumber == winningNumber)
31 | System.out.println("You won $10,000!!!");
32 | else if (guessDigit1 == lotteryDigit2 && guessDigit2 == lotteryDigit1)
33 | System.out.println("You won $3000!!");
34 | else if (guessDigit1 == lotteryDigit1 || guessDigit1 == lotteryDigit2
35 | || guessDigit2 == lotteryDigit1 || guessDigit2 == lotteryDigit2)
36 | System.out.println("You won $1000");
37 | else {
38 | System.out.println("You lost!");
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/_3_Selections/SimpleIfDemo.java:
--------------------------------------------------------------------------------
1 | // Write a program that prompts a user to enter an Integer. if the number is a multiple of five,
2 | // the program displays "HiFive". If the number is divisible by 2, it displays HiEven.
3 |
4 | package _3_Selections;
5 |
6 | import java.util.Scanner;
7 |
8 | public class SimpleIfDemo {
9 | public static void main(String[] args) {
10 | Scanner input = new Scanner(System.in);
11 |
12 | System.out.print("Enter a number : ");
13 | int number = input.nextInt();
14 |
15 | if (number % 5 == 0){
16 | System.out.println("HiFive");
17 | }
18 | if (number % 2 == 0){
19 | System.out.println("HiEven");
20 | }
21 |
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/_3_Selections/SubtractionQuiz.java:
--------------------------------------------------------------------------------
1 | // Suppose you want to develop a program for a first-grader to practice Cai,
2 | // the program randomly selects two digits and displays to the student a statement such as what is 9 - 2?
3 | // After the student types an answer, it displays whether the answer is True or False.
4 | // Generate using the Math.random() method.
5 | package _3_Selections;
6 |
7 | import java.util.Scanner;
8 |
9 | public class SubtractionQuiz {
10 |
11 | public static void main(String[] args) {
12 | Scanner input = new Scanner(System.in);
13 |
14 | int number1 = (int) (Math.random() * 50);
15 | int number2 = (int) (Math.random() * 50);
16 |
17 | System.out.print("What is " + number1 + " - " + number2 + "? : ");
18 | int userAns = input.nextInt();
19 |
20 |
21 | if (number1 - number2 == userAns){
22 | System.out.println("You are correct!");
23 | }
24 | else {
25 | System.out.println("You are wrong.");
26 | System.out.println("The correct answer should be " + (number1 - number2));
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/_3_Selections/TestBooleanOperators.java:
--------------------------------------------------------------------------------
1 | //Create a program that checks whether a number is divisible
2 | // by 2 and 3, by 2 or 3 but not both, and cannot be divisible by 2 or 3.
3 |
4 | package _3_Selections;
5 |
6 | import java.util.Scanner;
7 |
8 | public class TestBooleanOperators {
9 |
10 | public static void main(String[] args) {
11 | Scanner input = new Scanner(System.in);
12 |
13 | System.out.print("Enter the number : ");
14 | int number = input.nextInt();
15 |
16 | if (number % 2 ==0 && number % 3 ==0){
17 | System.out.println(number + " is divisible by both 2 and 3.");
18 | } else if (number % 2 ==0 || number % 3 ==0) {
19 | System.out.println(number + " can be divided by 2 or 3 but not both");
20 | }
21 | else if (number % 2 != 0 && number % 3 != 0) {
22 | System.out.println(number + " cannot be divided by 2 and 3");
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/_4_MathFunctionsCharactersAndStrings/AlphabeticalOrderInJava.java:
--------------------------------------------------------------------------------
1 | // Write a program that prompts the user to enter two cities and displays them in alphabetical order
2 | // keyword 'compareTo' to sorts in alphabetical order.
3 |
4 | package _4_MathFunctionsCharactersAndStrings;
5 |
6 | import java.util.Scanner;
7 | public class AlphabeticalOrderInJava {
8 |
9 | public static void main(String[] args) {
10 | Scanner input = new Scanner(System.in);
11 |
12 | System.out.print("Enter the first city: ");
13 | String city1 = input.nextLine();
14 | System.out.print("Enter the second city: ");
15 | String city2 = input.nextLine();
16 |
17 | if (city1.compareTo(city2) < 0) { // keyword 'compareTo' to sorts in alphabetical order.
18 | System.out.println("The cities in alphabetical order are " +
19 | city1 + " " + city2);
20 | }
21 | else {
22 | System.out.println("The cities in alphabetical order are " +
23 | city2 + " " + city1);
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/_4_MathFunctionsCharactersAndStrings/CharAt.java:
--------------------------------------------------------------------------------
1 | /*
2 | Write an application that inputs one number consisting of five digits from the user,
3 | separates the number into its individual digits and prints the digits
4 | separated from one another by three spaces each. For example, if the user types in the number 42339,
5 | the program should print 4 2 3 3 9
6 | Assume that the user enters the correct number of digits. What happens when you enter a
7 | number with more than five digits? What happens when you enter a number with fewer than five
8 | digits?.
9 | */
10 |
11 |
12 | package _4_MathFunctionsCharactersAndStrings;
13 |
14 | import java.util.Scanner;
15 |
16 | public class CharAt {
17 |
18 | public static void main(String[] args) {
19 |
20 | Scanner in = new Scanner(System.in);
21 |
22 | System.out.print("Enter the number : ");
23 | String numberEntered = in.nextLine();
24 |
25 | char first = numberEntered.charAt(0);
26 | char second = numberEntered.charAt(1);
27 | char third = numberEntered.charAt(2);
28 | char fourth = numberEntered.charAt(3);
29 | char fifth = numberEntered.charAt(4);
30 |
31 | System.out.println(first + " " +second + " " + third + " " + fourth + " " + fifth);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/_4_MathFunctionsCharactersAndStrings/GettingStringLength.java:
--------------------------------------------------------------------------------
1 | // We use the ".length" method to find the length of the spaces used.
2 |
3 | package _4_MathFunctionsCharactersAndStrings;
4 |
5 | public class GettingStringLength {
6 |
7 | public static void main(String[] args) {
8 |
9 | String message = "Welcome to Java";
10 | System.out.println("The length of " + message + " is "
11 | + message.length());
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/_4_MathFunctionsCharactersAndStrings/ReadingStringsFromTheConsole.java:
--------------------------------------------------------------------------------
1 | package _4_MathFunctionsCharactersAndStrings;
2 |
3 | import java.util.Scanner;
4 |
5 | public class ReadingStringsFromTheConsole {
6 |
7 | public static void main(String[] args) {
8 |
9 | Scanner input = new Scanner(System.in);
10 | System.out.print("Enter three words separated by spaces: ");
11 | String s1 = input.next();
12 | String s2 = input.next();
13 | String s3 = input.next();
14 |
15 | System.out.println("s1 is " + s1);
16 | System.out.println("s2 is " + s2);
17 | System.out.println("s3 is " + s3);
18 |
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/_4_MathFunctionsCharactersAndStrings/UsingIncrementAndDecrementInChar.java:
--------------------------------------------------------------------------------
1 | /*
2 | The increment and decrement operators can also be used on char variables to get the
3 | next or preceding Unicode character. For example, the following statements display
4 | character b.
5 | */
6 | package _4_MathFunctionsCharactersAndStrings;
7 |
8 | public class UsingIncrementAndDecrementInChar {
9 |
10 | public static void main(String[] args) {
11 |
12 | char charValue = 'a';
13 | System.out.println(++charValue); // This statement prints out 'b'.
14 |
15 | // We can also show the preceding letter or number by using the decrement operator
16 |
17 | char value = '6';
18 | System.out.println(--value); // This statement prints out '5'.
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/_5_Loops/DietelChapter5Exercise.java:
--------------------------------------------------------------------------------
1 | // Write an application that finds the minimum and maximum amongst several
2 | // integers and then computes the sum of the two extremes. The user will be prompted to input how
3 | // many values the application should ask the user to input.
4 |
5 | package _5_Loops;
6 |
7 | import java.util.Scanner;
8 |
9 | public class DietelChapter5Exercise {
10 |
11 | public static void main(String[] args) {
12 | Scanner input = new Scanner(System.in);
13 |
14 | System.out.print("Enter number of Integers : ");
15 | int numberOfIntegers = input.nextInt();
16 | int maxOfNumbers = 0;
17 | int minOfNumbers = 1000000000;
18 | for (int i = 1; i <=numberOfIntegers ; i++) {
19 | System.out.println("Enter number" + i);
20 | int number = input.nextInt();
21 |
22 | if(number > maxOfNumbers){
23 | maxOfNumbers = number;
24 | }
25 | if(number < minOfNumbers){
26 | minOfNumbers = number;
27 | }
28 | }
29 | System.out.println("The maximum of the numbers is " + maxOfNumbers);
30 | System.out.println("The minimum of the numbers is " + minOfNumbers);
31 | System.out.println("The sum of the maximum and minimum of the two extremes is " + (maxOfNumbers + minOfNumbers));
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/_5_Loops/Displays.java:
--------------------------------------------------------------------------------
1 | package _5_Loops;
2 |
3 | public class Displays {
4 |
5 | public static void main(String[] args) {
6 |
7 | for (int i = 0; i < 7; i++) {
8 | for (int j = 0; j < i; j++) {
9 | System.out.print("* ");
10 | }
11 | System.out.println();
12 | }
13 | System.out.println();
14 | //----------------------------------------------------------------------------------------------------------------------
15 |
16 | for (int k = 7; k > 0; k--) {
17 |
18 | for (int l = 0; l < k; l++) {
19 | System.out.print("* ");
20 | }
21 | System.out.println();
22 | }
23 | System.out.println();
24 |
25 |
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/_5_Loops/ForEachLoop.java:
--------------------------------------------------------------------------------
1 | /** Our for each loop is also known as enhanced for loop */
2 |
3 | package _5_Loops;
4 |
5 | public class ForEachLoop {
6 |
7 | public static void main(String[] args) {
8 |
9 | String[] animalsList = {"Goat", "Monkey", "Dog", "Bird"};
10 |
11 | for (String e : animalsList) { // for each element (e) in my animalsLIst,
12 | System.out.println(e); // print out the elements (e).
13 | }
14 | }
15 |
16 | /** Note : The data type of elements e must be the same as the data type of the animalsList. */
17 | }
18 |
--------------------------------------------------------------------------------
/src/_5_Loops/FutureTuition.java:
--------------------------------------------------------------------------------
1 | /** Suppose that the tuition for a university is $10,000 this year and tuition increases 7% every year.
2 | In how many years will the tuition be doubled? */
3 |
4 | package _5_Loops;
5 |
6 | public class FutureTuition {
7 |
8 | public static void main(String[] args) {
9 |
10 | int tuition = 10000;
11 | int yearsTaken = 0;
12 |
13 | while (tuition <= 20_000){
14 | tuition = (int) (tuition * 0.07) + tuition;
15 | yearsTaken++;
16 | }
17 |
18 | System.out.println("The tuition will be doubled in " + yearsTaken + "years." +
19 | "\n " + "The tuition will be " + tuition + " in " + yearsTaken + "yrs.");
20 |
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/_5_Loops/GreatestCommonDivisor.java:
--------------------------------------------------------------------------------
1 | // Write program that prompts the user to enter two positive integers and finds their greatest common divisor.
2 |
3 | package _5_Loops;
4 |
5 | import java.util.Scanner;
6 |
7 | public class GreatestCommonDivisor {
8 |
9 | public static void main(String[] args) {
10 | Scanner input = new Scanner(System.in);
11 |
12 | System.out.print("Enter the first number : ");
13 | int number1 = input.nextInt();
14 |
15 | System.out.print("Enter the second number : ");
16 | int number2 = input.nextInt();
17 |
18 | int gcd = 1; // Initial gcd is 1
19 | int k; // Next possible gcd
20 |
21 | for (k = 1; k <= number1 && k <= number2; k++) {
22 | if (number1 % k == 0 && number2 % k == 0)
23 | gcd = k;
24 | }
25 | System.out.println("The greatest common divisor for " + number1 +
26 | " and " + number2 + " is " + gcd);
27 | }
28 |
29 | public void setArray(int number1, int number2){}
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/src/_5_Loops/GuessTheNumber.java:
--------------------------------------------------------------------------------
1 | // Write a program that prompts the user to enter a number continuously until the number matches
2 | // the randomly generated number. For each user input, the program tells the user whether
3 | // the input is too low or too high, so the user can make the next guess intelligently. */
4 |
5 | package _5_Loops;
6 |
7 | import java.util.Scanner;
8 |
9 | public class GuessTheNumber {
10 | public static void main(String[] args) {
11 | Scanner scan = new Scanner(System.in);
12 |
13 | int myRandomNumber = (int) (40 + Math.random() * 100); // myRandomNumber ranges from 40 to 139.
14 | System.out.println("my random number is " + myRandomNumber);
15 |
16 | System.out.print("guess a magic number between 40 to 139 : ");
17 | int guessNumber = scan.nextInt();
18 |
19 |
20 | while (guessNumber != myRandomNumber){ // While the condition is true, execute the next phase
21 |
22 | if (guessNumber > myRandomNumber)
23 | System.out.println("Your guess is too high");
24 | else if (guessNumber < myRandomNumber)
25 | System.out.println("Your guess is too low");
26 |
27 | System.out.print("Enter your guess number : ");
28 | guessNumber = scan.nextInt();
29 |
30 | }
31 |
32 | if (guessNumber == myRandomNumber){ // If the while loop condition is not true, execute this
33 | System.out.println("You are correct!!!");
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/_5_Loops/MultiplicationTable.java:
--------------------------------------------------------------------------------
1 | package _5_Loops;
2 |
3 | public class MultiplicationTable {
4 |
5 | public static void main(String[] args) {
6 | // Display the table heading
7 | System.out.println(" Multiplication Table");
8 |
9 | // Display the number title
10 | System.out.print(" ");
11 | for (int j = 1; j <= 9; j++)
12 | System.out.printf("%4d", j);
13 |
14 | System.out.println("\n——————-—————————————————————————————————");
15 |
16 | // Display table body
17 | for (int i = 1; i <= 9; i++) {
18 | System.out.print(i + " | ");
19 | for (int j = 1; j <= 9; j++) {
20 | // Display the product and align properly
21 | System.out.printf("%4d", i * j);
22 | }
23 | System.out.println();
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/_5_Loops/NestedForLoops.java:
--------------------------------------------------------------------------------
1 | package _5_Loops;
2 |
3 | public class NestedForLoops {
4 | public static void main(String[] args) {
5 |
6 |
7 | int[] array = new int[5];
8 |
9 | for (int i = 0; i < array.length; i++) {
10 |
11 | for(int j = 1; j < array.length - i; j++){
12 | System.out.print("*");
13 | }
14 | System.out.println();
15 | }
16 | System.out.println("");
17 | //------------------------------------------------------------------------------------
18 | for (int i = 0; i <= array.length; i++) {
19 |
20 | for (int j = 0; j <= i; j++) {
21 | System.out.print(j);
22 | }
23 | System.out.println("");
24 | }
25 | //---------------------------------------------------------------------------------------------------------------
26 | int[] arrayList = {10, 2, 30, 41, 15};
27 | int max = arrayList[1];
28 | for (int i = 1; i < arrayList.length; i++) {
29 | if (arrayList[i] > arrayList[1])
30 | max = arrayList[i];
31 | }
32 | System.out.println(max);
33 |
34 |
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/_5_Loops/RepeatAdditionQuiz.java:
--------------------------------------------------------------------------------
1 | // Write a program that prompts the user to enter
2 | // an answer for a question on addition of two single digits.
3 | // Rewrite the program to let the user repeatedly enter a new answer until it is correct.
4 |
5 | package _5_Loops;
6 |
7 | import java.util.Scanner;
8 |
9 | public class RepeatAdditionQuiz {
10 |
11 | public static void main(String[] args) {
12 |
13 | int number1 = (int) (Math.random() * 50); // number1 ranges from 0 to 50.
14 | int number2 = (int) (50 + Math.random() * 50); // number2 ranges from 50 to 99.
15 |
16 | Scanner scan = new Scanner(System.in);
17 |
18 | System.out.print("What is " + number1 + " + " + number2 + "? : ");
19 | int userInput = scan.nextInt();
20 |
21 | int realAnswer = number1 + number2;
22 |
23 | while (userInput != realAnswer){
24 | System.err.println("Wrong answer! please try again\n" +
25 | "What is " + number1 + " + " + number2 + "? : ");
26 | userInput = scan.nextInt();
27 | }
28 | System.out.println("You are correct!"); // Else, print this.
29 |
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/_5_Loops/SentinelValue.java:
--------------------------------------------------------------------------------
1 | // A Sentinel Iteration have to do with controlling a loop with a sentinel value that terminates the loop.
2 |
3 | package _5_Loops;
4 |
5 | import java.util.Scanner;
6 |
7 | public class SentinelValue {
8 |
9 | public static void main(String[] args) {
10 | Scanner input = new Scanner(System.in);
11 |
12 | System.out.print("Enter your Sentinel Number : ");
13 | int userInput = input.nextInt();
14 |
15 | int sumSentinel = 0;
16 |
17 | while (userInput != 0){
18 | sumSentinel += userInput;
19 |
20 | System.out.println("Enter your sentinel Number");
21 | userInput = input.nextInt();
22 |
23 | }
24 |
25 | System.out.println("Therefore the sumSentinel is : " + sumSentinel);
26 |
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/_5_Loops/SentinelValue2.java:
--------------------------------------------------------------------------------
1 | /** We can also calculate our sumSentinel using the do-while loop. */
2 |
3 |
4 | package _5_Loops;
5 | import java.util.Scanner;
6 |
7 | public class SentinelValue2 {
8 |
9 | public static void main(String[] args) {
10 | int data;
11 | int sum = 0;
12 |
13 | // Create a Scanner
14 | Scanner input = new Scanner(System.in);
15 |
16 | // Keep reading data until the input is 0
17 | do {
18 | // Read the next data
19 | System.out.print("Enter an integer (the input ends if it is 0): ");
20 | data = input.nextInt();
21 |
22 | sum += data;
23 | }
24 | while (data != 0);
25 |
26 | System.out.println("The sum is " + sum);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/_5_Loops/TestBreak.java:
--------------------------------------------------------------------------------
1 | package _5_Loops;
2 |
3 | public class TestBreak {
4 |
5 | public static void main(String[] args) {
6 |
7 | int number = 0;
8 | int sum = 0;
9 | while(number < 20){
10 | number++;
11 | sum += number;
12 |
13 | if(sum > 100){
14 | break;
15 | }
16 | }
17 | System.out.println("Number is " + number + " and Sum is " + sum);
18 |
19 | }
20 | }
--------------------------------------------------------------------------------
/src/_6_Methods_Stepwise_Refinement/GreatestCommonDivisorMethod.java:
--------------------------------------------------------------------------------
1 | package _6_Methods_Stepwise_Refinement;
2 |
3 | public class GreatestCommonDivisorMethod {
4 |
5 |
6 | public static int myGcd(int no1, int no2) {
7 |
8 | int gcd = 1; // Initial gcd
9 | int k = 2; // Possible gcd
10 |
11 | while (k <= no1 && k <= no2) {
12 | if (no1 % k == 0 && no2 % k == 0)
13 | gcd = k; // Update gcd
14 | k++;
15 | }
16 | return gcd;
17 | }
18 |
19 | /** We can also use the for loop below */
20 | // for (k = 2; k <= no1 && k <= no2; k++) {
21 | // if (no1 % k ==0 && no2 % k ==0)
22 | // gcd = k;
23 | // }
24 |
25 |
26 | public static void main(String[] args) {
27 | int a = 45;
28 | int b = 75;
29 |
30 | myGcd(a, b);
31 | System.out.println("The greatest common Difference of x and y is : " + myGcd(a,b));
32 |
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/_6_Methods_Stepwise_Refinement/Human.java:
--------------------------------------------------------------------------------
1 | package _6_Methods_Stepwise_Refinement;
2 |
3 | public class Human {
4 | static long population; // This explains the usage of the static keyword. It allows us to reach out to the
5 | // Instance variables using the class-name. operator without creating an object of the same class.
6 | int age, salary;
7 | String name;
8 | boolean married;
9 | public Human(int age, String name, int salary, boolean married) {
10 | this.age = age;
11 | this.name = name;
12 | this.salary = salary;
13 | this.married = married;
14 | Human.population += 1; // Whenever a human object is being created, the population should increase by one.
15 | }
16 | public static void main(String[] args) {
17 | Human Benjamin = new Human(22, "Benjamin", 50000, false);
18 | Human Billion = new Human(30, "Ben-Billion the Billionaire", 100000000, true);
19 |
20 |
21 | // So below, when you call Human.population, it shows how many Human objects exists.
22 | System.out.println(Human.population);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/_6_Methods_Stepwise_Refinement/Increment.java:
--------------------------------------------------------------------------------
1 | // Write a program that takes in an argument, increases its value by 1 and then returns its new value
2 |
3 | package _6_Methods_Stepwise_Refinement;
4 |
5 | public class Increment {
6 |
7 | public static void main(String[] args) {
8 | int b = 7;
9 | System.out.println("Before the call, the value of 'b' is " + b);
10 | System.out.println("After the method call, the value of 'b' is increased to " + increase(7));
11 | }
12 |
13 | public static int increase(int x){
14 | x++;
15 | return x;
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/src/_6_Methods_Stepwise_Refinement/MultiplicationTable_MethodCall.java:
--------------------------------------------------------------------------------
1 | package _6_Methods_Stepwise_Refinement;
2 |
3 | public class MultiplicationTable_MethodCall {
4 |
5 | public static void main(String[] args) {
6 | printTableStructure();
7 | }
8 |
9 | private static void printTableStructure() {
10 | System.out.println(" Multiplication Table");
11 | System.out.print(" ");
12 | for (int i = 1; i < 10; i++) {
13 | System.out.printf("%5d", i);
14 | }
15 | System.out.println("");
16 | System.out.println("------------------------------------------------");
17 | for (int j = 1; j <= 9; j++) {
18 | System.out.print(j + "|");
19 |
20 | computeMultiplication(j);
21 |
22 | System.out.println("");
23 | }
24 | }
25 |
26 | private static void computeMultiplication(int j) {
27 | for (int k = 1; k <= 9; k++) {
28 | System.out.printf("%5d", j * k);
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/_6_Methods_Stepwise_Refinement/RandomCharacter.java:
--------------------------------------------------------------------------------
1 | // A random character between any two characters ch1 and ch2 with ch1 < ch2 can be
2 | // generated as follows:
3 | // (char)(ch1 + Math.random() * (ch2 – ch1 + 1))
4 |
5 | package _6_Methods_Stepwise_Refinement;
6 |
7 | public class RandomCharacter {
8 | /**
9 | * Generate a random character between ch1 and ch2
10 | */
11 | public static char getRandomCharacter(char ch1, char ch2) {
12 | return (char) (ch1 + Math.random() * (ch2 - ch1 + 1));
13 | }
14 |
15 | /**
16 | * Generate a random lowercase letter
17 | */
18 | public static char getRandomLowerCaseLetter() {
19 | return getRandomCharacter('a', 'z');
20 | }
21 |
22 | /**
23 | * Generate a random uppercase letter
24 | */
25 | public static char getRandomUpperCaseLetter() {
26 | return getRandomCharacter('A', 'Z');
27 | }
28 |
29 | /**
30 | * Generate a random digit character
31 | */
32 | public static char getRandomDigitCharacter() {
33 | return getRandomCharacter('0', '9');
34 | }
35 |
36 | /**
37 | * Generate a random character
38 | */
39 | public static char getRandomCharacter() {
40 | return getRandomCharacter('\u0000', '\uFFFF');
41 | }
42 |
43 |
44 | /*---------Here is our test class-----------*/
45 |
46 | public static void main(String[] args) {
47 |
48 | final int number_Of_Chars_Per_Row = 10;
49 | final int numberOfColumn = 5;
50 |
51 |
52 | /**
53 | * Here we just formatted our display
54 | */
55 | for (int j = 0; j < numberOfColumn; j++) {
56 | System.out.println(getRandomLowerCaseLetter());
57 |
58 | for (int i = 0; i < number_Of_Chars_Per_Row; i++) {
59 | System.out.print(getRandomLowerCaseLetter());
60 | }
61 | }
62 |
63 |
64 | }
65 | }
--------------------------------------------------------------------------------
/src/_6_Methods_Stepwise_Refinement/TestMax.java:
--------------------------------------------------------------------------------
1 | package _6_Methods_Stepwise_Refinement;
2 |
3 | public class TestMax {
4 |
5 | public static void main(String[] args){
6 |
7 | int i =4;
8 | int j =6;
9 | int k = max(i, j);
10 |
11 | System.out.println("The max of " + i + " and " + k + " is " + k );
12 | }
13 |
14 | public static int max (int i, int j){ // This is a static method, it is positioned anywhere in the class
15 | if (i > j){
16 | return i;
17 | }
18 | else {
19 | return j;
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/_6_Methods_Stepwise_Refinement/TestMethodOverloading.java:
--------------------------------------------------------------------------------
1 | // This is a program that creates three methods. The first finds the maximum integer,
2 | // the second finds the maximum double, and the third finds the maximum among three double
3 | // values. All three methods are named max.
4 |
5 |
6 | package _6_Methods_Stepwise_Refinement;
7 |
8 | public class TestMethodOverloading {
9 |
10 | public static int max(int x, int y) {
11 | if (x > y)
12 | return x;
13 | else
14 | return y;
15 | }
16 | public static double max(double x, double y) {
17 | if (x > y)
18 | return x;
19 | else
20 | return y;
21 | }
22 | public static double max(double x, double y, double z){
23 |
24 | return max(max(x, y), z);
25 | }
26 |
27 | public static void main(String[] args) {
28 |
29 | int x = 7;
30 | double y = 500.98;
31 | int z = 90;
32 |
33 | System.out.println("The max of the figures are " + max(x, y, z));
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/_6_Methods_Stepwise_Refinement/TestPassByValue.java:
--------------------------------------------------------------------------------
1 | // This is a program that demonstrates the effect of passing by value. The program creates a method for swapping two variables.
2 | // The swap method is invoked by passing two arguments.
3 | // Interestingly, the values of the arguments are not changed after the method is invoked
4 |
5 |
6 | package _6_Methods_Stepwise_Refinement;
7 |
8 | public class TestPassByValue {
9 | public static void main(String[] args) {
10 |
11 | int x = 5;
12 | int y = 9;
13 | System.out.println("Before invoking the swap method, x is " + x + " and y is " + y);
14 |
15 | swap(x, y); // Here we invoked the method to swap x and y.
16 |
17 | System.out.println("After invoking the swap method, x is " + x + " and y is " + y);
18 | }
19 |
20 | public static void swap(int a, int b){
21 | int emptyPlaceholder = a; // This is the method scope where we implemented what we want the method to do.
22 | a = b;
23 | b = emptyPlaceholder;
24 |
25 | System.out.println("\tInside the swap method");
26 | System.out.println("\t\tAfter swapping, a is " + a+
27 | " and b is " + b);
28 | }
29 | }
30 |
31 | /**
32 | * Before the swap method is invoked, x is 5 and y is 9. After the swap method is invoked,
33 | * x is still 5 and y is still 9. Their values have not been swapped. As shown
34 | * in the program, the values of the arguments x and y are passed to a and b, but a and
35 | * b have their own memory locations independent of x and y. Therefore, changes in
36 | * a and b do not affect the contents of x and y.
37 | * Another twist is to change the parameter name 'a' in swap to x. What effect does this
38 | * have? No change occurs, because it makes no difference whether the parameter and the argument have the same name.
39 | * The parameter is a variable in the method with its own memory
40 | * space. The variable is allocated when the method is invoked, and it disappears when the
41 | * method is returned to its caller
42 | * */
43 |
--------------------------------------------------------------------------------
/src/_6_Methods_Stepwise_Refinement/TestReturningMethod.java:
--------------------------------------------------------------------------------
1 | /** In JAVA, there is are VOID methods and VALUE returning methods. ***/
2 | // Write a program that defines a method named printGrade and invokes it to print the grade for a given score.
3 |
4 | package _6_Methods_Stepwise_Refinement;
5 |
6 | public class TestReturningMethod {
7 |
8 | public static void main(String[] args) {
9 |
10 | System.out.println(printGrade(67));
11 | }
12 |
13 |
14 | public static char printGrade(double score) { //returns a character grade based on the numeric score value. the caller invokes this method.
15 |
16 | if (score >= 85)
17 | return 'A';
18 | else if (score >= 70)
19 | return 'B';
20 | else if (score >= 60)
21 | return 'C';
22 | else if (score >= 50)
23 | return 'D';
24 | else if (score >= 40)
25 | return 'E';
26 | else
27 | return 'F';
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/_6_Methods_Stepwise_Refinement/TestVoidMethod.java:
--------------------------------------------------------------------------------
1 | /** In JAVA, there is are VOID methods and VALUE returning methods. ***/
2 | // Write a program that defines a method named printGrade and invokes it to print the grade for a given score.
3 |
4 | package _6_Methods_Stepwise_Refinement;
5 |
6 | public class TestVoidMethod {
7 |
8 | public static void printGrade(double score){
9 |
10 | if (score >= 85)
11 | System.out.println("A");
12 | else if ( score >=75)
13 | System.out.println("B");
14 | else if ( score >=60)
15 | System.out.println("C");
16 | else if ( score >=50)
17 | System.out.println("D");
18 | else if ( score >=40)
19 | System.out.println("E");
20 | else
21 | System.out.println("F");
22 | }
23 |
24 | public static void main(String[] args) {
25 | System.out.println("The grade is : " );
26 | printGrade(65);
27 |
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/_7_SingleDimensionalArrays/AnalyzeNumbers.java:
--------------------------------------------------------------------------------
1 | // Write a program that finds the number of items above the average of all the items.
2 |
3 | package _7_SingleDimensionalArrays;
4 |
5 | import java.util.Scanner;
6 |
7 | public class AnalyzeNumbers {
8 |
9 | public static void main(String[] args) {
10 |
11 | Scanner input = new Scanner(System.in);
12 |
13 | System.out.print("How many items do you want to compute? : ");
14 | int numberOfItems = input.nextInt();
15 |
16 | int [] items = new int[numberOfItems];
17 | int sum = 0;
18 |
19 | // Always initialize your counter to start at 0 to avoid "array out of bound exception".
20 | // and the condition must not have the = operator for example i <= 10 can cause an exception
21 |
22 | for(int i = 0; i < numberOfItems; i++){
23 | System.out.print("Enter the number at index " + i + " : ");
24 | items[i] = input.nextInt();
25 | sum += items[i];
26 | }
27 |
28 | int average = sum/numberOfItems;
29 | System.out.println("The average is " + average);
30 |
31 | int aboveAverageCount = 0;
32 | for (int i = 0; i < numberOfItems; i++) // Loop through the elements of the array
33 | if (items[i] > average) // if any element is above the average
34 | aboveAverageCount++; // count it
35 |
36 | System.out.println("The number of items above the average is " + aboveAverageCount);
37 |
38 |
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/_7_SingleDimensionalArrays/AnalyzeNumbers_MethodCall.java:
--------------------------------------------------------------------------------
1 | package _7_SingleDimensionalArrays;
2 | import jdk.jfr.Label;
3 | import java.util.Scanner;
4 |
5 | public class AnalyzeNumbers_MethodCall {
6 | static double average;
7 | static int []arrayList;
8 | static int noOfItems;
9 | static Scanner input = new Scanner(System.in);
10 | public static void main(String[] args) {
11 | startProgram();
12 | }
13 | public static void startProgram(){
14 | promptUser();
15 | findArrayAverage();
16 | checkAndPrint();
17 | }
18 | public static void promptUser(){
19 | System.out.print("Enter the numbers of values you want to compute -> ");
20 | input = new Scanner(System.in);
21 | arrayList = new int[input.nextInt()];
22 | for(int i = 0; i < arrayList.length; i++){
23 | System.out.printf("%s%d%s","Enter value ", i+1, " -> ");
24 | arrayList[i] = input.nextInt();
25 | }
26 | }
27 | public static void findArrayAverage(){
28 | int sum = 0;
29 | for(int i = 0; i < arrayList.length; i++){
30 | sum += arrayList[i];
31 | }
32 | average = (double) (sum / arrayList.length);
33 | System.out.println("The average is " + average);
34 | }
35 | @Label("Find the number of the Items greater than the average") public static void checkAndPrint(){
36 | int items = 0;
37 | for(int i = 0; i < arrayList.length; i++){
38 | if(arrayList[i] > average){
39 | noOfItems++;
40 | }
41 | }
42 | System.out.println("There are " + noOfItems + " items greater than the average");
43 | }
44 |
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/src/_7_SingleDimensionalArrays/CopyArray.java:
--------------------------------------------------------------------------------
1 | package _7_SingleDimensionalArrays;
2 |
3 | public class CopyArray {
4 |
5 | public static int copyElementsOfArray(int[]arrayA){
6 | int[] arrayB = new int[arrayA.length];
7 | for (int i = 0; i < arrayA.length; i++) {
8 | arrayB[i] = arrayA[i];
9 | }
10 | return arrayB.length;
11 | }
12 | // We can also copy the elements of an array using System.arraycopy() function
13 | public static int automaticCopyElementsOfArray(int[]arrayA){
14 | int[] arrayB = new int[arrayA.length];
15 | System.arraycopy(arrayA, 0, arrayB, 0, arrayA.length);
16 | return arrayB.length;
17 | }
18 |
19 | public static int[] printArray(int[]array){
20 | for (int i =0; i < array.length; i++) {
21 | System.out.print(array[i]);
22 | }
23 | return array;
24 | }
25 | public static void main(String[] args) {
26 | int[] array1 = {7,8,9,5,6};
27 |
28 | System.out.println(copyElementsOfArray(array1));
29 |
30 | }
31 | }
--------------------------------------------------------------------------------
/src/_7_SingleDimensionalArrays/DisplayingMonths.java:
--------------------------------------------------------------------------------
1 | // Write an app that prompts the user to enter a month number and displays the month name.
2 |
3 | package _7_SingleDimensionalArrays;
4 |
5 | import java.util.Scanner;
6 |
7 | public class DisplayingMonths {
8 |
9 | public static void main(String[] args) {
10 | Scanner input = new Scanner(System.in);
11 |
12 | System.out.print("Enter the month number : ");
13 | int userInput = input.nextInt();
14 |
15 | String [] month = {"January", "February", "March", "April", "May", "June", "July",
16 | "August", "September", "October", "November", "December"};
17 |
18 | String theMonth = month[userInput - 1];
19 | System.out.println(theMonth);
20 | }
21 |
22 |
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/src/_7_SingleDimensionalArrays/LinearSearch.java:
--------------------------------------------------------------------------------
1 | // Write a program that searches for a particular integer number in a list of numbers.
2 |
3 | package _7_SingleDimensionalArrays;
4 |
5 | public class LinearSearch {
6 |
7 |
8 | /** We first create a method that can search for the position of a number in a particular index.
9 | * The method will take in 2 arguments, the number to search for and the list to search from. */
10 |
11 | public static int search(int [] list, int number){ //
12 |
13 | for(int i =0; i < list.length; i++){
14 | if (number == list[i]) // If the number is equal to the value at a particular index,
15 | return i; // return the index.
16 | }
17 | return -1; // If no match is found, the search returns -1
18 | }
19 |
20 | /** Then Secondly, we create our main method to execute and test the method 'search'. */
21 |
22 | public static void main(String[] args) {
23 |
24 | int[] myArrayList = {23, 5, -7, 4, 15, 15, 23, 9};
25 | System.out.println(search(myArrayList, 23)); // search for 7 in myArrayList
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/_7_SingleDimensionalArrays/ReverseArray.java:
--------------------------------------------------------------------------------
1 | // Write a program that reverses the values of an array list.
2 |
3 | package _7_SingleDimensionalArrays;
4 |
5 | import java.util.Arrays;
6 |
7 | public class ReverseArray {
8 |
9 | public static void reverseArray(int[] arrayList) {
10 | for (int j = arrayList.length-1; j >= 0; j--) { // To avoid bound exception, we minus 1 from the array length.
11 |
12 | System.out.print(arrayList[j] + " "); // So when we call the method in method main, it reverses the array list.
13 | }
14 | }
15 |
16 | public static void main(String[] args) {
17 |
18 | int[] myList = {10, 20, 30, 40, 50};
19 |
20 | System.out.println("Before the Loop this is the look " + Arrays.toString(myList));
21 |
22 | System.out.print("After the loop, this is how it looks ");
23 | reverseArray(myList);
24 |
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/src/_7_SingleDimensionalArrays/SortingIntegerArray.java:
--------------------------------------------------------------------------------
1 | package _7_SingleDimensionalArrays;
2 |
3 | public class SortingIntegerArray {
4 |
5 |
6 | public static void sort(int[]myList){
7 |
8 | for (int i = 1; i < myList.length; i++) {
9 |
10 | for (int j = i; j > 0; j--) {
11 |
12 | int temp;
13 | if (myList[j] < myList [j - 1]) {
14 | temp = myList[j];
15 | myList[j] = myList[j - 1];
16 | myList[j - 1] = temp;
17 | }
18 | }
19 | }
20 | for (int j : myList) {
21 | System.out.println(j);
22 | }
23 | }
24 |
25 | public static void main (String [] args) {
26 | int [] myList = {45,12,85,32,89,39,69,44,42,1,6,8};
27 | sort(myList);
28 |
29 |
30 | }
31 |
32 | }
--------------------------------------------------------------------------------
/src/_7_SingleDimensionalArrays/SortingStringArray.java:
--------------------------------------------------------------------------------
1 | package _7_SingleDimensionalArrays;
2 |
3 | import java.util.Arrays;
4 |
5 | public class SortingStringArray {
6 | public static void main(String[] args) {
7 | String []arrayList = { "BDG879FX",
8 | "AAA477GL",
9 | "BDG376GX",
10 | "AGL802FM",
11 | "AGL882FM-------paid",
12 | "EPE987GD",
13 | "BDG44FC",
14 | "BDG376DZ",
15 | "EPE338YA",
16 | "KSF895XK",
17 | "XS773FKJ",
18 | "BDG733YD",
19 | "BDG990YD",
20 | "APP56YE",
21 | "SMK568YE",
22 | "KSF970GB",
23 | "APP454HH",
24 | "LND340XJ",
25 | "LSD233FT",
26 | "KSF985YE",
27 | "AGL969GS",
28 | "GGE258GJ",
29 | "AAA356AA",
30 | "LSR459YD",
31 | "MUS748YA",
32 | };
33 | Arrays.sort(arrayList);
34 | for (int i = 0; i < arrayList.length; i++){
35 | System.out.println("(" + (i+1) + ")" + " " + arrayList[i]);
36 | }
37 | }
38 |
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/src/_7_SingleDimensionalArrays/SwapArrayElements.java:
--------------------------------------------------------------------------------
1 | // Write a program for swapping two elements in an array.
2 |
3 | package _7_SingleDimensionalArrays;
4 |
5 | public class SwapArrayElements {
6 |
7 | public static void swap(int[] numbersToSwap){
8 | int temp = numbersToSwap [0];
9 | numbersToSwap[0] = numbersToSwap[1];
10 | numbersToSwap[1] = temp;
11 | }
12 |
13 | public static void main(String[] args) {
14 |
15 | int [] myArrayList = {2, 4};
16 |
17 | System.out.println("Before swapping the two elements the value of x is : " + myArrayList[0] + " and the value of y is " + myArrayList[1]);
18 |
19 | swap(myArrayList);
20 |
21 | System.out.println("After invoking the swap method, x is now : " + myArrayList[0] + " and y is now : " + myArrayList[1]);
22 | }
23 |
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/src/_8_MultiDimensionalArrays/ArraysLists.java:
--------------------------------------------------------------------------------
1 | package _8_MultiDimensionalArrays;
2 |
3 | import java.util.ArrayList;
4 |
5 | public class ArraysLists {
6 |
7 | public static void main(String[] args) {
8 | ArrayList items = new ArrayList<>(); // This is how to initialize an ArrayList
9 |
10 | // Here we added items to the array list
11 | items.add("Noodles");
12 | items.add("Rice");
13 | items.add("Tomatoes");
14 |
15 | // We then displayed the array using a for loop
16 | for (String item : items) {
17 | System.out.println(item);
18 | }
19 |
20 | // We can actually add different arrayList to a single array list
21 | ArrayList tools = new ArrayList<>();
22 | tools.add("Hammer");
23 | tools.add("Wedge");
24 | tools.add("Chisel");
25 |
26 | ArrayList embroiders = new ArrayList<>();
27 | embroiders.add("Necklaces");
28 | embroiders.add("Wrist Watches");
29 | embroiders.add("Wrist bands");
30 |
31 | // An arrayList that entails other arrayList can be initialized using this format.
32 | ArrayList> shoppingList = new ArrayList<>();
33 | shoppingList.add(tools);
34 | shoppingList.add(embroiders);
35 | shoppingList.add(items);
36 |
37 | shoppingList.remove(1);
38 |
39 | // Here we use a for each loop to print the values of our array List.
40 | for (ArrayList strings : shoppingList) {
41 | System.out.println(strings);
42 | }
43 |
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/_8_MultiDimensionalArrays/Display.java:
--------------------------------------------------------------------------------
1 | package _8_MultiDimensionalArrays;
2 |
3 | public class Display {
4 |
5 | public static void main(String[] args) {
6 |
7 | String[][] array = {{"X", "O", "X"},
8 | {"O", "X", "O"},
9 | {"X", "X", "O"}};
10 |
11 | for (int row = 0; row < array.length; row++) {
12 | for (int column = 0; column < array[row].length; column++) {
13 | System.out.print(array[row][column]);
14 | if (column < array.length -1 ){
15 | System.out.print("|");
16 | }
17 | }
18 | System.out.println();
19 | }
20 | }
21 | }
22 |
23 |
--------------------------------------------------------------------------------
/src/_8_MultiDimensionalArrays/Display2.java:
--------------------------------------------------------------------------------
1 | //Write a program that takes in a 20 by 20 array and prompts the user
2 | //to input its values.
3 |
4 | package _8_MultiDimensionalArrays;
5 |
6 | import java.util.Scanner;
7 |
8 | public class Display2 {
9 | public static void main(String[] args) {
10 | Scanner input = new Scanner(System.in);
11 |
12 | String[][] array = new String[20][20];
13 |
14 | for (int row = 0; row < array.length; row++) {
15 | for (int column = 0; column < array[row].length; column++) {
16 | System.out.println("Enter the element at " + "Row" + row + "-Column" + column + " : ");
17 | array[row][column] = input.nextLine();
18 | }
19 | }
20 |
21 | for (int row = 0; row < array.length; row++) {
22 | for (int column = 0; column < array[row].length; column++) {
23 | System.out.print(array[row][column]);
24 | if (column < array.length -1 ){
25 | System.out.print("|");
26 | }
27 | }
28 | System.out.println();
29 | }
30 |
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/_8_MultiDimensionalArrays/Employee.java:
--------------------------------------------------------------------------------
1 | package _8_MultiDimensionalArrays;
2 |
3 | import java.util.ArrayList;
4 |
5 | /** Suppose the weekly hours for all employees are stored in a two-dimensional array.
6 | Each row records an employee’s seven-day work hours with seven columns.
7 | For example, the following array stores the work hours for eight employees. Write a program that displays
8 | employees and their total hours in decreasing order of the total hours.
9 | */
10 |
11 | public class Employee {
12 |
13 | public static void main(String[] args) {
14 |
15 | int[][] employeeWorkHours = {
16 | {2, 4, 3, 4, 5, 8, 8},
17 | {7, 3, 4, 3, 3, 4, 4},
18 | {3, 3, 4, 3, 3, 2, 2},
19 | {9, 3, 4, 7, 3, 4, 1},
20 | {3, 5, 4, 3, 6, 3, 8},
21 | {3, 4, 4, 6, 3, 4, 4},
22 | {3, 7, 4, 8, 3, 8, 4},
23 | {6, 3, 5, 9, 2, 7, 9}
24 | };
25 | int sum = 0;
26 | int rowLength = employeeWorkHours.length;
27 | int columnLength = employeeWorkHours[0].length;
28 | int [] sumOfWorkingHour = new int[rowLength];
29 |
30 | for (int row = 0; row < rowLength; row++) {
31 | for (int col = 0; col < columnLength; col++) {
32 | sum += employeeWorkHours[row][col];
33 | }
34 | sumOfWorkingHour[row] = sum;
35 | sum = 0;
36 | }
37 |
38 | // Sort
39 | for (int i = 1; i < sumOfWorkingHour.length; i++) {
40 | for (int j = i; j > 0; j--) {
41 | if (sumOfWorkingHour[j] > sumOfWorkingHour [j - 1]) {
42 | int temp = sumOfWorkingHour[j];
43 | sumOfWorkingHour[j] = sumOfWorkingHour[j - 1];
44 | sumOfWorkingHour[j - 1] = temp;
45 |
46 | }
47 | }
48 | }
49 | for (int i = 0; i < sumOfWorkingHour.length; i++) {
50 | System.out.println(sumOfWorkingHour[i]);
51 | }
52 |
53 |
54 | }
55 | }
--------------------------------------------------------------------------------
/src/_8_MultiDimensionalArrays/GradeExam.java:
--------------------------------------------------------------------------------
1 | // Write a program that grades the test and displays the result. It compares each student’s answers
2 | // with the key, counts the number of correct answers, and displays it.
3 |
4 | package _8_MultiDimensionalArrays;
5 |
6 | public class GradeExam {
7 |
8 | /**
9 | * Main method
10 | */
11 | public static void main(String[] args) {
12 | // Students' answers to the questions
13 | char[][] answers = {
14 | {'A', 'B', 'A', 'C', 'C', 'D', 'E', 'E', 'A', 'D'},
15 | {'D', 'B', 'A', 'B', 'C', 'A', 'E', 'E', 'A', 'D'},
16 | {'E', 'D', 'D', 'A', 'C', 'B', 'E', 'E', 'A', 'D'},
17 | {'C', 'B', 'A', 'E', 'D', 'C', 'E', 'E', 'A', 'D'},
18 | {'A', 'B', 'D', 'C', 'C', 'D', 'E', 'E', 'A', 'D'},
19 | {'B', 'B', 'E', 'C', 'C', 'D', 'E', 'E', 'A', 'D'},
20 | {'B', 'B', 'A', 'C', 'C', 'D', 'E', 'E', 'A', 'D'},
21 | {'E', 'B', 'E', 'C', 'C', 'D', 'E', 'E', 'A', 'D'}};
22 | // Key to the questions (Correct Answers)
23 | char[] keys = {'D', 'B', 'D', 'C', 'C', 'D', 'A', 'E', 'A', 'D'};
24 |
25 | // Grade all answers
26 | for (int i = 0; i < answers.length; i++) {
27 | // Grade one student
28 | int correctCount = 0;
29 | for (int j = 0; j < answers[i].length; j++) {
30 | if (answers[i][j] == keys[j])
31 | correctCount++;
32 | }
33 |
34 | System.out.println("Student " + (i + 1) + "'s correct count is " +
35 | correctCount);
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/_8_MultiDimensionalArrays/PassTwoDimensionalArray.java:
--------------------------------------------------------------------------------
1 | // You can pass a two-dimensional array to a method just as you pass a one-dimensional array.
2 | // You can also return an array from a method. This program gives an example with two methods.
3 | // The first method, getArray(), returns a two-dimensional array, and the second method,
4 | // sum(int[][] m), returns the sum of all the elements in a matrix.
5 |
6 | package _8_MultiDimensionalArrays;
7 |
8 | import java.util.Scanner;
9 |
10 | public class PassTwoDimensionalArray {
11 |
12 | public static int[][] getArray(){
13 |
14 | Scanner input = new Scanner(System.in);
15 |
16 | int[][] arrayList = new int[3][3]; // We specified the size of the array we want our user to input.
17 |
18 | System.out.println("Enter " + arrayList.length + " rows and " + arrayList[0].length + " column : " ); // i.e enter 4 rows and 3 columns.
19 |
20 | for(int row = 0; row < arrayList.length; row++)
21 | for (int column = 0; column < arrayList[row].length; column++)
22 |
23 | arrayList[row][column] = input.nextInt(); // Input the values of the rows and the columns.
24 | return arrayList;
25 | }
26 | public static int sum(int [][] arrayList) {
27 | int total = 0;
28 | for (int row = 0; row < arrayList.length; row++)
29 | for (int column = 0; column < arrayList[0].length; column++)
30 | total += arrayList[row][column];
31 | return total;
32 | }
33 |
34 |
35 | public static void main(String []args){
36 |
37 | int[][] myList = getArray();
38 | System.out.println("\nSum of all elements is " + sum(myList));
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/_9_ObjectsAndClasses/Bike.java:
--------------------------------------------------------------------------------
1 | package _9_ObjectsAndClasses;
2 |
3 | public class Bike {
4 | private boolean isOn;
5 |
6 | public boolean isOn(){
7 | return true;
8 | }
9 | public boolean isOff() {
10 | return isOff();
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/_9_ObjectsAndClasses/Circle.java:
--------------------------------------------------------------------------------
1 | package _9_ObjectsAndClasses;
2 |
3 | public class Circle {
4 | private final double radius;
5 |
6 | public double getPerimeter() {
7 | return 2 * Math.PI * radius;
8 | }
9 | public double getArea(){
10 | return radius * radius * Math.PI;
11 | }
12 | public Circle(double radius){
13 | this.radius = radius;
14 | }
15 | public static void main(String[] args) {
16 |
17 | Circle circle1 = new Circle(4);
18 | Circle circle2 = new Circle(6);
19 |
20 | System.out.printf("%s%.2f%n","The area of circle 1 is ", circle1.getArea());
21 | System.out.printf("%s%.2f%n","The area of circle 2 is ", circle2.getArea());
22 |
23 | System.out.printf("%s%.2f%n","The perimeter of circle 1 is ", circle1.getPerimeter());
24 | System.out.printf("%s%.2f%n", "The area of circle 2 is ", circle2.getPerimeter());
25 |
26 | }
27 |
28 | }
--------------------------------------------------------------------------------
/src/_9_ObjectsAndClasses/CircleClass.java:
--------------------------------------------------------------------------------
1 | package _9_ObjectsAndClasses;
2 |
3 | /** Write a program that creates 10 circles, it then initializes circle radii with random values and
4 | displays the radius and area per circle, and the sum of the areas of the circle */
5 |
6 | public class CircleClass {
7 |
8 | double radius = 10 + (Math.random() * 50); // My radius can be from 10 to 50.
9 | double area = Math.PI * radius * radius;
10 | public static CircleClass[] createTenCircles() {
11 | CircleClass[] circles = new CircleClass[10]; // Here we created an array of reference type CircleClass.
12 | for (int i = 0; i < circles.length; i++) {
13 | CircleClass circleObject = new CircleClass(); // Here we created 10 objects.
14 | circles[i] = circleObject;
15 | }
16 | return circles;
17 | }
18 |
19 | public double getArea() {
20 | return area;
21 | }
22 |
23 | public static void displayIt(){
24 | for(int j =0; j < createTenCircles().length; j++){
25 | System.out.println(createTenCircles());
26 | }
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/src/_9_ObjectsAndClasses/DateAndTimeClassAndObject.java:
--------------------------------------------------------------------------------
1 | /** Note that Java API contains a rich set of classes for developing Java programs.
2 | * All the classes in the java library are all static classes.*/
3 |
4 | package _9_ObjectsAndClasses;
5 |
6 | public class DateAndTimeClassAndObject {
7 |
8 | public static void main(String[] args) {
9 |
10 | java.util.Date date = new java.util.Date();
11 | // We constructed a date object from a static java class 'java.util.Date'.
12 |
13 | System.out.printf("%s%d%s%n", "The elapsed time since jan 1 1970 is ", date.getTime(), " milliseconds");
14 | System.out.printf("%s%n%s", "The current date and time is ", date);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/_9_ObjectsAndClasses/DateClass.java:
--------------------------------------------------------------------------------
1 | package _9_ObjectsAndClasses;
2 | import java.util.*;
3 | import java.util.Calendar;
4 |
5 | public class DateClass {
6 | public static void main(String args[])
7 | {
8 | Calendar c = Calendar.getInstance();
9 | System.out.println("The Current Date is:" + c.getTime());
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/_9_ObjectsAndClasses/Dogs.java:
--------------------------------------------------------------------------------
1 | package _9_ObjectsAndClasses;
2 |
3 | /**--- We can use static variables only when the value of the variable does not differ from instances of the class ---*/
4 |
5 | public class Dogs {
6 |
7 | private static String name;
8 |
9 | public Dogs(String name){
10 | this.name = name;
11 | }
12 |
13 | public void printName(){
14 | System.out.println("name = " + name);
15 | }
16 |
17 | public static void main(String[] args) {
18 | Dogs bingo = new Dogs("Bingo");
19 | Dogs nosa = new Dogs("Nosa");
20 |
21 | // This will print 'Nosa' twice because we changed the static variable value to Nosa when instantiating the nosa object.
22 | bingo.printName();
23 | nosa.printName();
24 | }
25 | }
26 |
27 |
--------------------------------------------------------------------------------
/src/_9_ObjectsAndClasses/MyFirstTdd.java:
--------------------------------------------------------------------------------
1 | package _9_ObjectsAndClasses;
2 |
3 | public class MyFirstTdd {
4 |
5 | public int add(int number1, int number2, int number3, int number4){
6 | return number1 + number2 + number3 + number4;
7 | }
8 |
9 | public int findTheMaximumNumberOf(int number1, int number2, int number3){
10 | return Math.max(number1, Math.max(number2, number3));
11 | }
12 |
13 | public int findTheMinimumNumberOf(int number1, int number2, int number3){
14 | return Math.min(number1, Math.min(number2, number3));
15 | }
16 |
17 | }
18 |
19 |
--------------------------------------------------------------------------------
/src/_9_ObjectsAndClasses/Native.java:
--------------------------------------------------------------------------------
1 | package _9_ObjectsAndClasses;
2 |
3 | public class Native {
4 | private int cohortId;
5 | private int scvId;
6 |
7 |
8 | public int getCohortId() {
9 | return cohortId;
10 | }
11 |
12 | public void setCohortId(int cohortId) {
13 | if (cohortId == 12) {
14 | this.cohortId = cohortId;
15 | }
16 | }
17 |
18 | public int getScvId() {
19 | return scvId;
20 | }
21 |
22 | public void setScvId(int scvId) {
23 | this.scvId = scvId;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/_9_ObjectsAndClasses/RandomClassAndObject.java:
--------------------------------------------------------------------------------
1 | package _9_ObjectsAndClasses;
2 |
3 | import java.util.Random;
4 | public class RandomClassAndObject {
5 |
6 | public static void main(String[] args) {
7 |
8 | // We called our random class explicitly.
9 |
10 | Random random1 = new Random(3);
11 | System.out.print("From random1: ");
12 | for (int i = 0; i < 10; i++)
13 | System.out.println(random1.nextInt(1000) + " ");
14 |
15 | Random random2 = new Random(3);
16 | System.out.println("From random2: ");
17 | for (int i = 0; i < 10; i++)
18 | System.out.print(random2.nextInt(1000) + " ");
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/_9_ObjectsAndClasses/ReverseNumber.java:
--------------------------------------------------------------------------------
1 | package _9_ObjectsAndClasses;
2 | // Write a program that takes in a number, and reverses it i.e 26789 to 98726
3 |
4 | public class ReverseNumber {
5 | public static int reverseNumber(int numberToReverse) {
6 | int reverse = 0;
7 | while (numberToReverse != 0) {
8 | int remainder = numberToReverse % 10;
9 | reverse = reverse * 10 + remainder;
10 | numberToReverse = numberToReverse / 10;
11 | }
12 | return reverse;
13 | }
14 |
15 | public static void main(String[] args) {
16 | int a = 1234567;
17 | System.out.println(" number reversed is "+ reverseNumber(a));
18 | }
19 | }
20 |
21 |
--------------------------------------------------------------------------------
/src/_9_ObjectsAndClasses/Television.java:
--------------------------------------------------------------------------------
1 | package _9_ObjectsAndClasses;
2 |
3 | public class Television {
4 | private int channel, volumeLevel, volumeLevelSaverBeforeMuting;
5 | private boolean isOn, volumeMuted;
6 |
7 | public boolean isOn(){
8 | return isOn;
9 | }
10 | public void turnOn(){
11 | isOn = true;
12 | channel = getChannel();
13 | }
14 | public void turnOff(){
15 | isOn = false;
16 | }
17 | public int getChannel() {
18 | return channel;
19 | }
20 | public int getVolumeLevel() {
21 | return volumeLevel;
22 | }
23 | public void setChannel(int newChannel) {
24 | if (isOn && newChannel >= 1 && newChannel < 120){
25 | channel = newChannel;
26 | }
27 | }
28 | public void setVolume(int newVolume){
29 | if (isOn && newVolume >= 1 && newVolume < 7){
30 | volumeLevel = newVolume;
31 | }
32 | }
33 | public void channelUp(){
34 | if (isOn && channel < 120){
35 | channel++;
36 | }
37 | }
38 | public void channelDown(){
39 | if (isOn && channel > 1){
40 | channel--;
41 | }
42 | }
43 | public void volumeUp(){
44 | if (isOn && volumeLevel < 7){
45 | volumeLevel++;
46 | }
47 | }
48 |
49 | public void volumeDown(){
50 | if (isOn && volumeLevel > 1){
51 | volumeLevel--;
52 | }
53 | }
54 | public void mute(){
55 | if (isOn & volumeLevel > 1) {
56 | volumeMuted = true;
57 | volumeLevelSaverBeforeMuting = volumeLevel;
58 | volumeLevel = 0;
59 | }
60 | }
61 | public void unmute(){
62 | if (isOn){
63 | volumeMuted = false;
64 | volumeLevel = volumeLevelSaverBeforeMuting;
65 | }
66 | }
67 | public boolean volumeMuted(){
68 | return volumeMuted;
69 | }
70 |
71 | }
72 |
--------------------------------------------------------------------------------
/src/_9_ObjectsAndClasses/Time.java:
--------------------------------------------------------------------------------
1 | package _9_ObjectsAndClasses;
2 | public class Time {
3 | private int minute;
4 | private int second;
5 | private int hour;
6 |
7 |
8 | public Time(int minute, int second, int hour) {
9 | validate(minute, second, hour);
10 |
11 | this.minute = minute;
12 | this.second = second;
13 | this.hour = hour;
14 | }
15 |
16 | public void setMinute(int minute) {
17 | validateMinute(minute);
18 | this.minute = minute;
19 | }
20 |
21 | public void setSecond(int second) {
22 | validateSecond(second);
23 | this.second = second;
24 | }
25 |
26 | public void setHour(int hour) {
27 | validateHour(hour);
28 | this.hour = hour;
29 | }
30 |
31 | private void validate(int minute, int second, int hour) {
32 | validateSecond(second); // Abstraction
33 | validateMinute(minute);
34 | validateHour(hour);
35 | }
36 |
37 | private void validateSecond(int second) {
38 | if(second <0 || second >59) throw new IllegalArgumentException
39 | (String.format("Second entered is %s, please enter seconds between 0 and 59", second));
40 | }
41 |
42 | private void validateMinute(int minute) {
43 | if(minute <0 || minute >59) throw new IllegalArgumentException
44 | (String.format("Minute entered is %s, please enter minute between 0 and 59", minute));
45 | }
46 |
47 | private void validateHour(int hour) {
48 | if(hour <0 || hour >23) throw new IllegalArgumentException
49 | (String.format("Hour entered is %s, please enter hour between 0 and 23", hour));
50 | }
51 | }
--------------------------------------------------------------------------------
/src/org/junit/jupiter/api/Ben_Billion_Explanation.java:
--------------------------------------------------------------------------------
1 | package org.junit.jupiter.api;
2 |
3 | // Annotation that sets a human-readable name for an element (for example, "Maximum Throughput").
4 | // Use headline-style capitalization, capitalize the first and last words, and all nouns, pronouns, adjectives, verbs and adverbs. Do not include ending punctuation.
5 | // (powered by Ben~Billion 2022)
6 |
7 | public @interface Ben_Billion_Explanation {
8 | String value();
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/src/org/junit/jupiter/api/Ben_Billion_Notes.java:
--------------------------------------------------------------------------------
1 | package org.junit.jupiter.api;
2 | //Annotation that sets a human-readable name for an element (for example, "Maximum Throughput").
3 | // Use headline-style capitalization, capitalize the first and last words, and all nouns, pronouns, adjectives, verbs and adverbs. Do not include ending punctuation.
4 | // The Ben_Billion_Notes should not be used as an identifier.
5 | // (powered by Ben~Billion 2022)
6 |
7 | public @interface Ben_Billion_Notes {
8 | String value();
9 | }
10 |
11 |
--------------------------------------------------------------------------------
/src/org/junit/jupiter/api/Ben_Billion_Test.java:
--------------------------------------------------------------------------------
1 | package org.junit.jupiter.api;
2 | //
3 | // Source code recreated from a .class file by Ben-Billion
4 | // (powered by Ben-Billion 2022)
5 | //
6 | public @interface Ben_Billion_Test {
7 | }
8 |
--------------------------------------------------------------------------------
/src/org/junit/jupiter/api/Key_Point.java:
--------------------------------------------------------------------------------
1 | package org.junit.jupiter.api;
2 |
3 |
4 |
5 | //Annotation that sets a human-readable name for an element (for example, "Maximum Throughput").
6 | // Use headline-style capitalization, capitalize the first and last words, and all nouns, pronouns, adjectives, verbs and adverbs. Do not include ending punctuation.
7 | // The Key_Point should not be used as an identifier.
8 | // (powered by Ben~Billion 2022)
9 |
10 | public @interface Key_Point {
11 | String value();
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/test/BikeTest.java:
--------------------------------------------------------------------------------
1 | import _9_ObjectsAndClasses.Bike;
2 | import org.junit.jupiter.api.BeforeEach;
3 | import org.junit.jupiter.api.Ben_Billion_Test;
4 |
5 | public class BikeTest {
6 | Bike powerBike;
7 |
8 | @BeforeEach
9 | public void instantiation() {
10 | powerBike = new Bike();
11 | }
12 |
13 | @Ben_Billion_Test
14 | public void testThatBikeCanBeTurnedOn(){
15 | // Given that powerBike can be turned off
16 | // Check that power bike can be turned on
17 | // Assert true
18 |
19 | }
20 |
21 |
22 |
23 |
24 | }
--------------------------------------------------------------------------------
/test/BmiTest.java:
--------------------------------------------------------------------------------
1 | import _10_ObjectOrientedThinking.BmiNew;
2 | import org.junit.jupiter.api.BeforeEach;
3 | import org.junit.jupiter.api.Test;
4 | import static org.junit.jupiter.api.Assertions.assertEquals;
5 |
6 | public class BmiTest {
7 | BmiNew bmi;
8 | @BeforeEach
9 | void setUp(){
10 | bmi = new BmiNew();
11 | }
12 | @Test
13 | public void testThatBmiCannotBeComputedWithNegativeValues(){
14 | bmi.setHeight(-70);
15 | bmi.setWeight(146);
16 | assertEquals(20.948603801493316,bmi.getBmi());
17 | }
18 | @Test
19 | public void testThatBmiReturnsCorrectStatus(){
20 | bmi.setHeight(70);
21 | bmi.setWeight(146);
22 | assertEquals("Normal",bmi.getStatus());
23 | }
24 |
25 |
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/test/ComputeLoanTest.java:
--------------------------------------------------------------------------------
1 | import _10_ObjectOrientedThinking.ComputeLoanNew;
2 | import org.junit.jupiter.api.BeforeEach;
3 | import org.junit.jupiter.api.DisplayName;
4 | import org.junit.jupiter.api.Test;
5 |
6 | import static org.junit.jupiter.api.Assertions.*;
7 |
8 | public class ComputeLoanTest {
9 | ComputeLoanNew loan2;
10 | @BeforeEach
11 | void setUp(){
12 | loan2 = new ComputeLoanNew();
13 | }@Test
14 | @DisplayName("Test that Monthly payments cannot be calculated with negative values")
15 | public void test1(){
16 | loan2.setAnnualInterest(-2.5);
17 | loan2.setNumberOfYears(5);
18 | loan2.setLoanAmount(1000);
19 | assertNotEquals(18, loan2.getMonthlyPayment());
20 | }@Test
21 | @DisplayName("Test that monthly payments can be computed with proper values")
22 | public void test2(){
23 | assertNotEquals(18, loan2.getMonthlyPayment());
24 | loan2.setAnnualInterest(2.5);
25 | loan2.setNumberOfYears(5);
26 | loan2.setLoanAmount(1000);
27 | assertEquals(18, loan2.getMonthlyPayment());
28 | }@Test
29 | @DisplayName("Test that total payments can be calculated")
30 | public void test3(){
31 | loan2.setAnnualInterest(2.5);
32 | loan2.setNumberOfYears(5);
33 | loan2.setLoanAmount(1000);
34 | assertEquals(1080, loan2.getTotalPayment());
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/test/CopyArrayTest.java:
--------------------------------------------------------------------------------
1 | import _7_SingleDimensionalArrays.CopyArray;
2 | import org.junit.jupiter.api.BeforeEach;
3 | import org.junit.jupiter.api.Test;
4 |
5 | import static org.junit.jupiter.api.Assertions.assertEquals;
6 |
7 | public class CopyArrayTest {
8 | CopyArray copyArray;
9 | @BeforeEach
10 | void setUp(){
11 | copyArray = new CopyArray();
12 | }
13 | @Test
14 | public void copyElementsOfArrayTest(){
15 | int[] array = {3, 67, 34, 6, 9};
16 | assertEquals(array.length, copyArray.copyElementsOfArray(array));
17 | }
18 | //TODO I will have to create a method that replicates all the elements of an array and also test it
19 |
20 | public void testThatPrintingOccurs(){}
21 |
22 |
23 |
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/test/NativeTest.java:
--------------------------------------------------------------------------------
1 | import _9_ObjectsAndClasses.Native;
2 | import org.junit.jupiter.api.BeforeEach;
3 | import org.junit.jupiter.api.Test;
4 |
5 | import static org.junit.jupiter.api.Assertions.assertEquals;
6 |
7 | public class NativeTest {
8 | Native unicorns;
9 |
10 | @BeforeEach
11 | void setUp() {
12 | unicorns= new Native();
13 | }
14 |
15 | @Test
16 | public void CohortIdTest(){
17 | unicorns.setCohortId(34);
18 | assertEquals(0, unicorns.getCohortId());
19 | }
20 | }
21 | // TODO : more implementations on my main class and an all round testing
--------------------------------------------------------------------------------
/test/OutlierTest.java:
--------------------------------------------------------------------------------
1 | import HumbleMe.Outlier;
2 | import org.junit.jupiter.api.Assertions;
3 | import org.junit.jupiter.api.BeforeEach;
4 | import org.junit.jupiter.api.Test;
5 |
6 | public class OutlierTest {
7 | Outlier outlier;
8 | @BeforeEach
9 | void setUp(){
10 |
11 | }
12 |
13 | @Test
14 | public void testThatFieldCanReturnOutlier(){
15 | outlier = new Outlier();
16 | int [] arrayOfIntegers = {2, 4, 6, 7, 8};
17 | Assertions.assertEquals(7, outlier.returnOutlier(arrayOfIntegers));
18 | }
19 |
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/test/com/unicornsWimps/Animal.java:
--------------------------------------------------------------------------------
1 | package com.unicornsWimps;
2 |
3 | import java.math.BigDecimal;
4 |
5 | public abstract class Animal {
6 | private int position = BigDecimal.ONE.intValue();
7 |
8 | public int getPosition() {
9 | return position;
10 | }
11 |
12 | public void setPosition(int position) {
13 | this.position = position;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/test/com/unicornsWimps/Hare.java:
--------------------------------------------------------------------------------
1 | package com.unicornsWimps;
2 |
3 | public class Hare extends Animal{
4 | }
5 |
--------------------------------------------------------------------------------
/test/com/unicornsWimps/RaceCourse.java:
--------------------------------------------------------------------------------
1 | package com.unicornsWimps;
2 |
3 | public class RaceCourse {
4 | private int[] raceTrack = new int[100];
5 |
6 | public RaceCourse(){
7 | this.raceTrack = new int[100];
8 | }
9 |
10 | public RaceCourse(int[] raceTrack){
11 | if(raceTrack.length < 70){
12 | this.setRaceTrack(new int[100]);
13 | }
14 | else{
15 | this.raceTrack = raceTrack;
16 | }
17 |
18 | }
19 |
20 | public int[] getRaceTrack(){
21 | return raceTrack;
22 | }
23 |
24 | public void setRaceTrack(int[] raceTrack) {
25 | this.raceTrack = raceTrack;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/test/com/unicornsWimps/RaceSimulator.java:
--------------------------------------------------------------------------------
1 | package com.unicornsWimps;
2 |
3 | import java.math.BigDecimal;
4 | import java.security.SecureRandom;
5 |
6 | public class RaceSimulator {
7 | public static int generateMoveNumber(){
8 | int moveNumber = 0;
9 | SecureRandom generator = new SecureRandom();
10 | moveNumber = BigDecimal.ONE.intValue() + generator.nextInt(10);
11 | return moveNumber;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/test/com/unicornsWimps/RaceSimulatorTest.java:
--------------------------------------------------------------------------------
1 | //package com.unicornsWimps;
2 | //
3 | //import org.junit.jupiter.api.BeforeEach;
4 | //import org.junit.jupiter.api.Test;
5 | //
6 | //import java.math.BigDecimal;
7 | //
8 | //import static org.junit.jupiter.api.Assertions.*;
9 | //
10 | //public class RaceSimulatorTest {
11 | // private RaceCourse raceCourse;
12 | // private Hare nnamdi;
13 | // private Tortoise ijapa;
14 | //
15 | // @BeforeEach
16 | // public void setUp(){
17 | // raceCourse = new RaceCourse();
18 | // nnamdi = new Hare();
19 | // ijapa= new Tortoise();
20 | // }
21 | // @Test
22 | // public void getRaceTrack(){
23 | // assertNotNull(raceCourse.getRaceTrack());
24 | // }
25 | // @Test
26 | //// public void createRaceTrackWithSmallTrack(){
27 | //// int [] track = new int[20];
28 | //// raceCourse = new RaceCourse(smallTrack);
29 | //// assertNotNull(raceCourse.getRaceTrack());
30 | //// assertTrue(raceCourse.getRaceTrack().length > 70);
31 | //// }
32 | //// @Test
33 | //// public void checkAnimalAytStartPosition(){
34 | //// assertEquals(1, nnamdi.getPosition());
35 | //// assertEquals(1, ijapa.getPosition());
36 | //// }
37 | // @Test
38 | // public void generateNumber(){
39 | // int moveNumber = RaceSimulator.generateMoveNumber();
40 | // assertTrue(moveNumber > BigDecimal.ZERO.intValue());
41 | // assertTrue(moveNumber > BigDecimal.ONE.intValue());
42 | // }
43 | //
44 | //}
45 | //
46 |
--------------------------------------------------------------------------------
/test/com/unicornsWimps/Tortoise.java:
--------------------------------------------------------------------------------
1 | package com.unicornsWimps;
2 |
3 | public class Tortoise {
4 | }
5 |
--------------------------------------------------------------------------------