├── .gitignore ├── .gitattributes ├── live_review_sections ├── week3 │ ├── Week3Notes.txt │ ├── TernaryExample.java │ ├── BasicLoopExamples.java │ ├── CustomMethod2.java │ ├── CustomMethod3.java │ ├── PrintAllLetters.java │ └── CustomMethods1.java ├── week7 │ ├── R06_WrapperClassCharacters.java │ └── Products.java ├── week11 │ ├── exercise_example │ │ ├── Lifting.java │ │ ├── Exercise.java │ │ ├── Running.java │ │ ├── Swimming.java │ │ ├── AtTheGym.java │ │ └── FreeWeight.java │ ├── car_examples │ │ ├── Tesla.java │ │ ├── BMW.java │ │ ├── Toyota.java │ │ ├── ParkingLot.java │ │ └── Car.java │ └── FinalKeyword.java ├── week9 │ ├── inheritance │ │ ├── Book.java │ │ ├── Ebook.java │ │ ├── AudioBook.java │ │ └── BookObjects.java │ └── StaticTest.java ├── week12 │ ├── polymorphism_demo │ │ ├── Worker.java │ │ ├── Superman.java │ │ └── Father.java │ └── interface_demo │ │ └── WebDriver.java ├── week4 │ ├── ImportExample.java │ ├── LocalVsInstance.java │ ├── BankAccount.java │ ├── TestCase.java │ ├── SalaryTest.java │ ├── GarbageExample.java │ ├── AmazonTest_2.java │ ├── CalculatorOverLoading.java │ ├── LocalVsInstanceTest.java │ └── ScrumTeam.java ├── week8 │ ├── testEnvironment │ │ ├── TestEnvironment.java │ │ ├── OS.java │ │ └── Browser.java │ ├── Login.java │ └── Employee.java ├── week2 │ ├── EvenorOdd.java │ ├── RelationalOperators.java │ ├── SwitchInTestersLife.java │ └── AddNumbersfromReplit.java ├── week1 │ ├── TellMeAboutYourself.java │ ├── CarInfo.java │ ├── PrintStatements.java │ ├── _Shapes.java │ └── ScanerExample.java ├── week13 │ ├── customExceptions │ │ ├── BreakTimeException.java │ │ └── CustomExceptionTest.java │ ├── StringIndexProblem.java │ └── FinallyBlock.java ├── week10 │ ├── SupportPersonel.java │ ├── Tester.java │ ├── Developer.java │ └── AmazonInc.java ├── week6 │ ├── QuizQ4.java │ └── A07_SentenceSplit.java ├── week5 │ ├── S04_IndexOfExample.java │ └── S09_FrequencyOfWord.java └── week14 │ └── ListIsEqualToSetExample.java ├── src ├── day38_inheritance_part2 │ ├── Vehicle.java │ ├── Person.java │ ├── CarTest.java │ ├── StaticSub.java │ ├── ConstructorTest.java │ ├── Employee.java │ ├── SuperClass.java │ ├── SubClass.java │ ├── Car.java │ ├── Contractor.java │ ├── Student.java │ ├── StaticSuper.java │ ├── FullTimeEmployee.java │ ├── DogTest.java │ ├── CompanyTest.java │ └── StaticTest.java ├── day42_interface │ ├── SelfDriving.java │ ├── Car.java │ ├── Vehicle.java │ ├── TeslaTruck.java │ ├── ElectricTruck.java │ ├── Electric.java │ ├── Tesla2.java │ └── Tesla.java ├── day44_oopreview │ ├── callcenter │ │ ├── VideoCallable.java │ │ ├── WhatApp2.java │ │ ├── ScreenSharable.java │ │ ├── VideoMessagingApp.java │ │ ├── VoiceCallable.java │ │ └── WhatsApp.java │ └── shapes │ │ ├── Shape.java │ │ ├── Diamond.java │ │ ├── Triangle.java │ │ ├── Square.java │ │ ├── ShapeTest.java │ │ └── ShapeActions.java ├── day40_accessmodifiers_final │ ├── Child.java │ ├── Parent.java │ ├── Rodent.java │ ├── TestMouse.java │ ├── Mouse.java │ ├── KangarooTest.java │ ├── CarTest.java │ ├── Car.java │ ├── Marsupial.java │ ├── FinalArrayList.java │ ├── Kangaroo.java │ ├── FinalArray.java │ ├── TestParentChild.java │ └── FinalMethods.java ├── day43_polymorphism │ ├── Shape.java │ ├── Circle.java │ ├── Triangle.java │ ├── Square.java │ ├── TestShape.java │ ├── InstanceOf.java │ ├── TestAnimal.java │ └── ShapesArray.java ├── day34_Constructors │ ├── LigthTest.java │ ├── Apple.java │ ├── Dice.java │ ├── AppleTest.java │ └── DiceTest.java ├── day36_staticClassMembers │ ├── ABC.java │ ├── Dinner.java │ ├── CampusTest.java │ ├── Countable.java │ ├── AllBlocksTest.java │ ├── Car.java │ ├── ABCTest.java │ ├── Campus.java │ ├── StaticImport.java │ ├── Calculator.java │ ├── Student.java │ ├── AllBlocks.java │ ├── CountableTest.java │ ├── StudentTest.java │ ├── CalculatorTest.java │ └── DinnerTest.java ├── day33_ClassObjects_Constructors │ ├── MouseTest.java │ ├── Rectangle.java │ ├── StudentTest.java │ ├── RectangleTest.java │ └── CarTest.java ├── day45_exceptionHandling │ ├── Runtimeerror.java │ ├── BadArray.java │ ├── CheckedVSUncheckedException.java │ ├── OrCatchBlock.java │ ├── TryCatchFinally.java │ ├── Nullpointer.java │ └── TyCatch2.java ├── day01_hello_world │ └── Main.java ├── day30_wrapperClass │ ├── CommandLineArgument.java │ ├── MathClass.java │ ├── task97_filterString.java │ └── task96_ConvertingTemp.java ├── day40_accessmodifiers_final_2 │ ├── Car2.java │ └── CarTest.java ├── day11_controlFlowStatements_5 │ ├── DoWhileLoop.java │ ├── task52_whileLoop.java │ ├── task48_Pattern.java │ ├── task49_pattern.java │ ├── task50_Pattern.java │ ├── task53_sumOfEvenNumbers.java │ ├── NestedForLoop.java │ ├── task47_Pattern.java │ ├── NestedForLoop2.java │ └── WhileLoop.java ├── day04_arithmetic_operators │ ├── Task8_VariablePractice.java │ ├── Task13_FindSum.java │ ├── Task15_MileConverter.java │ ├── Task14_ConvertFahrenheitToCelcius.java │ ├── Task16_AreaOfCircle.java │ ├── Task17_AverageNumbers.java │ └── Discount.java ├── day07_control_flow_statements │ ├── Task24_EligibleToVote.java │ ├── Task26_EqualNumbers.java │ ├── Task27_GreetingHours.java │ ├── Task25_GreatestNumber.java │ ├── Task28_RevenueCalculator.java │ └── IfStatements.java ├── day10_controlFlowStatements_4 │ ├── task41_OddNumbers.java │ ├── task40_EvenNumbers.java │ ├── task43_PrintTable.java │ ├── task46_MultiplicationTable.java │ ├── task42_SumOfEvenOddNumbers.java │ └── task45_RepeatedBiggerNumber.java ├── day21_stringManipulation_part3 │ └── String_Trim.java ├── day39_inheritance_review │ └── ToyotaTest.java ├── day41_abstract_class │ ├── Dog.java │ ├── Parrot.java │ └── Bird.java ├── day02_printing_comments │ ├── Task1_triangle.java │ ├── Commenting.java │ ├── Concatenation.java │ ├── PrintlnVSprint.java │ ├── Task4_escapeSequence.java │ ├── HelloWorld.java │ ├── EscapeSequences.java │ └── Task3_printExercise.java ├── day12_controlFlowStatements_6 │ ├── BreakContinue.java │ ├── LabeledStatements.java │ └── BranchingStatements.java ├── day24_arrays_part1 │ ├── task89_ShoppingList.java │ ├── task90_FindingCar.java │ └── task87_DayArray.java ├── day37_inheritance │ ├── Company.java │ ├── Student.java │ ├── Employee.java │ ├── Person.java │ ├── School.java │ ├── GradeActivity.java │ └── FinalExam.java ├── day14_methods_Part2 │ ├── ValueReturn.java │ ├── task66_DistanceTraveled.java │ └── Lab2_Love6.java ├── day13_methods_Part1 │ ├── task56_convertKM.java │ ├── SimpleMethod.java │ ├── task57_sumOfNumbers.java │ ├── task59_PayCalculator.java │ ├── task61_AgeCalculator.java │ ├── PassMultipleArguments.java │ ├── LoopCallMethod.java │ ├── PassArg.java │ ├── task58_greaterNumber.java │ ├── DeepAndDeeper.java │ ├── StudentMethod.java │ ├── CredirCardMethod.java │ ├── GoogleSearch.java │ └── task60_calculator.java ├── day05_unary_assignment_relational_operators │ ├── Task18_PrepostDecrementIncrement.java │ ├── Task22_RelationalOperator.java │ ├── Task21_IncrementDecrement.java │ ├── Task19_IncrementDecrement.java │ ├── Task20_IncrementDecrement.java │ ├── AssignmentOperators.java │ └── TypeCasting.java ├── day15_methods_Part3 │ ├── MethodOverloading2.java │ ├── assignment1_SwapValue.java │ ├── task67_LastDigit.java │ ├── task68_Retirement.java │ └── assignment3_Fibonacci.java ├── day25_arrays_part2 │ ├── PassElements.java │ ├── ReturnArray.java │ ├── task92_TableArray.java │ └── SameArray.java ├── day08_control_flow_statements_2 │ ├── Task30_EvenOddNumber.java │ ├── Task31_TriangleAngles.java │ ├── Task29_BiggerNumber.java │ ├── Task33_Grading.java │ ├── Task35_FindGreatestNested.java │ ├── NestedIfStatement.java │ ├── Task32_LargestNumber.java │ └── Task36_Calculator.java ├── day06_logical_operators │ └── Task23_Operators.java ├── day29_arrays_Lab │ ├── Lab4_Question18.java │ ├── Lab4_Question23.java │ ├── Lab4_Question16.java │ ├── Lab4_Question20.java │ ├── Lab4_Question21.java │ ├── Lab4_Question24.java │ ├── Lab4_Question22.java │ ├── Lab4_Question29.java │ ├── Lab4_Question17.java │ └── Lab4_Question19.java ├── day19_stringManipulation_part1 │ ├── task76_PrintingEachCharacter.java │ ├── String_Length.java │ ├── task78_CountHowMany.java │ ├── task75_TotalCharacters.java │ └── task79_PrintingWovels.java ├── day03_variables_dataTypes │ ├── ConstantVariables.java │ └── CreatingVariables.java ├── day22_stringManipulation_Lab │ ├── Question_8.java │ ├── Question_9.java │ ├── Question_1.java │ ├── Question_5.java │ ├── Quetion_10.java │ ├── Question_2.java │ ├── Question_6.java │ ├── Question_3.java │ ├── Question_7.java │ ├── Question_4.java │ └── String_IsEmpty.java ├── day09_controlFlowStatements_3 │ ├── IfElseRules.java │ ├── SwitchCaseRules.java │ ├── task37_LaptopModels.java │ └── task39_TrafficLightSelector.java ├── day16_classObejcts │ ├── CellPhone.java │ ├── Contact.java │ ├── Employee.java │ ├── Dog.java │ └── DogObjects.java ├── day27_arrays_part4 │ ├── Loop2DArray.java │ ├── RaggedArray.java │ └── Lab4_Question3.java ├── day20_stringManipulation_part2 │ ├── task81_TimeStamp.java │ ├── task80_CheckString.java │ └── String_Replace.java ├── day18_readingUserInput │ ├── UserInput2.java │ ├── task72_SumNumbers.java │ └── UserInput3.java ├── day35_encapsulation │ ├── CarpetTest.java │ ├── PerseonTest.java │ ├── RoulettePocketTest.java │ ├── PrinterTest.java │ └── Person.java ├── day46_collection_part1 │ ├── VectorExample.java │ └── LinkedListExample.java ├── day23_stringManipulationLab_randomClasss │ ├── task84_CoinToss.java │ ├── Question_14.java │ ├── RandomNumbers.java │ ├── Question_13.java │ └── Question_15.java ├── day28_arrays_Lab │ ├── Lab4_Question12.java │ ├── Lab4_Question9.java │ ├── Lab4_Question15.java │ ├── Lab4_Question5.java │ ├── Lab4_Question4.java │ ├── Lab4_Question7.java │ ├── Lab4_Question8.java │ ├── Lab4_Question14.java │ ├── Lab4_Question6.java │ ├── Lab4_Question10.java │ └── Lab4_Question11.java ├── day17_classObjects_Part2 │ ├── BMW.java │ └── CarObjects.java ├── day31_arrayList │ └── AddAll.java ├── day47_collection_part2 │ └── LoopSet.java └── day32_arrayList_part2 │ └── RemoveAll.java ├── .settings └── org.eclipse.core.resources.prefs ├── ReplitSolutions ├── assignment9 │ ├── Question03.java │ ├── Question04.java │ ├── Question07.java │ ├── Question08.java │ ├── Question12.java │ ├── Question06.java │ ├── Question05.java │ └── Question09.java ├── _0_002_Basics_HelloWorld2.java ├── _0_005_Basics_FixPrint.java ├── _0_006_Basics_Cool.java ├── _0_001_Basics_HelloWorld1.java ├── _0_010_Basics_PrintVariable1.java ├── _0_004_Basics_PrintNumbers.java ├── _0_011_Basics_PrintVariable2.java ├── _0_003_Basics_PrintName.java ├── _1_001_Variables_Primitives1.java ├── _3_001_String_VerifyContains.java ├── _4_013_Loops_PrintEvenFrom80To20.java ├── _3_005_String_PrintLastCharacter.java ├── _3_004_String_PrintFirstCharacter.java ├── _6_036_Methods_MethodsWithStringRemoveFirstChar.java ├── _3_006_String_PrintFirstAndLastLetters.java └── _6_024_Methods_MethodsWithReturn3Locks.java ├── .project └── .classpath /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | bin 3 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /live_review_sections/week3/Week3Notes.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cybertek-EU7/JavaProgramming_EU7/HEAD/live_review_sections/week3/Week3Notes.txt -------------------------------------------------------------------------------- /src/day38_inheritance_part2/Vehicle.java: -------------------------------------------------------------------------------- 1 | package day38_inheritance_part2; 2 | 3 | public class Vehicle { 4 | 5 | int maxSpeed = 120; 6 | 7 | } 8 | -------------------------------------------------------------------------------- /src/day42_interface/SelfDriving.java: -------------------------------------------------------------------------------- 1 | package day42_interface; 2 | 3 | public interface SelfDriving { 4 | 5 | void selfDrive(); 6 | 7 | 8 | } 9 | -------------------------------------------------------------------------------- /.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//live_review_sections/week2/DivisionAndRemainderPractice.java=UTF-8 3 | -------------------------------------------------------------------------------- /ReplitSolutions/assignment9/Question03.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cybertek-EU7/JavaProgramming_EU7/HEAD/ReplitSolutions/assignment9/Question03.java -------------------------------------------------------------------------------- /ReplitSolutions/assignment9/Question04.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cybertek-EU7/JavaProgramming_EU7/HEAD/ReplitSolutions/assignment9/Question04.java -------------------------------------------------------------------------------- /src/day42_interface/Car.java: -------------------------------------------------------------------------------- 1 | package day42_interface; 2 | 3 | @FunctionalInterface 4 | public interface Car { 5 | 6 | void mA(); 7 | 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/day44_oopreview/callcenter/VideoCallable.java: -------------------------------------------------------------------------------- 1 | package day44_oopreview.callcenter; 2 | 3 | public interface VideoCallable { 4 | 5 | void videoCall(); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /src/day42_interface/Vehicle.java: -------------------------------------------------------------------------------- 1 | package day42_interface; 2 | 3 | public class Vehicle { 4 | 5 | void drive() { 6 | System.out.println("Vehicle is driving"); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /live_review_sections/week7/R06_WrapperClassCharacters.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cybertek-EU7/JavaProgramming_EU7/HEAD/live_review_sections/week7/R06_WrapperClassCharacters.java -------------------------------------------------------------------------------- /src/day44_oopreview/callcenter/WhatApp2.java: -------------------------------------------------------------------------------- 1 | package day44_oopreview.callcenter; 2 | 3 | public class WhatApp2 implements VoiceCallable { 4 | 5 | public void call(String contact) {} 6 | } 7 | -------------------------------------------------------------------------------- /live_review_sections/week11/exercise_example/Lifting.java: -------------------------------------------------------------------------------- 1 | package week11.exercise_example; 2 | 3 | public abstract class Lifting extends Exercise{ 4 | 5 | public abstract void endLift(); 6 | } 7 | -------------------------------------------------------------------------------- /src/day40_accessmodifiers_final/Child.java: -------------------------------------------------------------------------------- 1 | package day40_accessmodifiers_final; 2 | 3 | public class Child extends Parent { 4 | 5 | public int x = 200; 6 | 7 | 8 | 9 | 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/day43_polymorphism/Shape.java: -------------------------------------------------------------------------------- 1 | package day43_polymorphism; 2 | 3 | public class Shape { 4 | 5 | public void draw() { 6 | System.out.println("Drawing a shape"); 7 | } 8 | 9 | 10 | } 11 | -------------------------------------------------------------------------------- /live_review_sections/week9/inheritance/Book.java: -------------------------------------------------------------------------------- 1 | package week9.inheritance; 2 | 3 | public class Book { 4 | 5 | String title; 6 | String type; 7 | String author; 8 | double price; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/day44_oopreview/callcenter/ScreenSharable.java: -------------------------------------------------------------------------------- 1 | package day44_oopreview.callcenter; 2 | 3 | public interface ScreenSharable { 4 | 5 | void ShareScreen(); //public abstract void ShareScreen(); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /live_review_sections/week12/polymorphism_demo/Worker.java: -------------------------------------------------------------------------------- 1 | package week12.polymorphism_demo; 2 | 3 | public interface Worker { 4 | 5 | void work(String job); 6 | 7 | double getPaid(); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/day38_inheritance_part2/Person.java: -------------------------------------------------------------------------------- 1 | package day38_inheritance_part2; 2 | 3 | public class Person { 4 | 5 | public void message() { 6 | System.out.println("This is person classs"); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/day40_accessmodifiers_final/Parent.java: -------------------------------------------------------------------------------- 1 | package day40_accessmodifiers_final; 2 | 3 | public class Parent { 4 | 5 | public int x = 100; 6 | 7 | public void increment() { 8 | x++; 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/day43_polymorphism/Circle.java: -------------------------------------------------------------------------------- 1 | package day43_polymorphism; 2 | 3 | public class Circle extends Shape { 4 | 5 | public void draw() { 6 | System.out.println("Drawing a circle"); 7 | } 8 | 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/day44_oopreview/callcenter/VideoMessagingApp.java: -------------------------------------------------------------------------------- 1 | package day44_oopreview.callcenter; 2 | 3 | public abstract class VideoMessagingApp extends MessagingApp implements ScreenSharable,VideoCallable { 4 | 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /src/day34_Constructors/LigthTest.java: -------------------------------------------------------------------------------- 1 | package day34_Constructors; 2 | 3 | public class LigthTest { 4 | 5 | public static void main(String[] args) { 6 | 7 | Light l1 = new Light(); 8 | 9 | 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/day38_inheritance_part2/CarTest.java: -------------------------------------------------------------------------------- 1 | package day38_inheritance_part2; 2 | 3 | public class CarTest { 4 | 5 | public static void main(String[] args) { 6 | 7 | Car c1 = new Car(); 8 | c1.display(); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/day38_inheritance_part2/StaticSub.java: -------------------------------------------------------------------------------- 1 | package day38_inheritance_part2; 2 | 3 | public class StaticSub extends StaticSuper { 4 | 5 | public void print() { 6 | System.out.println(num); 7 | } 8 | 9 | 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/day43_polymorphism/Triangle.java: -------------------------------------------------------------------------------- 1 | package day43_polymorphism; 2 | 3 | public class Triangle extends Shape { 4 | 5 | @Override 6 | public void draw() { 7 | System.out.println("Drawing a triangle"); 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/day34_Constructors/Apple.java: -------------------------------------------------------------------------------- 1 | package day34_Constructors; 2 | 3 | public class Apple { 4 | 5 | //instance variable 6 | String color = "Red"; 7 | 8 | public void mA() { 9 | System.out.println(color); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/day36_staticClassMembers/ABC.java: -------------------------------------------------------------------------------- 1 | package day36_staticClassMembers; 2 | 3 | public class ABC { 4 | 5 | private ABC() { 6 | 7 | } 8 | 9 | public static void m1() {} 10 | 11 | public static void m2() {} 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/day43_polymorphism/Square.java: -------------------------------------------------------------------------------- 1 | package day43_polymorphism; 2 | 3 | public class Square extends Shape { 4 | 5 | @Override 6 | public void draw() { 7 | System.out.println("Drawing a square"); 8 | } 9 | 10 | 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/day38_inheritance_part2/ConstructorTest.java: -------------------------------------------------------------------------------- 1 | package day38_inheritance_part2; 2 | 3 | public class ConstructorTest { 4 | 5 | public static void main(String[] args) { 6 | 7 | SubClass obj = new SubClass(); 8 | 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/day38_inheritance_part2/Employee.java: -------------------------------------------------------------------------------- 1 | package day38_inheritance_part2; 2 | 3 | public class Employee { 4 | 5 | void calculatePay(int hours,double rate) { 6 | System.out.println("Employee total pay:" + (hours * rate)); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/day38_inheritance_part2/SuperClass.java: -------------------------------------------------------------------------------- 1 | package day38_inheritance_part2; 2 | 3 | public class SuperClass { 4 | 5 | public SuperClass() { 6 | 7 | System.out.println("This is the super class Constructor"); 8 | 9 | } 10 | 11 | 12 | 13 | 14 | } 15 | -------------------------------------------------------------------------------- /ReplitSolutions/_0_002_Basics_HelloWorld2.java: -------------------------------------------------------------------------------- 1 | //Write a complete main method that prints Hello world to the screen. 2 | public class _0_002_Basics_HelloWorld2 { 3 | public static void main(String[] args) { 4 | System.out.print("**`Hello world`**"); 5 | 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/day40_accessmodifiers_final/Rodent.java: -------------------------------------------------------------------------------- 1 | package day40_accessmodifiers_final; 2 | 3 | public class Rodent { 4 | 5 | protected int tailLength = 4; 6 | 7 | public void getRodentDetails() { 8 | System.out.println("parentTail:" + tailLength); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/day40_accessmodifiers_final/TestMouse.java: -------------------------------------------------------------------------------- 1 | package day40_accessmodifiers_final; 2 | 3 | public class TestMouse { 4 | 5 | public static void main(String[] args) { 6 | 7 | Mouse mouse = new Mouse(); 8 | 9 | mouse.getMouseDetails(); 10 | 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /live_review_sections/week4/ImportExample.java: -------------------------------------------------------------------------------- 1 | package week4; 2 | 3 | import week3.CustomMethod3; 4 | 5 | public class ImportExample { 6 | 7 | public static void main(String[] args) { 8 | 9 | System.out.println(CustomMethod3.getAgeInDays(35)); 10 | 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /ReplitSolutions/_0_005_Basics_FixPrint.java: -------------------------------------------------------------------------------- 1 | //Rearrange the following code so that 2 | // it forms a correct program that prints out the letter Q 3 | public class _0_005_Basics_FixPrint { 4 | public static void main(String[] args) { 5 | 6 | System.out.print("Q"); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /ReplitSolutions/_0_006_Basics_Cool.java: -------------------------------------------------------------------------------- 1 | //Write a program that displays: I think being a programmer is cool 2 | 3 | public class _0_006_Basics_Cool { 4 | public static void main(String[] args) { 5 | 6 | System.out.println("I think being a programmer is cool"); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/day38_inheritance_part2/SubClass.java: -------------------------------------------------------------------------------- 1 | package day38_inheritance_part2; 2 | 3 | public class SubClass extends SuperClass { 4 | 5 | public SubClass() { 6 | 7 | System.out.println("This is the subclass constructor"); 8 | } 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/day42_interface/TeslaTruck.java: -------------------------------------------------------------------------------- 1 | package day42_interface; 2 | 3 | public class TeslaTruck extends TeslaSemi { 4 | 5 | public TeslaTruck(String model, double price, String color, double engineSize) { 6 | super(model, price, color, engineSize); 7 | } 8 | 9 | 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/day33_ClassObjects_Constructors/MouseTest.java: -------------------------------------------------------------------------------- 1 | package day33_ClassObjects_Constructors; 2 | 3 | public class MouseTest { 4 | 5 | public static void main(String[] args) { 6 | 7 | Mouse mouse = new Mouse(15); 8 | 9 | 10 | 11 | mouse.print(); 12 | 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/day43_polymorphism/TestShape.java: -------------------------------------------------------------------------------- 1 | package day43_polymorphism; 2 | 3 | public class TestShape { 4 | 5 | public static void main(String[] args) { 6 | 7 | Shape s1 = new Shape(); 8 | s1.draw(); 9 | 10 | Shape s2 = new Circle(); 11 | s2.draw(); 12 | 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/day44_oopreview/shapes/Shape.java: -------------------------------------------------------------------------------- 1 | package day44_oopreview.shapes; 2 | 3 | public class Shape { 4 | 5 | public String type; 6 | 7 | public Shape() { 8 | type="shape"; 9 | } 10 | 11 | public void draw() { 12 | System.out.println("Drawing a shape"); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/day44_oopreview/shapes/Diamond.java: -------------------------------------------------------------------------------- 1 | package day44_oopreview.shapes; 2 | 3 | public class Diamond extends Shape { 4 | 5 | public Diamond() { 6 | type="diamond"; 7 | } 8 | 9 | @Override 10 | public void draw() { 11 | System.out.println("Drawing a diamond"); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/day45_exceptionHandling/Runtimeerror.java: -------------------------------------------------------------------------------- 1 | package day45_exceptionHandling; 2 | 3 | public class Runtimeerror { 4 | 5 | public static void main(String[] args) { 6 | go(); 7 | } 8 | 9 | public static void go() { 10 | System.out.println("Going"); 11 | go(); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/day01_hello_world/Main.java: -------------------------------------------------------------------------------- 1 | package day01_hello_world; 2 | 3 | public class Main { 4 | 5 | public static void main(String[] args) { 6 | // write your code here 7 | 8 | System.out.println("Hello World"); 9 | 10 | 11 | } 12 | } 13 | 14 | /* 15 | Date 16 | */ -------------------------------------------------------------------------------- /src/day30_wrapperClass/CommandLineArgument.java: -------------------------------------------------------------------------------- 1 | package day30_wrapperClass; 2 | 3 | public class CommandLineArgument { 4 | 5 | public static void main(String[] args) { 6 | 7 | for(int i=0;i=18) { 10 | 11 | System.out.println("Eligible to vote"); 12 | } 13 | 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/day38_inheritance_part2/Student.java: -------------------------------------------------------------------------------- 1 | package day38_inheritance_part2; 2 | 3 | public class Student extends Person { 4 | 5 | @Override 6 | public void message() { 7 | System.out.println("This is student class"); 8 | } 9 | 10 | public void display() { 11 | message(); 12 | super.message(); 13 | } 14 | 15 | 16 | 17 | } 18 | -------------------------------------------------------------------------------- /ReplitSolutions/_0_010_Basics_PrintVariable1.java: -------------------------------------------------------------------------------- 1 | //Given an integer variable count write a statement that displays the value 2 | 3 | public class _0_010_Basics_PrintVariable1 { 4 | public static void main(String[] args) { 5 | //do not change 6 | int count = 100; 7 | 8 | System.out.println(count); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/day10_controlFlowStatements_4/task41_OddNumbers.java: -------------------------------------------------------------------------------- 1 | package day10_controlFlowStatements_4; 2 | 3 | public class task41_OddNumbers { 4 | 5 | public static void main(String[] args) { 6 | 7 | for(int i=5;i<=140;i++) { 8 | 9 | if(i%2!=0) { 10 | 11 | System.out.print(i + " "); 12 | } 13 | } 14 | 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/day11_controlFlowStatements_5/task52_whileLoop.java: -------------------------------------------------------------------------------- 1 | package day11_controlFlowStatements_5; 2 | 3 | public class task52_whileLoop { 4 | 5 | public static void main(String[] args) { 6 | 7 | int i=25; 8 | 9 | while(i>10) { 10 | 11 | System.out.println("in the loop"); 12 | 13 | i--; 14 | } 15 | 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/day36_staticClassMembers/CampusTest.java: -------------------------------------------------------------------------------- 1 | package day36_staticClassMembers; 2 | 3 | public class CampusTest { 4 | 5 | public static void main(String[] args) { 6 | 7 | 8 | 9 | Campus c1 = new Campus("McLean"); 10 | Campus c2 = new Campus("Arlington"); 11 | 12 | System.out.println(Campus.country); 13 | 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /live_review_sections/week4/BankAccount.java: -------------------------------------------------------------------------------- 1 | package week4; 2 | 3 | public class BankAccount { 4 | 5 | String accountHolderName; 6 | int pin; 7 | double balance; 8 | long accountNumber; 9 | 10 | public double getBalance(int inputPin) { 11 | if(pin==inputPin) { 12 | return balance; 13 | } 14 | return -1; 15 | } 16 | 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/day21_stringManipulation_part3/String_Trim.java: -------------------------------------------------------------------------------- 1 | package day21_stringManipulation_part3; 2 | 3 | public class String_Trim { 4 | 5 | public static void main(String[] args) { 6 | 7 | //String str = " 342 "; //|342| 8 | 9 | //System.out.println("|"+str.trim()+"|"); 10 | 11 | 12 | 13 | 14 | 15 | } 16 | 17 | 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/day36_staticClassMembers/Countable.java: -------------------------------------------------------------------------------- 1 | package day36_staticClassMembers; 2 | 3 | public class Countable { 4 | 5 | static int instanceCount; //instance vriable 6 | int instanceCount2; 7 | 8 | public Countable() { 9 | instanceCount++; 10 | } 11 | 12 | public int getInstanceCount() { 13 | return instanceCount; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/day38_inheritance_part2/StaticSuper.java: -------------------------------------------------------------------------------- 1 | package day38_inheritance_part2; 2 | 3 | public class StaticSuper { 4 | 5 | public static int num; 6 | 7 | public static void m1() { 8 | System.out.println("StaticSuper.m1() called"); 9 | } 10 | 11 | public void m2() { 12 | System.out.println("StaticSuper.m2() called"); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /live_review_sections/week11/exercise_example/Exercise.java: -------------------------------------------------------------------------------- 1 | package week11.exercise_example; 2 | 3 | public abstract class Exercise { 4 | 5 | public void start() { 6 | System.out.println("Warming up and starting the exercise"); 7 | } 8 | 9 | public abstract void perform(); 10 | 11 | public abstract int getCaloriesCount(int minutes); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/day38_inheritance_part2/FullTimeEmployee.java: -------------------------------------------------------------------------------- 1 | package day38_inheritance_part2; 2 | 3 | public class FullTimeEmployee extends Employee { 4 | 5 | @Override 6 | void calculatePay(int hours, double rate) { 7 | double total = (hours * rate)*1.05; 8 | System.out.println("FullTime Emplyee Total Pay:" + total); 9 | } 10 | 11 | 12 | 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/day39_inheritance_review/ToyotaTest.java: -------------------------------------------------------------------------------- 1 | package day39_inheritance_review; 2 | 3 | public class ToyotaTest { 4 | 5 | public static void main(String args[]) { 6 | 7 | Toyota toyota = new Toyota(36); 8 | 9 | toyota.steer(45); 10 | toyota.accelerate(30); 11 | toyota.accelerate(20); 12 | toyota.accelerate(-42); 13 | } 14 | 15 | } 16 | 17 | -------------------------------------------------------------------------------- /ReplitSolutions/_0_004_Basics_PrintNumbers.java: -------------------------------------------------------------------------------- 1 | //Write multiple print statements that will print from 1 to 10 in separate lines. 2 | // 3 | // 1 2 3 4 5 6 7 8 9 10 4 | public class _0_004_Basics_PrintNumbers { 5 | public static void main(String[] args) { 6 | 7 | System.out.println("\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10"); 8 | 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/day04_arithmetic_operators/Task13_FindSum.java: -------------------------------------------------------------------------------- 1 | package day04_arithmetic_operators; 2 | 3 | public class Task13_FindSum { 4 | 5 | public static void main(String[] args) { 6 | 7 | int num1,num2,sum; 8 | 9 | num1=200; 10 | num2=100; 11 | sum=num1+num2; 12 | 13 | System.out.println(num1 + "+" + num2 + "=" + sum); 14 | 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/day10_controlFlowStatements_4/task40_EvenNumbers.java: -------------------------------------------------------------------------------- 1 | package day10_controlFlowStatements_4; 2 | 3 | public class task40_EvenNumbers { 4 | 5 | public static void main(String[] args) { 6 | 7 | for(int i=1;i<=100;i++) { 8 | 9 | if(i%2==0) { 10 | 11 | System.out.print(i + " "); 12 | } 13 | 14 | 15 | } 16 | 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /live_review_sections/week11/car_examples/Tesla.java: -------------------------------------------------------------------------------- 1 | package week11.car_examples; 2 | 3 | public final class Tesla extends Car { 4 | 5 | public Tesla(String model, String color, int year) { 6 | super(model,color, year); 7 | super.make = "Tesla"; 8 | } 9 | 10 | 11 | public void start() { 12 | 13 | System.out.println("Say start"); 14 | 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /live_review_sections/week7/Products.java: -------------------------------------------------------------------------------- 1 | package week7; 2 | 3 | public class Products { 4 | 5 | String name; 6 | double price; 7 | 8 | public void setInfo(String n, double d) { 9 | name = n; 10 | price = d; 11 | } 12 | 13 | 14 | public String toString() { 15 | return "Products [name=" + name + ", price=" + price + "]"; 16 | } 17 | 18 | 19 | 20 | } 21 | -------------------------------------------------------------------------------- /ReplitSolutions/_0_011_Basics_PrintVariable2.java: -------------------------------------------------------------------------------- 1 | //Given a String variable message write a statement to disply its value 2 | 3 | public class _0_011_Basics_PrintVariable2 { 4 | public static void main(String[] args) { 5 | //do not change 6 | String message = "I am a Cybertek school student."; 7 | 8 | System.out.println(message); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/day04_arithmetic_operators/Task15_MileConverter.java: -------------------------------------------------------------------------------- 1 | package day04_arithmetic_operators; 2 | 3 | public class Task15_MileConverter { 4 | 5 | public static void main(String[] args) { 6 | 7 | double mile,km; 8 | mile=72.5; 9 | 10 | km=mile*1.609344; 11 | 12 | System.out.println(mile + " mile is equal to " + km + "km"); 13 | 14 | 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/day41_abstract_class/Dog.java: -------------------------------------------------------------------------------- 1 | package day41_abstract_class; 2 | 3 | public class Dog extends Animal{ 4 | 5 | 6 | @Override 7 | void eat() { 8 | System.out.println("Dog food"); 9 | } 10 | 11 | 12 | @Override 13 | void breathe() { 14 | // TODO Auto-generated method stub 15 | 16 | } 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/day41_abstract_class/Parrot.java: -------------------------------------------------------------------------------- 1 | package day41_abstract_class; 2 | 3 | public class Parrot extends Bird { 4 | 5 | @Override 6 | void fly() { 7 | // TODO Auto-generated method stub 8 | 9 | } 10 | 11 | @Override 12 | void breathe() { 13 | // TODO Auto-generated method stub 14 | 15 | } 16 | 17 | String x = "apple"; 18 | 19 | 20 | 21 | 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/day45_exceptionHandling/BadArray.java: -------------------------------------------------------------------------------- 1 | package day45_exceptionHandling; 2 | 3 | public class BadArray { 4 | 5 | public static void main(String[] args) { 6 | 7 | int[] number = {1,2,3}; 8 | 9 | for(int i=0;i<=number.length;i++) { 10 | System.out.println(number[i]); 11 | } 12 | 13 | System.out.println("Learning exception"); 14 | 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /live_review_sections/week2/EvenorOdd.java: -------------------------------------------------------------------------------- 1 | package week2; 2 | 3 | public class EvenorOdd { 4 | 5 | public static void main(String[] args) { 6 | 7 | int number = 100;// check if this is even or not 8 | 9 | if (number%2==0) { 10 | System.out.println("Even"); 11 | }else { 12 | System.out.println("Odd"); 13 | } 14 | 15 | 16 | 17 | 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/day44_oopreview/shapes/Square.java: -------------------------------------------------------------------------------- 1 | package day44_oopreview.shapes; 2 | 3 | public class Square extends Shape { 4 | 5 | public Square() { 6 | type="square"; 7 | } 8 | 9 | @Override 10 | public void draw() { 11 | System.out.println("Drawing a square"); 12 | } 13 | 14 | public void squareMethod() { 15 | System.out.println("Square method"); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /ReplitSolutions/_0_003_Basics_PrintName.java: -------------------------------------------------------------------------------- 1 | //Suppose your name was Alan Turing. 2 | // Write a main method and a statement that would print your last name, 3 | // followed by a comma, followed by a space and your first name. 4 | public class _0_003_Basics_PrintName { 5 | public static void main(String[] args) { 6 | 7 | System.out.println("Turing, Alan"); 8 | 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /live_review_sections/week11/car_examples/BMW.java: -------------------------------------------------------------------------------- 1 | package week11.car_examples; 2 | 3 | public class BMW extends Car { 4 | 5 | public BMW(String model, String make, String color, int year) { 6 | super(model,color, year); 7 | super.make = make; 8 | } 9 | 10 | @Override 11 | public void start() { 12 | 13 | System.out.println("Push the start button"); 14 | 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /live_review_sections/week11/exercise_example/Running.java: -------------------------------------------------------------------------------- 1 | package week11.exercise_example; 2 | 3 | public class Running extends Exercise{ 4 | 5 | @Override 6 | public void perform() { 7 | // TODO Auto-generated method stub 8 | 9 | } 10 | 11 | @Override 12 | public int getCaloriesCount(int minutes) { 13 | // TODO Auto-generated method stub 14 | return 0; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/day02_printing_comments/Task1_triangle.java: -------------------------------------------------------------------------------- 1 | package day02_printing_comments; 2 | 3 | public class Task1_triangle { 4 | 5 | public static void main(String[] args) { 6 | 7 | System.out.println(" *"); 8 | System.out.println(" * *"); 9 | System.out.println(" * *"); 10 | System.out.println(" * *"); 11 | System.out.println("*********"); 12 | 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/day12_controlFlowStatements_6/BreakContinue.java: -------------------------------------------------------------------------------- 1 | package day12_controlFlowStatements_6; 2 | 3 | public class BreakContinue { 4 | 5 | public static void main(String[] args) { 6 | 7 | for(int i=1;i<=5;i++) { 8 | 9 | if(i==4) { 10 | 11 | //break; 12 | continue; 13 | 14 | } 15 | 16 | System.out.println(i); 17 | } 18 | 19 | 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/day40_accessmodifiers_final/CarTest.java: -------------------------------------------------------------------------------- 1 | package day40_accessmodifiers_final; 2 | 3 | public class CarTest { 4 | 5 | public static void main(String[] args) { 6 | 7 | Car c = new Car(); 8 | c.model = "m3"; 9 | c.year = 2017; 10 | //c.door = 4; //private 11 | c.engine = 5.2; 12 | 13 | System.out.println(c.toString()); 14 | 15 | 16 | 17 | 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /ReplitSolutions/assignment9/Question07.java: -------------------------------------------------------------------------------- 1 | package assignment9; 2 | 3 | public class Question07 { 4 | 5 | public static void main(String[] args) { 6 | String word = "java"; 7 | 8 | if (word.length() % 2 == 0) { 9 | String half = word.substring(0, word.length() / 2); 10 | System.out.println(half + half); 11 | } else { 12 | System.out.println("invalid"); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /live_review_sections/week11/exercise_example/Swimming.java: -------------------------------------------------------------------------------- 1 | package week11.exercise_example; 2 | 3 | public class Swimming extends Exercise{ 4 | 5 | @Override 6 | public void perform() { 7 | // TODO Auto-generated method stub 8 | 9 | } 10 | 11 | @Override 12 | public int getCaloriesCount(int minutes) { 13 | // TODO Auto-generated method stub 14 | return 0; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /live_review_sections/week4/TestCase.java: -------------------------------------------------------------------------------- 1 | package week4; 2 | 3 | public class TestCase { 4 | 5 | // P.I.Q.: How Do You write a Test Case? 6 | 7 | String testCaseID; 8 | String testCaseDescription; 9 | int numberOfTestSteps; 10 | boolean isPassed; 11 | 12 | // HW : create more attributes and some actions 13 | // create a class with main method and create objects of TestCases 14 | } 15 | -------------------------------------------------------------------------------- /src/day24_arrays_part1/task89_ShoppingList.java: -------------------------------------------------------------------------------- 1 | package day24_arrays_part1; 2 | 3 | public class task89_ShoppingList { 4 | 5 | public static void main(String[] args) { 6 | 7 | String[] shoppingList = {"cheese","pumpkin","bread","eggs","milk"}; 8 | 9 | for(int i=0;ii2; 12 | 13 | System.out.println("First Number is greater than second number - " + b1); 14 | 15 | 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/day08_control_flow_statements_2/Task30_EvenOddNumber.java: -------------------------------------------------------------------------------- 1 | package day08_control_flow_statements_2; 2 | 3 | public class Task30_EvenOddNumber { 4 | 5 | public static void main(String[] args) { 6 | 7 | int number=6; 8 | 9 | if(number%2==0) { 10 | System.out.println("Number:" + number + " is even number"); 11 | }else { 12 | System.out.println("Number:" + number + " is odd number"); 13 | } 14 | 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/day12_controlFlowStatements_6/LabeledStatements.java: -------------------------------------------------------------------------------- 1 | package day12_controlFlowStatements_6; 2 | 3 | public class LabeledStatements { 4 | 5 | public static void main(String[] args) { 6 | 7 | int i=0; 8 | outer: 9 | do { 10 | i=8; 11 | inner: 12 | while(true) { 13 | System.out.println(i--); 14 | if(i==4) { 15 | break outer; 16 | } 17 | } 18 | }while(true); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/day40_accessmodifiers_final/Marsupial.java: -------------------------------------------------------------------------------- 1 | package day40_accessmodifiers_final; 2 | 3 | public class Marsupial { 4 | 5 | /* 6 | public boolean isBiped() { 7 | return false; 8 | } 9 | */ 10 | 11 | 12 | 13 | public static boolean isBiped() { 14 | return false; 15 | } 16 | 17 | 18 | public void getMarsupialDescription() { 19 | System.out.println("Marsupial walks on the two legs:" + isBiped()); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/day04_arithmetic_operators/Task14_ConvertFahrenheitToCelcius.java: -------------------------------------------------------------------------------- 1 | package day04_arithmetic_operators; 2 | 3 | public class Task14_ConvertFahrenheitToCelcius { 4 | 5 | public static void main(String[] args) { 6 | 7 | double celcius,fahrenheit; 8 | celcius=99.9; 9 | 10 | fahrenheit= 9 * celcius / 5 + 32; 11 | 12 | System.out.println(celcius + " celcius is equal to " + fahrenheit + " fahrenheit" ); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/day06_logical_operators/Task23_Operators.java: -------------------------------------------------------------------------------- 1 | package day06_logical_operators; 2 | 3 | public class Task23_Operators { 4 | 5 | public static void main(String[] args) { 6 | 7 | double d1 = 20; 8 | double d2 = 80; 9 | 10 | double res = (d1+d2)*25; 11 | 12 | double remainder = res%40; 13 | 14 | System.out.println("Ramaining total is equal to 20 or less? - " + (remainder<=20)); 15 | 16 | 17 | 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/day11_controlFlowStatements_5/task49_pattern.java: -------------------------------------------------------------------------------- 1 | package day11_controlFlowStatements_5; 2 | 3 | public class task49_pattern { 4 | 5 | public static void main(String[] args) { 6 | 7 | int rows=7; 8 | 9 | 10 | for(int i=1;i<=rows;i++) { 11 | 12 | for(int j=1;j<=i;j++) { 13 | 14 | System.out.print(" "); 15 | 16 | } 17 | 18 | System.out.println("#"); 19 | 20 | } 21 | } 22 | 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/day29_arrays_Lab/Lab4_Question18.java: -------------------------------------------------------------------------------- 1 | package day29_arrays_Lab; 2 | 3 | public class Lab4_Question18 { 4 | 5 | public static void main(String[] args) { 6 | 7 | int[] x = {1,2,2,1,3,13,3}; 8 | 9 | int sum = 0; 10 | 11 | for(int i=0;i COLORS = new ArrayList<>(); 10 | 11 | COLORS.add("Orange"); 12 | COLORS.add("Red"); 13 | COLORS.remove(0); 14 | 15 | //COLORS = new ArrayList(); 16 | 17 | 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | JavaProgramming_EU7 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /live_review_sections/week4/SalaryTest.java: -------------------------------------------------------------------------------- 1 | package week4; 2 | 3 | public class SalaryTest { 4 | 5 | public static void main(String[] args) { 6 | 7 | 8 | Salary shevki = new Salary(); 9 | shevki.setInfo(70, 45, 0.19); 10 | 11 | System.out.println(shevki.salaryAfterTax()); 12 | 13 | Salary hande = new Salary(); 14 | hande.setInfo(100, 35, 0.15); 15 | System.out.println(hande.salaryAfterTax()); 16 | 17 | 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/day08_control_flow_statements_2/Task31_TriangleAngles.java: -------------------------------------------------------------------------------- 1 | package day08_control_flow_statements_2; 2 | 3 | public class Task31_TriangleAngles { 4 | 5 | public static void main(String[] args) { 6 | 7 | int a=60; 8 | int b=60; 9 | int c=70; 10 | 11 | if((a+b+c)==180) { 12 | System.out.println("This is a valid triangle"); 13 | }else { 14 | System.out.println("This is not a valid triangle"); 15 | } 16 | 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/day11_controlFlowStatements_5/task53_sumOfEvenNumbers.java: -------------------------------------------------------------------------------- 1 | package day11_controlFlowStatements_5; 2 | 3 | public class task53_sumOfEvenNumbers { 4 | 5 | public static void main(String[] args) { 6 | 7 | int i=0; 8 | int sumEven=0; 9 | 10 | while(i<100) { 11 | 12 | if(i%2==0) { 13 | 14 | sumEven = sumEven + i; 15 | } 16 | 17 | i++; 18 | } 19 | 20 | System.out.println(sumEven); 21 | 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/day13_methods_Part1/task57_sumOfNumbers.java: -------------------------------------------------------------------------------- 1 | package day13_methods_Part1; 2 | 3 | public class task57_sumOfNumbers { 4 | 5 | public static void main(String[] args) { 6 | 7 | sumNumbers(); 8 | 9 | 10 | } 11 | 12 | public static void sumNumbers() { 13 | 14 | int num1=10; 15 | int num2=50; 16 | int num3=50; 17 | 18 | int sum=num1+num2+num3; 19 | 20 | System.out.println("Total is " + sum); 21 | 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/day13_methods_Part1/task59_PayCalculator.java: -------------------------------------------------------------------------------- 1 | package day13_methods_Part1; 2 | 3 | 4 | public class task59_PayCalculator { 5 | 6 | public static void main(String[] args) { 7 | 8 | payCalculator(80, 20); 9 | payCalculator(37, 62.50); 10 | 11 | } 12 | 13 | public static void payCalculator(double hours,double hourlyPay) { 14 | 15 | double pay = hours * hourlyPay; 16 | 17 | System.out.println(pay); 18 | 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/day37_inheritance/Employee.java: -------------------------------------------------------------------------------- 1 | package day37_inheritance; 2 | 3 | public class Employee extends Person{ 4 | 5 | String jobTitle; 6 | 7 | public void work() { 8 | System.out.println(name + " is working as " + jobTitle); 9 | } 10 | 11 | @Override 12 | public String toString() { 13 | return "Employee [jobTitle=" + jobTitle + ", name=" + name + ", age=" + age + ", gender=" + gender + "]"; 14 | } 15 | 16 | 17 | 18 | 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/day11_controlFlowStatements_5/NestedForLoop.java: -------------------------------------------------------------------------------- 1 | package day11_controlFlowStatements_5; 2 | 3 | public class NestedForLoop { 4 | 5 | public static void main(String[] args) { 6 | 7 | for(int i=1;i<=5;i++) { 8 | 9 | System.out.println("Outer Loop Iteration " + i); 10 | 11 | for(int j=1;j<=2;j++) { 12 | 13 | System.out.println("i = " + i + "; j = " + j); 14 | 15 | } 16 | 17 | } 18 | 19 | 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/day19_stringManipulation_part1/task76_PrintingEachCharacter.java: -------------------------------------------------------------------------------- 1 | package day19_stringManipulation_part1; 2 | 3 | public class task76_PrintingEachCharacter { 4 | 5 | public static void main(String[] args) { 6 | 7 | String str = "Cybertek School"; 8 | 9 | for(int i=0;inum2) { 12 | // biggerNumber=num1; 13 | // 14 | // }else { 15 | // biggerNumber=num2; 16 | // } 17 | 18 | biggerNumber = (num1>num2)? num1 : num2; 19 | 20 | System.out.println(biggerNumber); 21 | 22 | 23 | 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /live_review_sections/week4/AmazonTest_2.java: -------------------------------------------------------------------------------- 1 | package week4; 2 | 3 | public class AmazonTest_2 { 4 | 5 | public static void main(String[] args) { 6 | 7 | System.out.println("--Starting Amazon Search Functional Test--"); 8 | AmazonTest.openBrowser(); 9 | AmazonTest.navigateToAmazonPage(); 10 | AmazonTest.searchForAnItem("Selenium"); 11 | AmazonTest.verifyResultsAreDisplayed(); 12 | System.out.println("Amazon Search Functional Test compeleted-PASS-"); 13 | 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /live_review_sections/week9/inheritance/Ebook.java: -------------------------------------------------------------------------------- 1 | package week9.inheritance; 2 | 3 | public class Ebook extends Book { 4 | 5 | int size; // MB 6 | int pages; 7 | String format; // mobi, epub 8 | 9 | public void readBook() { 10 | System.out.println("Reading book: "); 11 | System.out.println("Title : "+title); 12 | System.out.println("Author : "+ author); 13 | System.out.println("Size : "+size); 14 | System.out.println("Pages : "+pages); 15 | 16 | 17 | } 18 | 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/day13_methods_Part1/LoopCallMethod.java: -------------------------------------------------------------------------------- 1 | package day13_methods_Part1; 2 | 3 | public class LoopCallMethod { 4 | 5 | public static void main(String[] args) { 6 | 7 | System.out.println("hello from the main method"); 8 | for(int i=0;i<5;i++) { 9 | displayMessage(); 10 | System.out.println("Back in the main method"); 11 | } 12 | 13 | } 14 | 15 | 16 | public static void displayMessage() { 17 | System.out.println("Hello from displayMessage method"); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/day20_stringManipulation_part2/task81_TimeStamp.java: -------------------------------------------------------------------------------- 1 | package day20_stringManipulation_part2; 2 | 3 | public class task81_TimeStamp { 4 | 5 | public static void main(String[] args) { 6 | 7 | 8 | String time = "10/01/2019 15:42:00"; 9 | 10 | System.out.println(timeStamp(time)); 11 | 12 | } 13 | 14 | public static String timeStamp(String time) { 15 | 16 | time = time.replace("/", "").replace(":", "").replace(" ", ""); 17 | 18 | return time; 19 | 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/day33_ClassObjects_Constructors/RectangleTest.java: -------------------------------------------------------------------------------- 1 | package day33_ClassObjects_Constructors; 2 | 3 | public class RectangleTest { 4 | 5 | public static void main(String[] args) { 6 | 7 | Rectangle r1 = new Rectangle(); 8 | 9 | r1.length=5.2; 10 | r1.width=4.8; 11 | 12 | 13 | 14 | Rectangle r2 = new Rectangle(); 15 | r2.length=3.5; 16 | r2.width=2.7; 17 | 18 | 19 | System.out.println(r1.length); 20 | System.out.println(r2.width); 21 | 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/day36_staticClassMembers/Calculator.java: -------------------------------------------------------------------------------- 1 | package day36_staticClassMembers; 2 | 3 | public class Calculator { 4 | 5 | int x; 6 | 7 | public static double plus(double num1,double num2) { 8 | return num1+num2; 9 | } 10 | 11 | public static double minus(double num1,double num2) { 12 | return num1-num2; 13 | } 14 | 15 | public static double multiply(double num1,double num2) { 16 | return num1*num2; 17 | } 18 | 19 | public int m1() { 20 | return x+4; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /ReplitSolutions/assignment9/Question06.java: -------------------------------------------------------------------------------- 1 | package assignment9; 2 | 3 | public class Question06 { 4 | 5 | public static void main(String[] args) { 6 | String word = "abcde"; 7 | 8 | if (word.length() > 5) { 9 | System.out.println("too long"); 10 | } else if (word.length() < 5) { 11 | System.out.println("too short"); 12 | } else if (word.length()==5){ 13 | for (int i = 4; i >= 0; i--) { 14 | char c = word.charAt(i); 15 | System.out.print(c); 16 | 17 | } 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/day07_control_flow_statements/Task27_GreetingHours.java: -------------------------------------------------------------------------------- 1 | package day07_control_flow_statements; 2 | 3 | public class Task27_GreetingHours { 4 | 5 | public static void main(String[] args) { 6 | 7 | int hour = 14; 8 | 9 | if(hour<12) { 10 | System.out.println("Good Morning"); 11 | } 12 | 13 | if(hour>=12 && hour<15) { 14 | System.out.println("Good Afternoon"); 15 | } 16 | 17 | if(hour>=15) { 18 | System.out.println("Good Evening"); 19 | } 20 | 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/day13_methods_Part1/PassArg.java: -------------------------------------------------------------------------------- 1 | package day13_methods_Part1; 2 | 3 | public class PassArg { 4 | 5 | public static void main(String[] args) { 6 | 7 | double x=10.45; 8 | 9 | displayValue(10); 10 | 11 | displayValue((int)x); 12 | 13 | //displayValue(x*4); 14 | 15 | 16 | 17 | } 18 | 19 | public static void displayValue(int num1) { 20 | 21 | System.out.println("The value is " + num1); 22 | 23 | 24 | } 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/day34_Constructors/Dice.java: -------------------------------------------------------------------------------- 1 | package day34_Constructors; 2 | 3 | import java.util.Random; 4 | 5 | public class Dice { 6 | 7 | int sides; 8 | int value; 9 | 10 | public Dice(int numSides) { 11 | sides=numSides; 12 | roll(); 13 | } 14 | 15 | public void roll() { 16 | Random rand = new Random(); 17 | value=rand.nextInt(sides) + 1; 18 | } 19 | 20 | public int getSides() { 21 | return sides; 22 | } 23 | 24 | public int getValue() { 25 | return value; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /ReplitSolutions/_1_001_Variables_Primitives1.java: -------------------------------------------------------------------------------- 1 | //Declare an integer variable named degreesCelsius but do not assign any value 2 | // 3 | // Nothing else. Yes, its that simple! 4 | 5 | public class _1_001_Variables_Primitives1 { 6 | public static void main(String[] args) { 7 | //WRITE YOUR CODE HERE: 8 | 9 | int degreesCelsius; 10 | 11 | 12 | //DO NOT TOUCH BELOW LINES. 13 | degreesCelsius = 35; 14 | System.out.println(degreesCelsius); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/day09_controlFlowStatements_3/SwitchCaseRules.java: -------------------------------------------------------------------------------- 1 | package day09_controlFlowStatements_3; 2 | 3 | public class SwitchCaseRules { 4 | 5 | public static void main(String[] args) { 6 | 7 | final String lastName="Smith"; 8 | String firstName="Mike"; 9 | int id=0; 10 | 11 | 12 | switch(firstName) { 13 | case "Test": 14 | System.out.println("Test"); 15 | break; 16 | case lastName: 17 | id=5; 18 | break; 19 | //case 5: 20 | // break; 21 | } 22 | 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/day10_controlFlowStatements_4/task46_MultiplicationTable.java: -------------------------------------------------------------------------------- 1 | package day10_controlFlowStatements_4; 2 | 3 | public class task46_MultiplicationTable { 4 | 5 | public static void main(String[] args) { 6 | 7 | int num=10; 8 | 9 | System.out.println("Multiplication table for " + num); 10 | System.out.println("--------------------------------"); 11 | 12 | 13 | for(int i=1;i<=10;i++) { 14 | 15 | System.out.println(num + "*" + i + "=" + (num*i)); 16 | } 17 | 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/day22_stringManipulation_Lab/Question_5.java: -------------------------------------------------------------------------------- 1 | package day22_stringManipulation_Lab; 2 | 3 | public class Question_5 { 4 | 5 | public static void main(String[] args) { 6 | 7 | System.out.println(firstHalf("WooHoo")); 8 | System.out.println(firstHalf("HelloThere")); 9 | System.out.println(firstHalf("abcdef")); 10 | 11 | 12 | } 13 | 14 | public static String firstHalf(String str) { 15 | 16 | int x = str.length()/2; 17 | 18 | return str.substring(0,x); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/day22_stringManipulation_Lab/Quetion_10.java: -------------------------------------------------------------------------------- 1 | package day22_stringManipulation_Lab; 2 | 3 | public class Quetion_10 { 4 | 5 | public static void main(String[] args) { 6 | 7 | System.out.println(frontAgain("edited")); 8 | 9 | 10 | } 11 | 12 | public static boolean frontAgain(String str) { 13 | 14 | String first2 = str.substring(0,2); //edited 15 | String last2 = str.substring(str.length()-2); 16 | 17 | return first2.equals(last2); 18 | 19 | 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /live_review_sections/week1/PrintStatements.java: -------------------------------------------------------------------------------- 1 | package week1; 2 | 3 | public class PrintStatements { 4 | 5 | public static void main(String[] args) { 6 | 7 | System.out.println("Hello EU7, Welcome to Cybertek"); 8 | 9 | System.out.println("Hi"); 10 | 11 | System.out.println("------------------------------------"); 12 | 13 | System.out.print("Hello EU7, Welcome to Cybertek"); 14 | 15 | System.out.println("Hi"); // print Hi to console than go to next line 16 | 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /live_review_sections/week10/Developer.java: -------------------------------------------------------------------------------- 1 | package week10; 2 | 3 | public class Developer extends Employee { 4 | 5 | public Developer(String name, String jobTitle, char gender, int age, double salary) { 6 | super(name, jobTitle, gender, age, salary); 7 | 8 | } 9 | 10 | @Override 11 | public void work() { 12 | System.out.println(getName()+ " is coding"); 13 | } 14 | 15 | public void fixBugs() { 16 | System.out.println(getName()+" is fixing the bug like men"); 17 | } 18 | 19 | 20 | 21 | } 22 | -------------------------------------------------------------------------------- /live_review_sections/week6/QuizQ4.java: -------------------------------------------------------------------------------- 1 | package week6; 2 | 3 | public class QuizQ4 { 4 | 5 | public static void main(String[] args) { 6 | int wd = 0; //-1, 0, 2, 4, 3 7 | String [] days = {"sun","mon","wed","sat"}; 8 | 9 | for(int i=0; inum2) { 11 | 12 | System.out.println("Num1:" + num1 + " is bigger than " + "Num2:" + num2); 13 | 14 | }else { 15 | 16 | System.out.println("Num2:" + num2 + " is bigger than " + "Num1:" + num1); 17 | 18 | 19 | } 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/day08_control_flow_statements_2/Task33_Grading.java: -------------------------------------------------------------------------------- 1 | package day08_control_flow_statements_2; 2 | 3 | public class Task33_Grading { 4 | 5 | public static void main(String[] args) { 6 | 7 | int mark=90; 8 | 9 | if(mark<60) { 10 | System.out.println("Fail"); 11 | }else if(mark>=60 && mark<90) { 12 | System.out.println("Pass"); 13 | }else if(mark>90) { 14 | System.out.println("Passed with distinction"); 15 | }else { 16 | System.out.println("Invalid Score"); 17 | } 18 | 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /live_review_sections/week9/inheritance/AudioBook.java: -------------------------------------------------------------------------------- 1 | package week9.inheritance; 2 | 3 | public class AudioBook extends Book { 4 | 5 | int lentgh; 6 | String narrator; 7 | 8 | public void listen() { 9 | System.out.println("Listening to AudioBook"); 10 | System.out.println("title of the book : "+ title); 11 | System.out.println("author : "+author); 12 | System.out.println("price : "+ price); 13 | System.out.println("Narrator : "+narrator); 14 | System.out.println("Length of the book : "+ lentgh); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/day16_classObejcts/Employee.java: -------------------------------------------------------------------------------- 1 | package day16_classObejcts; 2 | 3 | public class Employee { 4 | 5 | String name; 6 | String jobTitle; 7 | double salary; 8 | 9 | 10 | public void work() { 11 | System.out.println(name + " is working hard..."); 12 | } 13 | 14 | public void attendMeeting() { 15 | System.out.println(name + " is attending a meeting..."); 16 | } 17 | 18 | public void introduce() { 19 | System.out.println("Name:" + name + "Job title:" + jobTitle + "Salary:" + salary); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/day35_encapsulation/CarpetTest.java: -------------------------------------------------------------------------------- 1 | package day35_encapsulation; 2 | 3 | public class CarpetTest { 4 | 5 | public static void main(String[] args) { 6 | 7 | /* 8 | Floor f = new Floor(10,20); 9 | Carpet c = new Carpet(5.2); 10 | 11 | Calculator cal = new Calculator(f,c); 12 | 13 | System.out.println(cal.getTotalCost()); 14 | */ 15 | 16 | Calculator cal = new Calculator(new Floor(10,20), new Carpet(5.2)); 17 | System.out.println(cal.getTotalCost()); 18 | 19 | 20 | 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /ReplitSolutions/assignment9/Question05.java: -------------------------------------------------------------------------------- 1 | package assignment9; 2 | 3 | public class Question05 { 4 | 5 | public static void main(String[] args) { 6 | String word1 = "abc"; 7 | String word2 = "def"; 8 | 9 | if (word1.length() != 3 || word2.length() != 3) { 10 | System.out.println("cannot merge"); 11 | } else { 12 | for (int i = 0; i < word1.length(); i++) { 13 | char c = word1.charAt(i); 14 | char d = word2.charAt(i); 15 | System.out.print(c); 16 | System.out.print(d); 17 | } 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /live_review_sections/week11/exercise_example/FreeWeight.java: -------------------------------------------------------------------------------- 1 | package week11.exercise_example; 2 | 3 | public class FreeWeight extends Lifting{ 4 | 5 | @Override 6 | public void endLift() { 7 | 8 | System.out.println("Carefully placing the weights"); 9 | 10 | } 11 | 12 | @Override 13 | public void perform() { 14 | 15 | System.out.println("Lifting Free Weight dumbbells"); 16 | 17 | } 18 | 19 | @Override 20 | public int getCaloriesCount(int minutes) { 21 | 22 | 23 | return minutes*6; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /live_review_sections/week13/StringIndexProblem.java: -------------------------------------------------------------------------------- 1 | package week13; 2 | 3 | public class StringIndexProblem { 4 | 5 | public static void main(String[] args) { 6 | 7 | String word = "java"; 8 | 9 | try { 10 | System.out.println(word.charAt(10)); 11 | }catch(Exception e) { 12 | System.out.println(e.getMessage()); 13 | System.out.println("Type of eception: " + e.getClass().getSimpleName()); 14 | 15 | } 16 | 17 | System.out.println(word.toUpperCase()); 18 | 19 | 20 | 21 | 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /live_review_sections/week3/BasicLoopExamples.java: -------------------------------------------------------------------------------- 1 | package week3; 2 | 3 | public class BasicLoopExamples { 4 | 5 | public static void main(String[] args) { 6 | 7 | for(int i=0 ; i<10 ; i+=1 ) { 8 | System.out.print("Hello "); 9 | } 10 | 11 | // System.out.println(i); just local to the for loop 12 | System.out.println(""); 13 | System.out.println("--------------------------------------"); 14 | 15 | for(int i=1; i<=10 ; i++) { 16 | 17 | System.out.println("2 X "+i+" = "+(2*i)); 18 | } 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /live_review_sections/week5/S04_IndexOfExample.java: -------------------------------------------------------------------------------- 1 | package week5; 2 | 3 | public class S04_IndexOfExample { 4 | 5 | public static void main(String[] args) { 6 | 7 | String message = "Java is Awesome! Akgkf !! AA kgfkdls!"; 8 | 9 | // this method takes a String and returns it's index 10 | 11 | int begining = message.indexOf("Awe"); 12 | int ending = message.indexOf("me!")+2; 13 | 14 | String word = message.substring(begining,ending); 15 | 16 | System.out.println(word); 17 | 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/day05_unary_assignment_relational_operators/Task19_IncrementDecrement.java: -------------------------------------------------------------------------------- 1 | package day05_unary_assignment_relational_operators; 2 | 3 | public class Task19_IncrementDecrement { 4 | 5 | public static void main(String[] args) { 6 | 7 | int a = 50; 8 | int result = --a + a++ + a-- + a++; 9 | 10 | //a in memory : 50 - > 49 - > 50 - > 49 - > 50 11 | 12 | //result : 49 + 49 + 50 + 49 = 197 13 | 14 | System.out.println("a = " + a); 15 | System.out.println("result = " + result); 16 | 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/day15_methods_Part3/assignment1_SwapValue.java: -------------------------------------------------------------------------------- 1 | package day15_methods_Part3; 2 | 3 | public class assignment1_SwapValue { 4 | 5 | public static void main(String[] args) { 6 | 7 | //Solution-1 by using 3rd variable 8 | int n1=10; 9 | int n2=20; 10 | int n3; 11 | 12 | n3=n1; 13 | n1=n2; 14 | n2=n3; 15 | 16 | System.out.println("n1:"+n1); 17 | System.out.println("n2:"+n2); 18 | 19 | //Solution2 without using 3rd variable 20 | 21 | n1=n1+n2; 22 | n2=n1-n2; 23 | n1=n1-n2; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/day16_classObejcts/Dog.java: -------------------------------------------------------------------------------- 1 | package day16_classObejcts; 2 | 3 | public class Dog { 4 | 5 | //Class is a blueprint and has common properties and methods 6 | 7 | String breed; 8 | int age; 9 | String color; 10 | String name; 11 | 12 | public void barking() { 13 | System.out.println(name + " is barking"); 14 | } 15 | 16 | public void hungry() { 17 | System.out.println(name + " is hungry"); 18 | } 19 | 20 | public void sleeping() { 21 | System.out.println(name + " is sleeping"); 22 | } 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/day43_polymorphism/TestAnimal.java: -------------------------------------------------------------------------------- 1 | package day43_polymorphism; 2 | 3 | public class TestAnimal { 4 | 5 | public static void main(String[] args) { 6 | 7 | 8 | Animal animal = new Animal(); 9 | 10 | Animal dog = new Dog(); 11 | 12 | Animal bird = new Bird(); 13 | 14 | animal = new Cat(); 15 | 16 | //Bird bird2 = new Animal(); 17 | 18 | } 19 | 20 | } 21 | 22 | class Animal{} 23 | 24 | class Dog extends Animal{} 25 | 26 | class Bird extends Animal{} 27 | 28 | class Cat extends Animal{} 29 | 30 | -------------------------------------------------------------------------------- /src/day18_readingUserInput/task72_SumNumbers.java: -------------------------------------------------------------------------------- 1 | package day18_readingUserInput; 2 | 3 | import java.util.Scanner; 4 | 5 | public class task72_SumNumbers { 6 | 7 | public static void main(String[] args) { 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.println("Enter 3 numbers:"); 12 | int num1=sc.nextInt(); 13 | int num2=sc.nextInt(); 14 | int num3=sc.nextInt(); 15 | 16 | int sum=num1+num2+num3; 17 | System.out.println("Sum of numbers:" + sum); 18 | 19 | 20 | 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/day29_arrays_Lab/Lab4_Question16.java: -------------------------------------------------------------------------------- 1 | package day29_arrays_Lab; 2 | 3 | public class Lab4_Question16 { 4 | 5 | public static void main(String[] args) { 6 | 7 | int[] x = {2,1,2,3,7}; 8 | 9 | System.out.println(countEvens(x)); 10 | 11 | } 12 | 13 | public static int countEvens(int[] arr) { 14 | 15 | int counter = 0; 16 | 17 | for(int value : arr) { 18 | 19 | if(value%2==0) { 20 | 21 | counter++; 22 | 23 | } 24 | } 25 | 26 | return counter; 27 | 28 | 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/day46_collection_part1/VectorExample.java: -------------------------------------------------------------------------------- 1 | package day46_collection_part1; 2 | 3 | import java.util.List; 4 | import java.util.Vector; 5 | 6 | public class VectorExample { 7 | 8 | public static void main(String[] args) { 9 | 10 | List v = new Vector<>(); 11 | v.add("water"); 12 | v.add("tea"); 13 | v.add("green tea"); 14 | 15 | for(String str : v) { 16 | System.out.println(str); 17 | } 18 | 19 | System.out.println(v.size()); 20 | 21 | System.out.println(v.get(2)); 22 | 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /live_review_sections/week1/_Shapes.java: -------------------------------------------------------------------------------- 1 | package week1; 2 | 3 | public class _Shapes { 4 | 5 | // escape squences 6 | // \t: paragraph space 7 | // \n: append new line 8 | // \" print " 9 | // \\ : prints \ 10 | 11 | public static void main(String[] args) { 12 | 13 | System.out.println("Make triangle\n---------------------------"); 14 | System.out.println("\tI want to start my triangle from here"); 15 | System.out.println("\t ^"); 16 | System.out.println("\t / \\\\"); 17 | 18 | } 19 | 20 | 21 | 22 | } 23 | -------------------------------------------------------------------------------- /live_review_sections/week11/car_examples/ParkingLot.java: -------------------------------------------------------------------------------- 1 | package week11.car_examples; 2 | 3 | public class ParkingLot { 4 | 5 | public static void main(String[] args) { 6 | 7 | // Car car = new Car(); can not instantiate from abstract class 8 | 9 | Toyota camry = new Toyota("Camry", "White", 2019); 10 | 11 | camry.start(); 12 | System.out.println(camry.toString()); 13 | 14 | BMW M5 = new BMW("M5", "BMW", "Black", 2021); 15 | 16 | M5.start(); 17 | System.out.println(M5); 18 | 19 | 20 | 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /live_review_sections/week13/customExceptions/CustomExceptionTest.java: -------------------------------------------------------------------------------- 1 | package week13.customExceptions; 2 | 3 | public class CustomExceptionTest { 4 | 5 | public static void main(String[] args) { 6 | 7 | int minutes = 50; 8 | 9 | System.out.println("Class is going on for "+ minutes+" minutes"); 10 | 11 | if(minutes > 45) { 12 | throw new BreakTimeException("It is break time Hocam"); 13 | } 14 | 15 | System.out.println("Let's continue the class another "+(45-minutes) 16 | +" minutes"); 17 | 18 | 19 | 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /live_review_sections/week2/RelationalOperators.java: -------------------------------------------------------------------------------- 1 | package week2; 2 | 3 | public class RelationalOperators { 4 | 5 | public static void main(String[] args) { 6 | 7 | System.out.println(100 > 1000); // false 8 | 9 | System.out.println('A' == 65); // true 10 | 11 | System.out.println(15 >= 15); 12 | 13 | System.out.println("---------Question from Discord-------------"); 14 | 15 | int b = 2; 16 | boolean res = ++b == 2 || --b == 2 && --b == 2; // 17 | System.out.println(res); 18 | 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/day23_stringManipulationLab_randomClasss/task84_CoinToss.java: -------------------------------------------------------------------------------- 1 | package day23_stringManipulationLab_randomClasss; 2 | 3 | import java.util.Random; 4 | 5 | public class task84_CoinToss { 6 | 7 | public static void main(String[] args) { 8 | 9 | Random rn = new Random(); 10 | 11 | for(int i=0;i<10;i++) { 12 | 13 | if(rn.nextInt(2)==0) { 14 | System.out.println("Tails"); //Tail=0 Heads=1 15 | }else { 16 | System.out.println("Heads"); 17 | } 18 | 19 | 20 | 21 | } 22 | 23 | 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/day28_arrays_Lab/Lab4_Question12.java: -------------------------------------------------------------------------------- 1 | package day28_arrays_Lab; 2 | 3 | public class Lab4_Question12 { 4 | 5 | public static void main(String[] args) { 6 | 7 | int[] x = {0,2,3}; 8 | int[] y = {1,3}; 9 | 10 | System.out.println(start1(x,y)); 11 | 12 | 13 | } 14 | 15 | public static int start1(int[] arr1,int[] arr2) { 16 | 17 | int counter = 0; 18 | 19 | if(arr1[0] == 1) { 20 | counter++; 21 | } 22 | if(arr2[0] == 1) { 23 | counter++; 24 | } 25 | 26 | return counter; 27 | 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/day29_arrays_Lab/Lab4_Question20.java: -------------------------------------------------------------------------------- 1 | package day29_arrays_Lab; 2 | 3 | public class Lab4_Question20 { 4 | 5 | public static void main(String[] args) { 6 | 7 | int[] x = {1,2,2,3}; 8 | 9 | boolean flag = false; 10 | 11 | 12 | for(int i=0;i 0 - > 1 - > 0 - > -1 11 | 12 | // result : -1 + 0 / -1 * -1 = > -1 + 0 * -1 = > -1 + 0 = > -1 13 | 14 | System.out.println("a = " + a); 15 | System.out.println("result = " + result); 16 | 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/day22_stringManipulation_Lab/Question_6.java: -------------------------------------------------------------------------------- 1 | package day22_stringManipulation_Lab; 2 | 3 | public class Question_6 { 4 | 5 | public static void main(String[] args) { 6 | 7 | System.out.println(withoutEnd("Hello")); 8 | System.out.println(withoutEnd("java")); 9 | System.out.println(withoutEnd("coding")); 10 | 11 | 12 | 13 | } 14 | 15 | public static String withoutEnd(String str) { 16 | 17 | if(str.length()<2) { 18 | return "Invalid String"; 19 | } 20 | 21 | return str.substring(1, str.length()-1); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /live_review_sections/week3/CustomMethod2.java: -------------------------------------------------------------------------------- 1 | package week3; 2 | 3 | public class CustomMethod2 { 4 | 5 | public static void main(String[] args) { 6 | 7 | int person1 = 10; 8 | eligibleOrNot(person1); 9 | 10 | eligibleOrNot(20); 11 | 12 | eligibleOrNot(24); 13 | 14 | } 15 | 16 | public static void eligibleOrNot(int age) { 17 | 18 | int person = age; 19 | 20 | if (person>=21) { 21 | System.out.println("Eligible to buy"); 22 | }else { 23 | System.out.println("NOT Eligible to buy"); 24 | } 25 | } 26 | 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/day28_arrays_Lab/Lab4_Question9.java: -------------------------------------------------------------------------------- 1 | package day28_arrays_Lab; 2 | 3 | import java.util.Arrays; 4 | 5 | public class Lab4_Question9 { 6 | 7 | public static void main(String[] args) { 8 | 9 | 10 | int[] x = {1,2,3,6,7}; 11 | 12 | System.out.println(Arrays.toString(makeLast(x))); 13 | 14 | 15 | } 16 | 17 | public static int[] makeLast(int[] arr) { 18 | 19 | int[] newArray = new int[2 * arr.length]; 20 | 21 | newArray[newArray.length-1] = arr[arr.length-1]; 22 | 23 | return newArray; 24 | 25 | 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/day34_Constructors/AppleTest.java: -------------------------------------------------------------------------------- 1 | package day34_Constructors; 2 | 3 | public class AppleTest { 4 | 5 | public static void main(String[] args) { 6 | 7 | Apple a1 = new Apple(); 8 | 9 | changeApple(a1); 10 | 11 | System.out.println(a1.color); 12 | 13 | System.out.println(methodObject().color); 14 | 15 | 16 | 17 | } 18 | 19 | public static void changeApple(Apple x) { 20 | x.color = "White"; 21 | } 22 | 23 | public static Apple methodObject(){ 24 | 25 | Apple b1 = new Apple(); 26 | return b1; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/day34_Constructors/DiceTest.java: -------------------------------------------------------------------------------- 1 | package day34_Constructors; 2 | 3 | public class DiceTest { 4 | 5 | public static void main(String[] args) { 6 | 7 | 8 | final int SIX_SIDES=6; 9 | Dice sixDice = new Dice(SIX_SIDES); 10 | 11 | rollDice(sixDice); 12 | } 13 | 14 | public static void rollDice(Dice d) { 15 | //Rolling a 6 sided dice 16 | System.out.println("Rolling a " + d.getSides() + " sided dice "); 17 | 18 | //The dice's value : 5 19 | System.out.println("The dice's value : " + d.getValue()); 20 | } 21 | 22 | 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/day36_staticClassMembers/Student.java: -------------------------------------------------------------------------------- 1 | package day36_staticClassMembers; 2 | 3 | public class Student { 4 | 5 | String name; 6 | int age; 7 | int idNumber; 8 | static String school="Cybertek"; 9 | 10 | public Student(String name, int age, int idNumber) { 11 | this.name = name; 12 | this.age = age; 13 | this.idNumber = idNumber; 14 | } 15 | 16 | @Override 17 | public String toString() { 18 | return "Student [name=" + name + ", age=" + age + ", idNumber=" + idNumber + ", school=" + school + "]"; 19 | } 20 | 21 | 22 | 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/day02_printing_comments/EscapeSequences.java: -------------------------------------------------------------------------------- 1 | package day02_printing_comments; 2 | 3 | public class EscapeSequences { 4 | 5 | public static void main(String[] args) { 6 | 7 | System.out.print( "Learn\tJava\n\tthe\nHard\tWay\n\n" ); 8 | System.out.print( "\tLearn Java the \"Hard\" Way!\n" ); 9 | 10 | System.out.println( "\\ // -=- \\ //" ); 11 | System.out.println(); 12 | System.out.println( "\\\\ \\\\\\ \\\\\\\\" ); 13 | System.out.println(); 14 | System.out.print( "I hope you understand \"escape sequences\" now.\n" ); 15 | 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/day05_unary_assignment_relational_operators/AssignmentOperators.java: -------------------------------------------------------------------------------- 1 | package day05_unary_assignment_relational_operators; 2 | 3 | public class AssignmentOperators { 4 | 5 | public static void main(String[] args) { 6 | 7 | 8 | int i = 100; 9 | System.out.println(i); 10 | 11 | i+=1; 12 | System.out.println(i); 13 | 14 | i-=2; 15 | System.out.println(i); 16 | 17 | i*=3; 18 | System.out.println(i); 19 | 20 | i/=4; 21 | System.out.println(i); 22 | 23 | i%=5; 24 | System.out.println(i); 25 | 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/day13_methods_Part1/task58_greaterNumber.java: -------------------------------------------------------------------------------- 1 | package day13_methods_Part1; 2 | 3 | public class task58_greaterNumber { 4 | 5 | public static void main(String[] args) { 6 | 7 | 8 | findGreater(); 9 | 10 | } 11 | 12 | public static void findGreater() { 13 | 14 | int num1=50; 15 | int num2=10; 16 | 17 | if(num1>num2) { 18 | System.out.println("num1 is greater"); 19 | }else if(num2>num1) { 20 | System.out.println("num2 is greater"); 21 | }else { 22 | System.out.println("numbers are equal"); 23 | } 24 | } 25 | 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/day19_stringManipulation_part1/task78_CountHowMany.java: -------------------------------------------------------------------------------- 1 | package day19_stringManipulation_part1; 2 | 3 | public class task78_CountHowMany { 4 | 5 | public static void main(String[] args) { 6 | 7 | 8 | String str = "abcabqcabc"; 9 | char myChar = 'a'; 10 | 11 | int counter=0; 12 | 13 | 14 | for(int i=0;i=end ; i=i-2) 11 | { 12 | System.out.print(i); 13 | if(i!=end) 14 | { 15 | System.out.print(" "); 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /live_review_sections/week3/CustomMethod3.java: -------------------------------------------------------------------------------- 1 | package week3; 2 | 3 | public class CustomMethod3 { 4 | 5 | public static void main(String[] args) { 6 | 7 | System.out.println(getAgeInDays(10) + " Days old. "); 8 | 9 | System.out.println(getAgeInDaysWithMSG(10)); 10 | } 11 | 12 | 13 | public static int getAgeInDays(int years) { 14 | 15 | // int days = years * 365; 16 | 17 | return years * 365; 18 | } 19 | 20 | 21 | public static String getAgeInDaysWithMSG(int years) { 22 | 23 | return (years * 365) + " Days old."; 24 | 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/day20_stringManipulation_part2/task80_CheckString.java: -------------------------------------------------------------------------------- 1 | package day20_stringManipulation_part2; 2 | 3 | public class task80_CheckString { 4 | 5 | public static void main(String[] args) { 6 | 7 | checkedString("Your order confirmation number is XYZ", "confirmation"); 8 | 9 | } 10 | 11 | public static void checkedString(String str1,String str2) { 12 | 13 | if(str1.contains(str2)) { 14 | 15 | System.out.println(str1.indexOf(str2)); 16 | 17 | }else { 18 | 19 | System.out.println("Not found"); 20 | 21 | } 22 | 23 | 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/day37_inheritance/School.java: -------------------------------------------------------------------------------- 1 | package day37_inheritance; 2 | 3 | public class School { 4 | 5 | public static void main(String[] args) { 6 | 7 | Person person = new Person(); 8 | person.name = "Mike"; 9 | person.age = 40; 10 | person.gender = 'M'; 11 | 12 | Student student = new Student(); 13 | student.name = "Tom"; //assign Tom to name. where is name? what is object? student - belong to Student class 14 | student.age = 25; 15 | student.gender = 'M'; 16 | student.studentId = 12948; 17 | 18 | 19 | 20 | 21 | 22 | 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /live_review_sections/week10/AmazonInc.java: -------------------------------------------------------------------------------- 1 | package week10; 2 | 3 | public class AmazonInc { 4 | 5 | public static void main(String[] args) { 6 | 7 | Tester tester = new Tester("Polad", "SDET", 'M', 35, 100000); 8 | 9 | tester.setJobTitle("Quality Engineer"); 10 | tester.setAge(25); 11 | tester.findBugs(); 12 | 13 | Developer developer = new Developer("Ibrahim", "Front End Developer", 'M', 35, 150000); 14 | 15 | developer.fixBugs(); 16 | developer.setSalary(0); 17 | System.out.println(developer.getSalary()); 18 | 19 | 20 | 21 | 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/day28_arrays_Lab/Lab4_Question15.java: -------------------------------------------------------------------------------- 1 | package day28_arrays_Lab; 2 | 3 | import java.util.Arrays; 4 | 5 | public class Lab4_Question15 { 6 | 7 | public static void main(String[] args) { 8 | 9 | 10 | int[] x = {8,6,7,9,5}; 11 | 12 | System.out.println(Arrays.toString(swapEnds(x))); 13 | 14 | 15 | } 16 | 17 | 18 | public static int[] swapEnds(int[] arr) { 19 | 20 | 21 | int temp = 0; 22 | temp = arr[0]; 23 | arr[0] = arr[arr.length-1]; 24 | arr[arr.length-1] = temp; 25 | 26 | return arr; 27 | 28 | 29 | } 30 | 31 | 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/day28_arrays_Lab/Lab4_Question5.java: -------------------------------------------------------------------------------- 1 | package day28_arrays_Lab; 2 | 3 | import java.util.Arrays; 4 | 5 | public class Lab4_Question5 { 6 | 7 | public static void main(String[] args) { 8 | 9 | 10 | int[] x = {17,12,10,8}; 11 | System.out.println(Arrays.toString(rotateLeft(x))); 12 | 13 | } 14 | 15 | public static int[] rotateLeft(int[] arr) { 16 | 17 | int x = arr[0]; //1 18 | 19 | for(int i=0;in2 && n1>n3) { 14 | System.out.println("n1 is biggest"); 15 | }else { 16 | if(n2>n3) { 17 | System.out.println("n2 is biggest"); 18 | }else { 19 | System.out.println("n3 is biggest"); //n3>n2 20 | } 21 | } 22 | 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/day17_classObjects_Part2/BMW.java: -------------------------------------------------------------------------------- 1 | package day17_classObjects_Part2; 2 | 3 | public class BMW { 4 | 5 | 6 | String make="BMW"; 7 | String model; 8 | double price; 9 | 10 | public void showPrice() { 11 | 12 | 13 | switch(model) { 14 | case "330i": 15 | price=40250; 16 | break; 17 | case "740i": 18 | price=85000; 19 | break; 20 | case "m3": 21 | price=65000; 22 | break; 23 | default: 24 | System.out.println(model + " is not available"); 25 | price=0.0; 26 | } 27 | System.out.println("Price: " + price); 28 | 29 | 30 | } 31 | 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/day28_arrays_Lab/Lab4_Question4.java: -------------------------------------------------------------------------------- 1 | package day28_arrays_Lab; 2 | 3 | public class Lab4_Question4 { 4 | 5 | public static void main(String[] args) { 6 | 7 | 8 | int[] x = {1,2,3}; 9 | 10 | int[] y = {-4,2,0}; 11 | 12 | int a = sum(x); 13 | System.out.println(a); 14 | 15 | System.out.println(sum(y)); 16 | 17 | 18 | 19 | } 20 | 21 | public static int sum(int[] arr) { 22 | 23 | int sum = 0; 24 | 25 | for(int value :arr ) { 26 | 27 | sum = sum + value; 28 | 29 | 30 | } 31 | 32 | return sum; //7 33 | 34 | 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/day40_accessmodifiers_final/TestParentChild.java: -------------------------------------------------------------------------------- 1 | package day40_accessmodifiers_final; 2 | 3 | public class TestParentChild { 4 | 5 | public static void main(String[] args) { 6 | 7 | Child s = new Child(); 8 | System.out.println("Value of x before increment " + s.x); 9 | 10 | s.increment(); 11 | System.out.println("Value of x after increment " + s.x); 12 | 13 | Parent p = new Parent(); 14 | System.out.println("Value of x before increment " + p.x); 15 | 16 | p.increment(); 17 | System.out.println("Value of x after increment " + p.x); 18 | 19 | 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /live_review_sections/week11/car_examples/Car.java: -------------------------------------------------------------------------------- 1 | package week11.car_examples; 2 | 3 | public abstract class Car extends Object{ 4 | 5 | public String model,make,color; 6 | public int year; 7 | 8 | 9 | 10 | public Car(String model, String color, int year) { 11 | this.model = model; 12 | this.color = color; 13 | this.year = year; 14 | } 15 | 16 | 17 | 18 | public abstract void start(); 19 | 20 | 21 | 22 | 23 | public String toString() { 24 | return "Car [model=" + model + ", make=" + make + ", color=" + color + ", year=" + year + "]"; 25 | } 26 | 27 | 28 | 29 | 30 | } 31 | -------------------------------------------------------------------------------- /live_review_sections/week8/Login.java: -------------------------------------------------------------------------------- 1 | package week8; 2 | 3 | public class Login { 4 | 5 | public static void main(String[] args) { 6 | 7 | Credentials credentials = new Credentials(); 8 | 9 | // System.out.println(credentials.userName); Not reachable 10 | 11 | //credentials.passWord = "SPARTAAAAAA"; Not reachable 12 | 13 | System.out.println(credentials.getUserName()); 14 | System.out.println(credentials.getPassWord()); 15 | 16 | credentials.setPassWord("Neb&uchadnezzar324"); 17 | 18 | 19 | System.out.println("After changing : "+ credentials.getPassWord()); 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/day07_control_flow_statements/Task25_GreatestNumber.java: -------------------------------------------------------------------------------- 1 | package day07_control_flow_statements; 2 | 3 | public class Task25_GreatestNumber { 4 | 5 | public static void main(String[] args) { 6 | 7 | int num1=40; 8 | int num2=8; 9 | int num3=100; 10 | 11 | 12 | if(num1>num2 && num1>num3) { 13 | System.out.println("Num1 is the greatest"); 14 | } 15 | 16 | if(num2>num1 && num2>num3) { 17 | System.out.println("Num2 is the greatest"); 18 | } 19 | 20 | if(num3>num1 && num3>num2) { 21 | System.out.println("Num3 is the greatest"); 22 | } 23 | 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/day10_controlFlowStatements_4/task42_SumOfEvenOddNumbers.java: -------------------------------------------------------------------------------- 1 | package day10_controlFlowStatements_4; 2 | 3 | public class task42_SumOfEvenOddNumbers { 4 | 5 | public static void main(String[] args) { 6 | 7 | int sumEven=0; 8 | int sumOdd=0; 9 | 10 | for(int i=1;i<100;i++) { 11 | 12 | if(i%2==0) { 13 | 14 | sumEven=sumEven+i; 15 | 16 | }else { 17 | 18 | sumOdd=sumOdd+i; 19 | 20 | } 21 | } 22 | 23 | System.out.println("Sum of even number " + sumEven); 24 | System.out.println("Sum of odd number " + sumOdd); 25 | 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/day28_arrays_Lab/Lab4_Question7.java: -------------------------------------------------------------------------------- 1 | package day28_arrays_Lab; 2 | 3 | import java.util.Arrays; 4 | 5 | public class Lab4_Question7 { 6 | 7 | public static void main(String[] args) { 8 | 9 | 10 | int[] x = {1,2,3,14,5,60,9}; 11 | int[] y = {}; 12 | 13 | System.out.println(Arrays.toString(makeEnds(x, y))); 14 | 15 | } 16 | 17 | public static int[] makeEnds(int[] arr1, int[] arr2) { 18 | 19 | arr2 = new int[2]; 20 | 21 | arr2[0] = arr1[0]; 22 | 23 | arr2[1] = arr1[arr1.length-1]; 24 | 25 | return arr2; 26 | 27 | } 28 | 29 | 30 | 31 | } 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/day07_control_flow_statements/Task28_RevenueCalculator.java: -------------------------------------------------------------------------------- 1 | package day07_control_flow_statements; 2 | 3 | public class Task28_RevenueCalculator { 4 | 5 | public static void main(String[] args) { 6 | 7 | double price = 19.99; 8 | int quantity = 2000; 9 | 10 | double revenue; 11 | double discount=0; 12 | 13 | revenue=price*quantity; 14 | 15 | if(revenue>5000) { 16 | 17 | discount = revenue*0.1; 18 | revenue=revenue-discount; 19 | } 20 | 21 | System.out.println("discount = " + discount); 22 | System.out.println("revenue = " + revenue); 23 | 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/day13_methods_Part1/StudentMethod.java: -------------------------------------------------------------------------------- 1 | package day13_methods_Part1; 2 | 3 | public class StudentMethod { 4 | 5 | public static void main(String[] args) { 6 | 7 | code(); 8 | sayHello(); 9 | study(); 10 | 11 | } 12 | 13 | 14 | public static void sayHello() { 15 | 16 | System.out.println("Inside sayHello method"); 17 | 18 | } 19 | 20 | public static void code() { 21 | System.out.println("Student is studying"); 22 | } 23 | 24 | public static void study() { 25 | System.out.println("Student is studying java"); 26 | } 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/day15_methods_Part3/task67_LastDigit.java: -------------------------------------------------------------------------------- 1 | package day15_methods_Part3; 2 | 3 | public class task67_LastDigit { 4 | 5 | public static void main(String[] args) { 6 | 7 | 8 | if(lastDigit(3,113)) { 9 | System.out.println("They have the same last digit"); 10 | }else { 11 | System.out.println("They do not have the same last digit"); 12 | } 13 | 14 | 15 | 16 | } 17 | 18 | public static boolean lastDigit(int num1, int num2) { 19 | 20 | if((num1%10)==(num2%10)) { 21 | return true; 22 | }else { 23 | return false; 24 | } 25 | 26 | } 27 | 28 | 29 | 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/day28_arrays_Lab/Lab4_Question8.java: -------------------------------------------------------------------------------- 1 | package day28_arrays_Lab; 2 | 3 | public class Lab4_Question8 { 4 | 5 | public static void main(String[] args) { 6 | 7 | int[] x = {2,5}; 8 | int[] y = {4,3}; 9 | int[] z = {4,5}; 10 | 11 | System.out.println(has23(x)); 12 | System.out.println(has23(y)); 13 | System.out.println(has23(z)); 14 | 15 | 16 | } 17 | 18 | public static boolean has23(int[] arr) { 19 | 20 | for(int value : arr) { 21 | 22 | if(value==2 || value==3) { 23 | 24 | return true; 25 | } 26 | 27 | } 28 | 29 | return false; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/day36_staticClassMembers/AllBlocks.java: -------------------------------------------------------------------------------- 1 | package day36_staticClassMembers; 2 | 3 | public class AllBlocks { 4 | 5 | public AllBlocks(int x) { 6 | System.out.println("One Argument Constructor"); 7 | } 8 | 9 | public AllBlocks() { 10 | System.out.println("No argument constructor"); 11 | } 12 | 13 | static { 14 | System.out.println("Firsrt Static Init"); 15 | } 16 | 17 | { 18 | System.out.println("First Instnce Init"); 19 | } 20 | 21 | { 22 | System.out.println("Second Instance Init"); 23 | } 24 | 25 | static{ 26 | System.out.println("Second Static Init"); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/day45_exceptionHandling/Nullpointer.java: -------------------------------------------------------------------------------- 1 | package day45_exceptionHandling; 2 | 3 | public class Nullpointer { 4 | 5 | static String name; 6 | 7 | public static void main(String[] args) { 8 | 9 | try { 10 | System.out.println(name.toUpperCase()); 11 | }catch(NullPointerException e) { //(Exception e) 12 | System.out.println("Nullpointerexception happened"); 13 | System.out.println("Here is the message: " + e.getMessage()); 14 | System.out.println("Here is the stack trace: "); 15 | e.printStackTrace(); 16 | 17 | 18 | } 19 | 20 | 21 | 22 | 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /ReplitSolutions/assignment9/Question09.java: -------------------------------------------------------------------------------- 1 | package assignment9; 2 | 3 | public class Question09 { 4 | 5 | public static void main(String[] args) { 6 | String email = "mike_tyson@gmail.com"; 7 | 8 | if (email.contains("_")) { 9 | int underscore = email.indexOf("_"); 10 | int place = email.indexOf("@"); 11 | String name = email.substring(0, underscore); 12 | String surname = email.substring(underscore + 1, place); 13 | String add = email.substring(place); 14 | System.out.println(surname + "_" + name + add); 15 | } else { 16 | System.out.println(email); 17 | } 18 | 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/day09_controlFlowStatements_3/task37_LaptopModels.java: -------------------------------------------------------------------------------- 1 | package day09_controlFlowStatements_3; 2 | 3 | public class task37_LaptopModels { 4 | 5 | public static void main(String[] args) { 6 | 7 | String computer="Apple"; 8 | 9 | switch(computer) { 10 | case "Apple": 11 | System.out.println("No virus"); 12 | break; 13 | case "Dell": 14 | System.out.println("Tough One"); 15 | break; 16 | case "Acer": 17 | System.out.println("Not recommended"); 18 | break; 19 | default: 20 | System.out.println("Do not buy that one"); 21 | 22 | } 23 | 24 | 25 | 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/day09_controlFlowStatements_3/task39_TrafficLightSelector.java: -------------------------------------------------------------------------------- 1 | package day09_controlFlowStatements_3; 2 | 3 | public class task39_TrafficLightSelector { 4 | 5 | public static void main(String[] args) { 6 | 7 | char color='r'; 8 | 9 | switch(color) { 10 | case 'R':case 'r': 11 | System.out.println("Red Light"); 12 | break; 13 | case 'O':case 'o': 14 | System.out.println("Orange Light"); 15 | break; 16 | case 'G':case 'g': 17 | System.out.println("Green Light"); 18 | break; 19 | default: 20 | System.out.println("Invalid Light"); 21 | 22 | } 23 | 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/day17_classObjects_Part2/CarObjects.java: -------------------------------------------------------------------------------- 1 | package day17_classObjects_Part2; 2 | 3 | public class CarObjects { 4 | 5 | public static void main(String[] args) { 6 | 7 | BMW b1 = new BMW(); 8 | BMW b2 = new BMW(); 9 | 10 | 11 | System.out.println(b1.make); 12 | System.out.println(b2.make); 13 | 14 | b1.make = "BMW2019"; 15 | System.out.println(b1.make); 16 | 17 | System.out.println(b2.make); 18 | 19 | System.out.println(b1.model); 20 | b1.model="m3"; 21 | b1.showPrice(); 22 | 23 | b2.model="X3"; 24 | b2.showPrice(); 25 | 26 | 27 | 28 | 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/day35_encapsulation/PerseonTest.java: -------------------------------------------------------------------------------- 1 | package day35_encapsulation; 2 | 3 | public class PerseonTest { 4 | 5 | public static void main(String[] args) { 6 | 7 | Person ozzy = new Person(); 8 | 9 | ozzy.setAge(18); 10 | 11 | //print age 12 | System.out.println(ozzy.getAge()); 13 | 14 | 15 | //Encapsulation 16 | 17 | //cut the access - private 18 | //create setter method to initialize my value 19 | //create getter method to retrive it 20 | 21 | 22 | //private variables 23 | //public setter methods 24 | //public getter methods 25 | 26 | 27 | 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/day13_methods_Part1/CredirCardMethod.java: -------------------------------------------------------------------------------- 1 | package day13_methods_Part1; 2 | 3 | public class CredirCardMethod { 4 | 5 | public static void main(String[] args) { 6 | 7 | double salary=50000; 8 | int creditRating=5; 9 | 10 | if(salary>=20000 && creditRating>=7) { 11 | qualify(); 12 | }else { 13 | noQualify(); 14 | } 15 | 16 | 17 | } 18 | 19 | public static void noQualify() { 20 | System.out.println("I am sorry, you are not qualified for the CC "); 21 | } 22 | 23 | public static void qualify() { 24 | System.out.println("Congrat, you are qualified for the CC "); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/day30_wrapperClass/MathClass.java: -------------------------------------------------------------------------------- 1 | package day30_wrapperClass; 2 | 3 | public class MathClass { 4 | 5 | public static void main(String[] args) { 6 | 7 | double result = Math.pow(4.0, 3.0); 8 | System.out.println(result); 9 | 10 | double res2 = Math.sqrt(25.0); 11 | System.out.println(res2); 12 | 13 | final double PI = Math.PI; 14 | System.out.println(PI); 15 | 16 | System.out.println(Math.round(4.5)); 17 | 18 | System.out.println(Math.floor(4.9)); 19 | 20 | System.out.println(Math.ceil(4.2)); 21 | 22 | 23 | 24 | //collection 25 | 26 | 27 | 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/day44_oopreview/callcenter/WhatsApp.java: -------------------------------------------------------------------------------- 1 | package day44_oopreview.callcenter; 2 | 3 | public class WhatsApp extends MessagingApp implements VoiceCallable,VideoCallable { 4 | 5 | @Override 6 | public void videoCall() { 7 | System.out.println("WhatsApp - doing a video call Mr mike..."); 8 | 9 | } 10 | 11 | @Override 12 | public void call(String contact) { 13 | System.out.println("WhatsApp - calling " + contact + "..."); 14 | 15 | } 16 | 17 | @Override 18 | public void sendMessage(String msg) { 19 | System.out.println("WhatsApp - sending a message - " + msg + "..."); 20 | 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/day24_arrays_part1/task90_FindingCar.java: -------------------------------------------------------------------------------- 1 | package day24_arrays_part1; 2 | 3 | public class task90_FindingCar { 4 | 5 | public static void main(String[] args) { 6 | 7 | String[] cars = {"Toyota","Nissan","BMW","Mercedes","Honda"}; 8 | 9 | boolean flag = false; 10 | 11 | for(int i=0;icounter4) { 25 | return true; 26 | } 27 | 28 | return false; 29 | 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/day33_ClassObjects_Constructors/CarTest.java: -------------------------------------------------------------------------------- 1 | package day33_ClassObjects_Constructors; 2 | 3 | public class CarTest { 4 | 5 | public static void main(String[] args) { 6 | 7 | Car c1 = new Car(); //it is calling the constructor 8 | //which constrcutor u want me do execute? 9 | //i want to you execute, constructor which does not have any arguments 10 | 11 | Car c2 = new Car("AMG", "Mercedes", 2007, 65000, "White"); 12 | Car c3 = new Car("Corolla", "Toyota", 2015, 32000, "Yellow"); 13 | Car c4 = new Car("Altima", "Nisssan", 2014, 41000, "Black"); 14 | 15 | 16 | 17 | 18 | 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /live_review_sections/week8/testEnvironment/Browser.java: -------------------------------------------------------------------------------- 1 | package week8.testEnvironment; 2 | 3 | public class Browser { 4 | 5 | private String browserType; 6 | 7 | public Browser() { 8 | 9 | } 10 | 11 | public Browser(String name) { 12 | browserType = name; // I do not need this. keyword 13 | } 14 | 15 | 16 | public String toString() { 17 | return "Browser [browserType=" + browserType + "]"; 18 | } 19 | 20 | public String getBrowserType() { 21 | return browserType; 22 | } 23 | 24 | public void setBrowserType(String browserType) { 25 | this.browserType = browserType; 26 | } 27 | 28 | 29 | 30 | } 31 | -------------------------------------------------------------------------------- /live_review_sections/week4/CalculatorOverLoading.java: -------------------------------------------------------------------------------- 1 | package week4; 2 | 3 | public class CalculatorOverLoading { 4 | 5 | public static void main(String[] args) { 6 | 7 | } 8 | 9 | public static double add(double num1, double num2) { 10 | double result = num1 + num2; 11 | return result; 12 | } 13 | 14 | public static double add(double num1, double num2,double num3) { // number of parameters 15 | double result = num1 + num2 + num3; 16 | return result; 17 | } 18 | 19 | public static int add(int num1, int num2) { // datatype of parameters 20 | int result = num1 + num2; 21 | return result; 22 | } 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/day08_control_flow_statements_2/NestedIfStatement.java: -------------------------------------------------------------------------------- 1 | package day08_control_flow_statements_2; 2 | 3 | public class NestedIfStatement { //tollCalculator 4 | 5 | public static void main(String[] args) { 6 | 7 | 8 | boolean isRushHour=false; 9 | int carType=2; 10 | double price=0.0; 11 | 12 | if(carType==1) { 13 | if(isRushHour) { 14 | price=30.0; 15 | }else { 16 | price=5.0; 17 | } 18 | }else if(carType==2) { 19 | if(isRushHour) { 20 | price=55.30; 21 | }else { 22 | price=15.99; 23 | } 24 | 25 | } 26 | 27 | System.out.println("Toll Cost: " + price); 28 | 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/day08_control_flow_statements_2/Task32_LargestNumber.java: -------------------------------------------------------------------------------- 1 | package day08_control_flow_statements_2; 2 | 3 | public class Task32_LargestNumber { 4 | 5 | public static void main(String[] args) { 6 | 7 | int num1=10000; 8 | int num2=2000; 9 | int num3=300; 10 | 11 | if((num1>num2)&&(num1>num3)) { 12 | System.out.println("Num1 is greatest one"); 13 | }else if((num2>num1)&&(num2>num3)) { 14 | System.out.println("Num2 is greatest one"); 15 | }else if((num3>num1)&&(num3>num2)) { 16 | System.out.println("Num3 is greatest one"); 17 | }else { 18 | System.out.println("Numbers are equal"); 19 | } 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/day18_readingUserInput/UserInput3.java: -------------------------------------------------------------------------------- 1 | package day18_readingUserInput; 2 | 3 | import java.util.Scanner; 4 | 5 | public class UserInput3 { 6 | 7 | public static void main(String[] args) { 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("Enter first number:"); 12 | int num1=sc.nextInt(); 13 | 14 | System.out.println("Enter second number:"); 15 | int num2=sc.nextInt(); 16 | 17 | sc.nextLine(); 18 | 19 | System.out.print("Enter a string:"); 20 | String str=sc.nextLine(); 21 | 22 | System.out.println("Output:" + num1 + ":" + num2 + ":" + str); 23 | 24 | 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/day28_arrays_Lab/Lab4_Question14.java: -------------------------------------------------------------------------------- 1 | package day28_arrays_Lab; 2 | 3 | import java.util.Arrays; 4 | 5 | public class Lab4_Question14 { 6 | 7 | public static void main(String[] args) { 8 | 9 | 10 | int[] x = {1,2,3}; 11 | 12 | int[] y = {3,4,1,1,1,1,1,6,7,8,9}; 13 | 14 | int[] k = new int[x.length+y.length]; 15 | 16 | for(int i=0;i500) { 15 | System.out.println("you spent too much gas"); 16 | }else { 17 | System.out.println("you spent ok gas"); 18 | } 19 | } 20 | 21 | public static double distance(double speed,int time) { 22 | 23 | double distanceTraveled = speed * time; 24 | 25 | return distanceTraveled; 26 | 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/day19_stringManipulation_part1/task75_TotalCharacters.java: -------------------------------------------------------------------------------- 1 | package day19_stringManipulation_part1; 2 | 3 | import java.util.Scanner; 4 | 5 | public class task75_TotalCharacters { 6 | 7 | public static void main(String[] args) { 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("Enter your first name:"); 12 | String firstName = sc.next(); 13 | 14 | System.out.print("Enter your last name:"); 15 | String lastName = sc.next(); 16 | 17 | System.out.println("Total characters in your first and last name is:" +((firstName.length())+lastName.length()) ); 18 | 19 | 20 | 21 | 22 | 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/day31_arrayList/AddAll.java: -------------------------------------------------------------------------------- 1 | package day31_arrayList; 2 | 3 | import java.util.ArrayList; 4 | 5 | public class AddAll { 6 | 7 | public static void main(String[] args) { 8 | 9 | ArrayList l1 = new ArrayList<>(); 10 | l1.add("Java"); 11 | l1.add("JS"); 12 | 13 | ArrayList l2 = new ArrayList(); 14 | l2.add("C#"); 15 | l2.add("C++"); 16 | 17 | System.out.println(l1.toString()); 18 | System.out.println(l2.toString()); 19 | 20 | l2.addAll(l1); 21 | System.out.println(l2.toString()); 22 | 23 | l1.addAll(l2); 24 | System.out.println(l1.toString()); 25 | 26 | 27 | 28 | 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/day16_classObejcts/DogObjects.java: -------------------------------------------------------------------------------- 1 | package day16_classObejcts; 2 | 3 | public class DogObjects { 4 | 5 | public static void main(String[] args) { 6 | 7 | 8 | 9 | 10 | Dog dog1 = new Dog(); 11 | 12 | Dog dog2 = new Dog(); 13 | 14 | Dog dog3 = new Dog(); 15 | 16 | dog1.age=10; 17 | dog1.color="Red"; 18 | dog1.breed="Maltese"; 19 | dog1.name="Rover"; 20 | 21 | System.out.println(dog1.age); 22 | System.out.println(dog1.color); 23 | System.out.println(dog1.breed); 24 | 25 | dog1.barking(); 26 | dog1.hungry(); 27 | dog1.sleeping(); 28 | 29 | 30 | 31 | 32 | 33 | 34 | } 35 | 36 | 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/day22_stringManipulation_Lab/Question_7.java: -------------------------------------------------------------------------------- 1 | package day22_stringManipulation_Lab; 2 | 3 | public class Question_7 { 4 | 5 | public static void main(String[] args) { 6 | 7 | System.out.println(comboString("Hello", "Hi")); 8 | System.out.println(comboString("Hi", "Hello")); 9 | System.out.println(comboString("aaa", "b")); 10 | 11 | 12 | 13 | } 14 | 15 | public static String comboString(String str1,String str2) { 16 | 17 | String str; 18 | if(str1.length()>str2.length()) { 19 | str = str2.concat(str1).concat(str2); 20 | }else { 21 | str = str1.concat(str2).concat(str1); 22 | } 23 | 24 | return str; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/day27_arrays_part4/Lab4_Question3.java: -------------------------------------------------------------------------------- 1 | package day27_arrays_part4; 2 | 3 | public class Lab4_Question3 { 4 | 5 | public static void main(String[] args) { 6 | 7 | int[] a = {1,2,3}; 8 | int[] b = {7,3}; 9 | 10 | System.out.println(commonEnd(a, b)); 11 | 12 | } 13 | 14 | public static String commonEnd(int[] x, int[] y) { 15 | 16 | if(!(x.length>1)) { 17 | return "Array 1 is not valid"; 18 | } 19 | if(!(y.length>1)) { 20 | return "Array 2 is not valid"; 21 | } 22 | 23 | 24 | if(x[0]==y[0] || x[x.length-1]==y[y.length-1]) { 25 | return "true"; 26 | }else { 27 | return "false"; 28 | } 29 | 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/day46_collection_part1/LinkedListExample.java: -------------------------------------------------------------------------------- 1 | package day46_collection_part1; 2 | 3 | import java.util.LinkedList; 4 | import java.util.List; 5 | 6 | public class LinkedListExample { 7 | 8 | public static void main(String[] args) { 9 | 10 | List list = new LinkedList<>(); 11 | list.add(10); 12 | list.add(50); 13 | list.add(500); 14 | list.add(50000); 15 | 16 | System.out.println(list.get(0)); 17 | System.out.println(list.get(1)); 18 | 19 | System.out.println(((LinkedList) list).getFirst()); 20 | 21 | ((LinkedList) list).addFirst(1); 22 | ((LinkedList) list).addLast(99); 23 | 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/day20_stringManipulation_part2/String_Replace.java: -------------------------------------------------------------------------------- 1 | package day20_stringManipulation_part2; 2 | 3 | public class String_Replace { 4 | 5 | public static void main(String[] args) { 6 | 7 | String str = "Moscow is a capital of Russia"; 8 | 9 | str = str.replace("Moscow", "Baku").replace("Russia", "Azerbaijan"); 10 | 11 | System.out.println(str); 12 | 13 | String email = "firstName_LastName@gmail.com"; 14 | 15 | String company = "capitalone"; 16 | 17 | String newEmail = email.replace("gmail", company); 18 | 19 | System.out.println(newEmail); 20 | 21 | System.out.println(email); 22 | 23 | 24 | 25 | 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/day23_stringManipulationLab_randomClasss/Question_13.java: -------------------------------------------------------------------------------- 1 | package day23_stringManipulationLab_randomClasss; 2 | 3 | public class Question_13 { 4 | 5 | public static void main(String[] args) { 6 | 7 | 8 | String str = "Hi-there"; //TThhee substring(0,1) substring(1,2) substring(2,3) 9 | 10 | 11 | 12 | 13 | String newString=""; //TThhee 14 | 15 | for(int i=0;i numSet = new HashSet<>(); 11 | numSet.add(50); 12 | numSet.add(543); 13 | numSet.add(1150); 14 | numSet.add(550); 15 | numSet.add(570); 16 | numSet.add(93); 17 | numSet.add(5000); 18 | numSet.add(950); 19 | 20 | for(Integer n : numSet) { 21 | System.out.print(n + "|"); 22 | } 23 | 24 | System.out.println(); 25 | 26 | numSet.forEach(n -> System.out.print(n + "|")); 27 | 28 | 29 | 30 | 31 | 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/day22_stringManipulation_Lab/Question_4.java: -------------------------------------------------------------------------------- 1 | package day22_stringManipulation_Lab; 2 | 3 | public class Question_4 { 4 | 5 | public static void main(String[] args) { 6 | 7 | System.out.println(firstTwo("Hello")); 8 | System.out.println(firstTwo("abcdefght")); 9 | System.out.println(firstTwo("ab")); 10 | System.out.println(firstTwo("")); 11 | System.out.println(firstTwo("a")); 12 | 13 | } 14 | 15 | public static String firstTwo(String str) { 16 | 17 | if(str.length()<2) { 18 | return str; 19 | }else if(str.isEmpty()) { 20 | return ""; 21 | }else { 22 | return str.substring(0,2); 23 | } 24 | 25 | 26 | 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/day36_staticClassMembers/CalculatorTest.java: -------------------------------------------------------------------------------- 1 | package day36_staticClassMembers; 2 | 3 | public class CalculatorTest { 4 | 5 | public static void main(String[] args) { 6 | 7 | Calculator c1 = new Calculator(); 8 | System.out.println(c1.plus(2, 4)); 9 | 10 | System.out.println(Calculator.plus(2, 4)); 11 | 12 | int i = Integer.parseInt("33"); 13 | System.out.println(Character.isDigit('4')); 14 | 15 | //1 16 | CalculatorTest.mA(); 17 | //2 18 | CalculatorTest ct = new CalculatorTest(); 19 | ct.mA(); 20 | //3 21 | mA(); 22 | 23 | 24 | } 25 | 26 | public static void mA() { 27 | System.out.println("Hello"); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/day40_accessmodifiers_final/FinalMethods.java: -------------------------------------------------------------------------------- 1 | package day40_accessmodifiers_final; 2 | 3 | public class FinalMethods { 4 | 5 | public final void method1() { 6 | System.out.println("Method-1"); 7 | 8 | String x = "Apple"; 9 | } 10 | 11 | public final static void staticMethod(String word) { 12 | System.out.println("Static Method"); 13 | } 14 | 15 | } 16 | 17 | 18 | class Sub extends FinalMethods{ 19 | 20 | /* 21 | public void method1() { 22 | System.out.println("Method-1 in subclass"); 23 | } 24 | 25 | public static void staticMethod(String word) { 26 | System.out.println("Static Method in Sub Class"); 27 | } 28 | */ 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/day45_exceptionHandling/TyCatch2.java: -------------------------------------------------------------------------------- 1 | package day45_exceptionHandling; 2 | 3 | public class TyCatch2 { 4 | 5 | public static void main(String[] args) { 6 | 7 | int[] nums = {36,6,34,12}; 8 | 9 | //System.out.println(nums[0]); //compile error 10 | 11 | try { 12 | System.out.println(nums[6]); 13 | }catch(Exception e) { 14 | //System.out.println("Wrong index"); 15 | //e.printStackTrace(); 16 | System.out.println(e.getMessage()); 17 | } 18 | 19 | try { 20 | int j=100; 21 | int n=j/0; 22 | }catch(ArithmeticException e) { 23 | e.printStackTrace(); 24 | System.out.println(e.getMessage()); 25 | } 26 | 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /live_review_sections/week14/ListIsEqualToSetExample.java: -------------------------------------------------------------------------------- 1 | package week14; 2 | 3 | import java.util.*; 4 | 5 | public class ListIsEqualToSetExample { 6 | public static void main(String[] args) { 7 | 8 | List list = new ArrayList(Arrays.asList(1,2,3,4,5)); 9 | 10 | List listTwo = new ArrayList(Arrays.asList(1,2,3,4,5)); 11 | 12 | Set set = new TreeSet<>(Arrays.asList(1,2,3,4,5)); 13 | 14 | System.out.println(list.equals(set)); // false 15 | System.out.println(list.equals(listTwo)); // true 16 | 17 | // how can I verify if set and list is same or includes 18 | 19 | System.out.println(list.containsAll(set)); // true 20 | 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/day04_arithmetic_operators/Discount.java: -------------------------------------------------------------------------------- 1 | package day04_arithmetic_operators; 2 | 3 | public class Discount { 4 | 5 | public static void main(String[] args) { 6 | 7 | //This program calculates the sale price of an 8 | //item that is regular priced at $59, with a 20% Discount on it 9 | 10 | int regularPrice=59; 11 | double discount; 12 | double salesPrice; 13 | 14 | discount=regularPrice*0.2; 15 | salesPrice=regularPrice-discount; 16 | 17 | System.out.println("Regular Price: $" + regularPrice); 18 | System.out.println("Discount Amount: $" + discount); 19 | System.out.println("Sale Price: $" + salesPrice); 20 | 21 | 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/day10_controlFlowStatements_4/task45_RepeatedBiggerNumber.java: -------------------------------------------------------------------------------- 1 | package day10_controlFlowStatements_4; 2 | 3 | public class task45_RepeatedBiggerNumber { 4 | 5 | public static void main(String[] args) { 6 | 7 | int num1=50; 8 | int num2=120; 9 | int repeat=4; 10 | 11 | for(int i=1;i<=repeat;i++) { 12 | 13 | 14 | if(num1>num2) { 15 | System.out.println("Number1 is greater than Num2"); 16 | }else if(num2>num1) { 17 | System.out.println("Number2 is greater than Num1"); 18 | }else if(num1==num2) { 19 | System.out.println("Num1 is equal to Num2"); 20 | } 21 | 22 | 23 | 24 | } 25 | 26 | 27 | 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /live_review_sections/week3/PrintAllLetters.java: -------------------------------------------------------------------------------- 1 | package week3; 2 | 3 | public class PrintAllLetters { 4 | 5 | public static void main(String[] args) { 6 | 7 | // Print all the letters from A to Z 8 | 9 | for (char c = 'A'; c <= 'Z'; c++) { 10 | System.out.print(c + " "); 11 | } 12 | 13 | System.out.println(""); 14 | for (int i=65; i<=90 ; i++) { 15 | System.out.print((char)i+" "); 16 | } 17 | 18 | System.out.println(""); 19 | 20 | for (int i = 'z'; i>='a'; i--) { // this is an example of implicit casting-compiler 21 | System.out.print((char)i+" "); // this is an example of explicit casting- we do it 22 | } 23 | 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/day37_inheritance/GradeActivity.java: -------------------------------------------------------------------------------- 1 | package day37_inheritance; 2 | 3 | public class GradeActivity { 4 | 5 | private double score; 6 | 7 | public double getScore() { 8 | return score; 9 | } 10 | 11 | public void setScore(double score) { 12 | this.score = score; 13 | } 14 | 15 | public char getGrade() { 16 | 17 | char letterGrade; 18 | 19 | if(score>=90) { 20 | letterGrade = 'A'; 21 | }else if(score>=80) { 22 | letterGrade = 'B'; 23 | }else if(score>=70) { 24 | letterGrade = 'C'; 25 | }else if(score>=60) { 26 | letterGrade = 'D'; 27 | }else { 28 | letterGrade = 'F'; 29 | } 30 | 31 | return letterGrade; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/day28_arrays_Lab/Lab4_Question6.java: -------------------------------------------------------------------------------- 1 | package day28_arrays_Lab; 2 | 3 | import java.util.Arrays; 4 | 5 | public class Lab4_Question6 { 6 | 7 | public static void main(String[] args) { 8 | 9 | int[] x = {1,20,3,0,0,0,0,0,0,0,125}; 10 | 11 | System.out.println(Arrays.toString(maxEnd(x))); 12 | 13 | } 14 | 15 | public static int[] maxEnd(int[] arr) { 16 | 17 | int max = arr[0]; 18 | 19 | for(int i=0;imax) { 22 | 23 | max = arr[i+1]; 24 | 25 | 26 | } 27 | } 28 | 29 | for(int i=0;i list1 = new ArrayList<>(); 10 | list1.add(30);list1.add(12);list1.add(22); 11 | 12 | ArrayList list2 = new ArrayList(); 13 | list2.add(30);list2.add(345);list2.add(1);list2.add(12);list2.add(22);list2.add(12); 14 | 15 | System.out.println(list1); 16 | System.out.println(list2); 17 | 18 | //removes all matching values from list1 19 | list2.removeAll(list1); 20 | 21 | System.out.println(list2); 22 | 23 | 24 | 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /live_review_sections/week4/ScrumTeam.java: -------------------------------------------------------------------------------- 1 | package week4; 2 | 3 | public class ScrumTeam { 4 | 5 | String companyName; 6 | int developers; 7 | int testers; 8 | double developerSalary; 9 | double testerSalary; 10 | double companyRevenue; 11 | 12 | public double costOfTheTeam() { 13 | return developers*developerSalary+testers*testerSalary; 14 | } 15 | 16 | 17 | 18 | public double returnOfInvestment() { 19 | return companyRevenue/costOfTheTeam(); 20 | } 21 | 22 | public void createCompany(String name, int devNums, int tesNums) { // setter method 23 | companyName = name; 24 | developers = devNums; 25 | testers = tesNums; 26 | } 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/day14_methods_Part2/Lab2_Love6.java: -------------------------------------------------------------------------------- 1 | package day14_methods_Part2; 2 | 3 | public class Lab2_Love6 { 4 | 5 | /*The number 6 is a truly great number. Write a method that accepts num1 and num2, 6 | * prints true if either one is 6. Or if their sum or difference is 6. 7 | */ 8 | 9 | 10 | 11 | public static void main(String[] args) { 12 | 13 | love6(6, 4); 14 | love6(4, 5); 15 | love6(1, 5); 16 | love6(12, 6); 17 | 18 | } 19 | 20 | public static void love6(int num1,int num2) { 21 | 22 | if(num1==6 || num2==6 || num1+num2==6 || num1-num2==6 || num2-num1==6) { 23 | System.out.println(true); 24 | }else { 25 | System.out.println(false); 26 | } 27 | 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/day25_arrays_part2/SameArray.java: -------------------------------------------------------------------------------- 1 | package day25_arrays_part2; 2 | 3 | public class SameArray { 4 | 5 | public static void main(String[] args) { 6 | 7 | int[] array1 = {2,4,6,8,10}; 8 | 9 | int[] array2 = array1; 10 | 11 | array1[0] = 200; 12 | 13 | array2[4] = 1000; 14 | 15 | System.out.println("The contencts of array1:"); 16 | 17 | for(int value : array1) { 18 | System.out.println(value); 19 | } 20 | 21 | System.out.println(); 22 | 23 | System.out.println("The contencts of array2:"); 24 | 25 | for(int value : array2) { 26 | System.out.println(value); 27 | } 28 | 29 | int[] numbers = {20,0,0,30,0,0}; 30 | 31 | 32 | 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/day37_inheritance/FinalExam.java: -------------------------------------------------------------------------------- 1 | package day37_inheritance; 2 | 3 | public class FinalExam extends GradeActivity { 4 | 5 | private int numQuestions; 6 | private double pointsEach; 7 | private int numMissed; 8 | 9 | 10 | public FinalExam(int numQuestions,int numMissed) { 11 | 12 | double numericScore; 13 | 14 | this.numQuestions = numQuestions; 15 | this.numMissed = numMissed; 16 | 17 | pointsEach = 100.0 / numQuestions; 18 | numericScore = 100.0 - (numMissed * pointsEach); 19 | 20 | 21 | //My goal is to receive the letter based on my numericScore 22 | //how will I set my numericScore to score 23 | 24 | 25 | setScore(numericScore); 26 | 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /ReplitSolutions/_3_006_String_PrintFirstAndLastLetters.java: -------------------------------------------------------------------------------- 1 | //Write a program that will print out first and last letters together. 2 | // 3 | // ``` 4 | // Input: adobe 5 | // ``` 6 | // 7 | // ``` 8 | // Output: ae 9 | // ``` 10 | 11 | import java.util.Scanner; 12 | 13 | public class _3_006_String_PrintFirstAndLastLetters { 14 | public static void main(String[] args) { 15 | //DO NOT CHANGE 16 | Scanner scan = new Scanner(System.in); 17 | String word = scan.next(); 18 | //WRITE YOUR CODE HERE 19 | 20 | 21 | System.out.println(Character.toString(word.charAt(0))+Character.toString(word.charAt(word.length()-1))); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /live_review_sections/week1/ScanerExample.java: -------------------------------------------------------------------------------- 1 | package week1; 2 | 3 | import java.util.Scanner; 4 | 5 | public class ScanerExample { 6 | public static void main(String[] args) { 7 | 8 | // output console 9 | System.out.println("Output"); 10 | 11 | //input from console: we use Scanner class and object we created that class 12 | 13 | // 1. create your scanner object 14 | Scanner input = new Scanner (System.in); 15 | 16 | // 2. prompt user 17 | 18 | System.out.println("Put your name: "); 19 | 20 | //3. get the input 21 | 22 | String name = input.next(); // nextInt(), nextDouble() 23 | 24 | //4. Use the value you got 25 | 26 | System.out.println("your name is: "+ name); 27 | 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /live_review_sections/week2/SwitchInTestersLife.java: -------------------------------------------------------------------------------- 1 | package week2; 2 | 3 | import java.util.Scanner; 4 | 5 | public class SwitchInTestersLife { 6 | 7 | public static void main(String[] args) { 8 | 9 | Scanner input = new Scanner (System.in); 10 | 11 | System.out.println("Browser Type to Automate"); 12 | 13 | String browser = input.next(); 14 | 15 | 16 | switch (browser) { 17 | 18 | case("chrome"): 19 | System.out.println("Doing chrome automation"); 20 | break; 21 | 22 | case("firefox"): 23 | System.out.println("Doing firefox automation"); 24 | break; 25 | 26 | default: 27 | System.out.println("wrong entry"); 28 | } 29 | 30 | 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /live_review_sections/week5/S09_FrequencyOfWord.java: -------------------------------------------------------------------------------- 1 | package week5; 2 | 3 | public class S09_FrequencyOfWord { 4 | 5 | public static void main(String[] args) { 6 | String sentence = "I am an experienced tester. As a tester I can automate browsers." 7 | + " I can test API and DB test"; 8 | String word = "test"; 9 | 10 | System.out.println(freqOfWord(sentence, word)); 11 | } 12 | 13 | 14 | public static int freqOfWord(String str, String word) { 15 | int count = 0; 16 | 17 | for (int i = 0; i <= str.length()-word.length();i++) { 18 | String each = str.substring(i, i+word.length()); 19 | if(each.equalsIgnoreCase(word)) { 20 | count++; 21 | } 22 | 23 | } 24 | 25 | return count; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /live_review_sections/week6/A07_SentenceSplit.java: -------------------------------------------------------------------------------- 1 | package week6; 2 | 3 | public class A07_SentenceSplit { 4 | public static void main(String[] args) { 5 | 6 | String amazonResult = "1-48 x of x over x 6,000 x results x for x java"; 7 | 8 | 9 | String[] resultArray = amazonResult.split("x"); 10 | System.out.println(resultArray.length); 11 | System.out.println("How many results are there in my search: "+ resultArray[3] ); 12 | System.out.println("First element : "+ resultArray[0]); 13 | System.out.println("Second Element : "+ resultArray[1]); 14 | System.out.println("Number of 'x' in my statement : " + (resultArray.length-1) ); 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/day08_control_flow_statements_2/Task36_Calculator.java: -------------------------------------------------------------------------------- 1 | package day08_control_flow_statements_2; 2 | 3 | public class Task36_Calculator { 4 | 5 | public static void main(String[] args) { 6 | 7 | int num1=10; 8 | int num2=5; 9 | String operator="*"; 10 | int result=0; 11 | 12 | switch(operator) { 13 | 14 | case "+": 15 | result = num1+num2; 16 | break; 17 | case "-": 18 | result = num1-num2; 19 | break; 20 | case "*": 21 | result = num1*num2; 22 | break; 23 | case "/": 24 | result = num1/num2; 25 | break; 26 | default: 27 | System.out.println("Invalid Operator"); 28 | 29 | } 30 | 31 | System.out.println("Result is " + result); 32 | 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/day11_controlFlowStatements_5/WhileLoop.java: -------------------------------------------------------------------------------- 1 | package day11_controlFlowStatements_5; 2 | 3 | public class WhileLoop { 4 | 5 | public static void main(String[] args) { 6 | 7 | //print 0-10 8 | 9 | int i=0; 10 | 11 | while(i<=10) { 12 | System.out.println(i); 13 | i++; 14 | } 15 | 16 | //using a loop , iterate untill we have 10 students in the room 17 | 18 | int numberOfStudents=1; 19 | 20 | while(numberOfStudents<=10) { 21 | System.out.println("Student " + numberOfStudents); 22 | numberOfStudents++; 23 | } 24 | 25 | //print 11,10,9,8......1 26 | 27 | int num=11; 28 | while(num>=1) { 29 | System.out.print(num + " "); 30 | num--; 31 | } 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/day30_wrapperClass/task96_ConvertingTemp.java: -------------------------------------------------------------------------------- 1 | package day30_wrapperClass; 2 | 3 | import java.util.Arrays; 4 | 5 | public class task96_ConvertingTemp { 6 | 7 | public static void main(String[] args) { 8 | 9 | String str1 = "Today weather is sunny and 89 degree. It is a perfect day to practice java."; 10 | 11 | String[] arr = str1.split("and "); 12 | 13 | arr = arr[1].split(" degree"); 14 | 15 | String degree = arr[0]; 16 | 17 | double degreeF = Double.parseDouble(degree); 18 | 19 | double degreeC = (degreeF - 32) * 5/9; 20 | 21 | System.out.println(degreeF + " degree is equal to " + Math.round(degreeC) + " celcius"); 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/day03_variables_dataTypes/CreatingVariables.java: -------------------------------------------------------------------------------- 1 | package day03_variables_dataTypes; 2 | 3 | public class CreatingVariables { 4 | 5 | public static void main(String[] args) { 6 | 7 | int price = 5; 8 | int quantity = 14; 9 | 10 | int price2,quantity2; 11 | String name,address,country,lastname; 12 | 13 | name="Ozzy"; 14 | address="USA"; 15 | 16 | price2=100; 17 | quantity2=20; 18 | 19 | int price3=5,quantity3=50; 20 | 21 | String s1,s2; 22 | String s3="yes",s4="no"; 23 | 24 | //int num,String value; //Does not compile 25 | int num;String value; 26 | num=5; 27 | System.out.println(num); 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/day15_methods_Part3/assignment3_Fibonacci.java: -------------------------------------------------------------------------------- 1 | package day15_methods_Part3; 2 | 3 | public class assignment3_Fibonacci { 4 | 5 | public static void main(String[] args) { 6 | 7 | 8 | int count=8; 9 | int pre1=0, pre2=1; 10 | System.out.println("Fibonacci series of " + count + " numbers"); 11 | 12 | 13 | for(int i=1;i=21) { 9 | System.out.println("Eligible to buy"); 10 | }else { 11 | System.out.println("NOT Eligible to buy"); 12 | } 13 | 14 | int person2 = 20; 15 | if (person2>=21) { 16 | System.out.println("Eligible to buy"); 17 | }else { 18 | System.out.println("NOT Eligible to buy"); 19 | } 20 | 21 | int person3 = 24; 22 | if (person3>=21) { 23 | System.out.println("Eligible to buy"); 24 | }else { 25 | System.out.println("NOT Eligible to buy"); 26 | } 27 | 28 | 29 | 30 | 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/day28_arrays_Lab/Lab4_Question10.java: -------------------------------------------------------------------------------- 1 | package day28_arrays_Lab; 2 | 3 | public class Lab4_Question10 { 4 | 5 | public static void main(String[] args) { 6 | 7 | int[] x = {2,2,2,2,3}; 8 | int[] y = {2,3}; 9 | 10 | System.out.println(double23(x)); 11 | System.out.println(double23(y)); 12 | 13 | 14 | } 15 | 16 | public static boolean double23(int[] arr) { 17 | 18 | int counter2 = 0; 19 | int counter3 = 0 ; 20 | 21 | for(int value : arr) { 22 | if(value==2) { 23 | counter2++; 24 | }else if(value == 3) { 25 | counter3++; 26 | } 27 | } 28 | 29 | if(counter2 == 2 || counter3 == 2) { 30 | return true; 31 | }else { 32 | return false; 33 | } 34 | 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/day28_arrays_Lab/Lab4_Question11.java: -------------------------------------------------------------------------------- 1 | package day28_arrays_Lab; 2 | 3 | import java.util.Arrays; 4 | 5 | public class Lab4_Question11 { 6 | 7 | public static void main(String[] args) { 8 | 9 | int[] x = {1,2,3}; 10 | int[] y = {2,0,5}; 11 | int[] a = {11,2,13,2,3}; 12 | 13 | System.out.println(Arrays.toString(fix23(x))); 14 | System.out.println(Arrays.toString(fix23(y))); 15 | System.out.println(Arrays.toString(fix23(a))); 16 | 17 | 18 | 19 | } 20 | 21 | public static int[] fix23(int[] arr) { 22 | 23 | for(int i=0;i myList = new ArrayList<>(); 19 | myList.add(new Shape()); 20 | myList.add(new Square()); 21 | myList.add(new Shape()); 22 | myList.add(new Square()); 23 | myList.add(new Diamond()); 24 | 25 | drawShape(myList); 26 | 27 | 28 | 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/day29_arrays_Lab/Lab4_Question17.java: -------------------------------------------------------------------------------- 1 | package day29_arrays_Lab; 2 | 3 | public class Lab4_Question17 { 4 | 5 | public static void main(String[] args) { 6 | 7 | int[] x = {7,2,10,9}; 8 | 9 | System.out.println(difference(x)); 10 | 11 | } 12 | 13 | public static int difference(int[] arr) { 14 | 15 | //finding the biggest 16 | int max = arr[0]; 17 | for(int i=0;imax) { 20 | 21 | max = arr[i]; 22 | } 23 | } 24 | 25 | //finding the smallest 26 | int min = max; 27 | 28 | for(int i=0;i=70) { 10 | 11 | System.out.println("Excellent"); 12 | System.out.println("You passed with grade A"); 13 | 14 | } 15 | 16 | System.out.println("***********************"); 17 | 18 | int sales,bonus; 19 | double commisionRate,salary; 20 | 21 | sales=5000; 22 | salary=10000; 23 | 24 | if(sales>5000) { 25 | bonus=500; 26 | commisionRate=1.12; 27 | 28 | salary=salary*commisionRate+bonus; 29 | } 30 | 31 | System.out.println("Salary = " + salary); 32 | 33 | } 34 | 35 | } 36 | --------------------------------------------------------------------------------