├── README.md ├── SB101_C3_EVALUATION ├── file.txt ├── .settings │ ├── org.eclipse.core.resources.prefs │ └── org.eclipse.jdt.core.prefs ├── student.txt ├── bin │ └── com │ │ ├── question_1 │ │ ├── A.class │ │ ├── B.class │ │ ├── DeadLock.class │ │ ├── ThreadA.class │ │ ├── ThreadB.class │ │ └── DeadLock.txt │ │ ├── question_2 │ │ ├── Main.class │ │ └── ThreadA.class │ │ ├── question_3 │ │ ├── Demo.class │ │ └── MyCallable.class │ │ ├── question_4 │ │ ├── Main.class │ │ ├── ThreadA.class │ │ ├── ThreadB.class │ │ └── ThreadC.class │ │ └── question_5 │ │ ├── Main.class │ │ ├── Main2.class │ │ ├── Address.class │ │ └── Student.class ├── src │ └── com │ │ ├── question_1 │ │ ├── ThreadB.java │ │ ├── ThreadA.java │ │ ├── DeadLock.java │ │ ├── A.java │ │ ├── B.java │ │ └── DeadLock.txt │ │ ├── question_2 │ │ ├── ThreadA.java │ │ └── Main.java │ │ ├── question_4 │ │ ├── ThreadB.java │ │ ├── Main.java │ │ ├── ThreadA.java │ │ └── ThreadC.java │ │ ├── question_3 │ │ ├── MyCallable.java │ │ └── Demo.java │ │ └── question_5 │ │ ├── Address.java │ │ ├── Main2.java │ │ ├── Main.java │ │ └── Student.java ├── .classpath └── .project ├── JA111 C2Evaluation ├── .settings │ ├── org.eclipse.core.resources.prefs │ └── org.eclipse.jdt.core.prefs ├── bin │ └── com │ │ ├── question_2 │ │ ├── Main.class │ │ └── Student.class │ │ ├── question_3 │ │ ├── Main.class │ │ └── Ticket.class │ │ ├── question_4 │ │ ├── CPU.class │ │ ├── Main.class │ │ ├── Laptop.class │ │ └── GraphicCard.class │ │ ├── question_5 │ │ ├── Main.class │ │ └── Employee.class │ │ └── question_1 │ │ └── String.txt ├── .classpath ├── .project └── src │ └── com │ ├── question_2 │ ├── Student.java │ └── Main.java │ ├── question_4 │ ├── GraphicCard.java │ ├── CPU.java │ ├── Main.java │ └── Laptop.java │ ├── question_3 │ ├── Ticket.java │ └── Main.java │ ├── question_5 │ ├── Main.java │ └── Employee.java │ └── question_1 │ └── String.txt ├── JA111 C3Evaluation ├── .settings │ ├── org.eclipse.core.resources.prefs │ └── org.eclipse.jdt.core.prefs ├── src │ └── com │ │ ├── question_5 │ │ ├── A.java │ │ ├── Vehicle.java │ │ ├── Main.java │ │ ├── FuelCar.java │ │ ├── ElectricCar.java │ │ └── B.java │ │ ├── question_6 │ │ ├── Student.java │ │ ├── ArtStudent.java │ │ ├── CommerceStudent.java │ │ ├── ScienceStudent.java │ │ └── Main.java │ │ ├── question_2 │ │ ├── Test.java │ │ ├── Cycle.java │ │ ├── Heroculas.java │ │ └── EarlyBinding_LateBinding.txt │ │ ├── question_3 │ │ ├── DsaEvaluation.java │ │ ├── CodingEvaluation.java │ │ ├── Evaluation.java │ │ └── Main.java │ │ ├── question_4 │ │ └── Main.java │ │ └── question_1 │ │ ├── Student.java │ │ ├── Employee.java │ │ └── Main.java ├── bin │ └── com │ │ ├── question_5 │ │ ├── A.class │ │ ├── B.class │ │ ├── Main.class │ │ ├── FuelCar.class │ │ ├── Vehicle.class │ │ └── ElectricCar.class │ │ ├── question_1 │ │ ├── Main.class │ │ ├── Employee.class │ │ └── Student.class │ │ ├── question_2 │ │ ├── Test.class │ │ ├── Cycle.class │ │ ├── Heroculas.class │ │ └── EarlyBinding_LateBinding.txt │ │ ├── question_3 │ │ ├── Main.class │ │ ├── Evaluation.class │ │ ├── DsaEvaluation.class │ │ └── CodingEvaluation.class │ │ ├── question_4 │ │ └── Main.class │ │ └── question_6 │ │ ├── Main.class │ │ ├── Student.class │ │ ├── ArtStudent.class │ │ ├── ScienceStudent.class │ │ └── CommerceStudent.class ├── .classpath └── .project ├── JA111 C4Evaluation ├── .settings │ ├── org.eclipse.core.resources.prefs │ └── org.eclipse.jdt.core.prefs ├── bin │ └── com │ │ ├── question_1 │ │ ├── Book.class │ │ └── Library.class │ │ ├── question_3 │ │ ├── Main.class │ │ ├── Student.class │ │ └── StudentComp.class │ │ ├── question_4 │ │ ├── Main.class │ │ ├── Ecommerce.class │ │ └── Product.class │ │ └── question_5 │ │ └── Main.class ├── .classpath ├── .project └── src │ └── com │ ├── question_4 │ ├── Main.java │ ├── Ecommerce.java │ └── Product.java │ ├── question_3 │ ├── Main.java │ ├── StudentComp.java │ └── Student.java │ ├── question_1 │ ├── Library.java │ └── Book.java │ └── question_5 │ └── Main.java ├── SB101_C1_EVALUATION ├── .settings │ ├── org.eclipse.core.resources.prefs │ └── org.eclipse.jdt.core.prefs ├── src │ └── com │ │ ├── question_3 │ │ ├── Payment.java │ │ ├── CashPayment.java │ │ ├── CardPayment.java │ │ └── Demo.java │ │ ├── quesiton_4 │ │ └── Main.java │ │ ├── question_1 │ │ ├── Employee.java │ │ └── Demo.java │ │ └── question_2 │ │ └── Mobile.java ├── bin │ └── com │ │ ├── quesiton_4 │ │ └── Main.class │ │ ├── question_1 │ │ ├── Demo.class │ │ └── Employee.class │ │ ├── question_3 │ │ ├── Demo.class │ │ ├── Payment.class │ │ ├── CardPayment.class │ │ └── CashPayment.class │ │ └── question_2 │ │ └── Mobile.class ├── .classpath └── .project ├── SB101_C2_EVALUATION ├── .settings │ ├── org.eclipse.core.resources.prefs │ └── org.eclipse.jdt.core.prefs ├── bin │ └── com │ │ ├── question_1 │ │ ├── Book.class │ │ ├── Main.class │ │ ├── Library.class │ │ └── BookException.class │ │ ├── question_2 │ │ └── Main.class │ │ ├── question_3 │ │ ├── Main.class │ │ ├── Employee.class │ │ └── Student.class │ │ └── question_4 │ │ └── Main.class ├── src │ └── com │ │ ├── question_1 │ │ ├── BookException.java │ │ ├── Book.java │ │ ├── Library.java │ │ └── Main.java │ │ ├── question_4 │ │ └── Main.java │ │ ├── question_3 │ │ ├── Main.java │ │ ├── Student.java │ │ └── Employee.java │ │ └── question_2 │ │ └── Main.java ├── .classpath └── .project ├── Sort_HashMapBy_Key_and_Value ├── .settings │ ├── org.eclipse.core.resources.prefs │ └── org.eclipse.jdt.core.prefs ├── bin │ └── com │ │ └── practice │ │ ├── Student.class │ │ ├── SortByKey.class │ │ ├── SortByValue.class │ │ └── StuedentComp.class ├── .classpath ├── src │ └── com │ │ └── practice │ │ ├── StuedentComp.java │ │ ├── Student.java │ │ ├── SortByKey.java │ │ └── SortByValue.java └── .project └── Java Boiler Code.txt /README.md: -------------------------------------------------------------------------------- 1 | # Java_Evaluation -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/file.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C3_EVALUATION/file.txt -------------------------------------------------------------------------------- /JA111 C2Evaluation/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /JA111 C3Evaluation/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /JA111 C4Evaluation/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /SB101_C1_EVALUATION/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /SB101_C2_EVALUATION/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/student.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C3_EVALUATION/student.txt -------------------------------------------------------------------------------- /JA111 C3Evaluation/src/com/question_5/A.java: -------------------------------------------------------------------------------- 1 | package com.question_5; 2 | 3 | public interface A { 4 | 5 | int i=111; 6 | 7 | } 8 | -------------------------------------------------------------------------------- /Sort_HashMapBy_Key_and_Value/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /JA111 C3Evaluation/bin/com/question_5/A.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C3Evaluation/bin/com/question_5/A.class -------------------------------------------------------------------------------- /JA111 C3Evaluation/bin/com/question_5/B.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C3Evaluation/bin/com/question_5/B.class -------------------------------------------------------------------------------- /SB101_C1_EVALUATION/src/com/question_3/Payment.java: -------------------------------------------------------------------------------- 1 | package com.question_3; 2 | 3 | public interface Payment { 4 | public void doPayment(); 5 | 6 | } 7 | -------------------------------------------------------------------------------- /JA111 C2Evaluation/bin/com/question_2/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C2Evaluation/bin/com/question_2/Main.class -------------------------------------------------------------------------------- /JA111 C2Evaluation/bin/com/question_3/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C2Evaluation/bin/com/question_3/Main.class -------------------------------------------------------------------------------- /JA111 C2Evaluation/bin/com/question_4/CPU.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C2Evaluation/bin/com/question_4/CPU.class -------------------------------------------------------------------------------- /JA111 C2Evaluation/bin/com/question_4/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C2Evaluation/bin/com/question_4/Main.class -------------------------------------------------------------------------------- /JA111 C2Evaluation/bin/com/question_5/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C2Evaluation/bin/com/question_5/Main.class -------------------------------------------------------------------------------- /JA111 C3Evaluation/bin/com/question_1/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C3Evaluation/bin/com/question_1/Main.class -------------------------------------------------------------------------------- /JA111 C3Evaluation/bin/com/question_2/Test.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C3Evaluation/bin/com/question_2/Test.class -------------------------------------------------------------------------------- /JA111 C3Evaluation/bin/com/question_3/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C3Evaluation/bin/com/question_3/Main.class -------------------------------------------------------------------------------- /JA111 C3Evaluation/bin/com/question_4/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C3Evaluation/bin/com/question_4/Main.class -------------------------------------------------------------------------------- /JA111 C3Evaluation/bin/com/question_5/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C3Evaluation/bin/com/question_5/Main.class -------------------------------------------------------------------------------- /JA111 C3Evaluation/bin/com/question_6/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C3Evaluation/bin/com/question_6/Main.class -------------------------------------------------------------------------------- /JA111 C4Evaluation/bin/com/question_1/Book.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C4Evaluation/bin/com/question_1/Book.class -------------------------------------------------------------------------------- /JA111 C4Evaluation/bin/com/question_3/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C4Evaluation/bin/com/question_3/Main.class -------------------------------------------------------------------------------- /JA111 C4Evaluation/bin/com/question_4/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C4Evaluation/bin/com/question_4/Main.class -------------------------------------------------------------------------------- /JA111 C4Evaluation/bin/com/question_5/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C4Evaluation/bin/com/question_5/Main.class -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/bin/com/question_1/A.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C3_EVALUATION/bin/com/question_1/A.class -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/bin/com/question_1/B.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C3_EVALUATION/bin/com/question_1/B.class -------------------------------------------------------------------------------- /JA111 C2Evaluation/bin/com/question_3/Ticket.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C2Evaluation/bin/com/question_3/Ticket.class -------------------------------------------------------------------------------- /JA111 C2Evaluation/bin/com/question_4/Laptop.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C2Evaluation/bin/com/question_4/Laptop.class -------------------------------------------------------------------------------- /JA111 C3Evaluation/bin/com/question_2/Cycle.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C3Evaluation/bin/com/question_2/Cycle.class -------------------------------------------------------------------------------- /JA111 C3Evaluation/src/com/question_6/Student.java: -------------------------------------------------------------------------------- 1 | package com.question_6; 2 | 3 | public interface Student { 4 | 5 | public double findPercentage(); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /SB101_C1_EVALUATION/bin/com/quesiton_4/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C1_EVALUATION/bin/com/quesiton_4/Main.class -------------------------------------------------------------------------------- /SB101_C1_EVALUATION/bin/com/question_1/Demo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C1_EVALUATION/bin/com/question_1/Demo.class -------------------------------------------------------------------------------- /SB101_C1_EVALUATION/bin/com/question_3/Demo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C1_EVALUATION/bin/com/question_3/Demo.class -------------------------------------------------------------------------------- /SB101_C2_EVALUATION/bin/com/question_1/Book.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C2_EVALUATION/bin/com/question_1/Book.class -------------------------------------------------------------------------------- /SB101_C2_EVALUATION/bin/com/question_1/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C2_EVALUATION/bin/com/question_1/Main.class -------------------------------------------------------------------------------- /SB101_C2_EVALUATION/bin/com/question_2/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C2_EVALUATION/bin/com/question_2/Main.class -------------------------------------------------------------------------------- /SB101_C2_EVALUATION/bin/com/question_3/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C2_EVALUATION/bin/com/question_3/Main.class -------------------------------------------------------------------------------- /SB101_C2_EVALUATION/bin/com/question_4/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C2_EVALUATION/bin/com/question_4/Main.class -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/bin/com/question_2/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C3_EVALUATION/bin/com/question_2/Main.class -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/bin/com/question_3/Demo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C3_EVALUATION/bin/com/question_3/Demo.class -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/bin/com/question_4/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C3_EVALUATION/bin/com/question_4/Main.class -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/bin/com/question_5/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C3_EVALUATION/bin/com/question_5/Main.class -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/bin/com/question_5/Main2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C3_EVALUATION/bin/com/question_5/Main2.class -------------------------------------------------------------------------------- /JA111 C2Evaluation/bin/com/question_2/Student.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C2Evaluation/bin/com/question_2/Student.class -------------------------------------------------------------------------------- /JA111 C2Evaluation/bin/com/question_5/Employee.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C2Evaluation/bin/com/question_5/Employee.class -------------------------------------------------------------------------------- /JA111 C3Evaluation/bin/com/question_1/Employee.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C3Evaluation/bin/com/question_1/Employee.class -------------------------------------------------------------------------------- /JA111 C3Evaluation/bin/com/question_1/Student.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C3Evaluation/bin/com/question_1/Student.class -------------------------------------------------------------------------------- /JA111 C3Evaluation/bin/com/question_2/Heroculas.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C3Evaluation/bin/com/question_2/Heroculas.class -------------------------------------------------------------------------------- /JA111 C3Evaluation/bin/com/question_5/FuelCar.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C3Evaluation/bin/com/question_5/FuelCar.class -------------------------------------------------------------------------------- /JA111 C3Evaluation/bin/com/question_5/Vehicle.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C3Evaluation/bin/com/question_5/Vehicle.class -------------------------------------------------------------------------------- /JA111 C3Evaluation/bin/com/question_6/Student.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C3Evaluation/bin/com/question_6/Student.class -------------------------------------------------------------------------------- /JA111 C4Evaluation/bin/com/question_1/Library.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C4Evaluation/bin/com/question_1/Library.class -------------------------------------------------------------------------------- /JA111 C4Evaluation/bin/com/question_3/Student.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C4Evaluation/bin/com/question_3/Student.class -------------------------------------------------------------------------------- /JA111 C4Evaluation/bin/com/question_4/Ecommerce.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C4Evaluation/bin/com/question_4/Ecommerce.class -------------------------------------------------------------------------------- /JA111 C4Evaluation/bin/com/question_4/Product.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C4Evaluation/bin/com/question_4/Product.class -------------------------------------------------------------------------------- /SB101_C1_EVALUATION/bin/com/question_1/Employee.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C1_EVALUATION/bin/com/question_1/Employee.class -------------------------------------------------------------------------------- /SB101_C1_EVALUATION/bin/com/question_2/Mobile.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C1_EVALUATION/bin/com/question_2/Mobile.class -------------------------------------------------------------------------------- /SB101_C1_EVALUATION/bin/com/question_3/Payment.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C1_EVALUATION/bin/com/question_3/Payment.class -------------------------------------------------------------------------------- /SB101_C2_EVALUATION/bin/com/question_1/Library.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C2_EVALUATION/bin/com/question_1/Library.class -------------------------------------------------------------------------------- /SB101_C2_EVALUATION/bin/com/question_3/Employee.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C2_EVALUATION/bin/com/question_3/Employee.class -------------------------------------------------------------------------------- /SB101_C2_EVALUATION/bin/com/question_3/Student.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C2_EVALUATION/bin/com/question_3/Student.class -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/bin/com/question_1/DeadLock.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C3_EVALUATION/bin/com/question_1/DeadLock.class -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/bin/com/question_1/ThreadA.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C3_EVALUATION/bin/com/question_1/ThreadA.class -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/bin/com/question_1/ThreadB.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C3_EVALUATION/bin/com/question_1/ThreadB.class -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/bin/com/question_2/ThreadA.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C3_EVALUATION/bin/com/question_2/ThreadA.class -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/bin/com/question_4/ThreadA.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C3_EVALUATION/bin/com/question_4/ThreadA.class -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/bin/com/question_4/ThreadB.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C3_EVALUATION/bin/com/question_4/ThreadB.class -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/bin/com/question_4/ThreadC.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C3_EVALUATION/bin/com/question_4/ThreadC.class -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/bin/com/question_5/Address.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C3_EVALUATION/bin/com/question_5/Address.class -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/bin/com/question_5/Student.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C3_EVALUATION/bin/com/question_5/Student.class -------------------------------------------------------------------------------- /JA111 C2Evaluation/bin/com/question_4/GraphicCard.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C2Evaluation/bin/com/question_4/GraphicCard.class -------------------------------------------------------------------------------- /JA111 C3Evaluation/bin/com/question_3/Evaluation.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C3Evaluation/bin/com/question_3/Evaluation.class -------------------------------------------------------------------------------- /JA111 C3Evaluation/bin/com/question_5/ElectricCar.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C3Evaluation/bin/com/question_5/ElectricCar.class -------------------------------------------------------------------------------- /JA111 C3Evaluation/bin/com/question_6/ArtStudent.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C3Evaluation/bin/com/question_6/ArtStudent.class -------------------------------------------------------------------------------- /JA111 C4Evaluation/bin/com/question_3/StudentComp.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C4Evaluation/bin/com/question_3/StudentComp.class -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/bin/com/question_3/MyCallable.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C3_EVALUATION/bin/com/question_3/MyCallable.class -------------------------------------------------------------------------------- /JA111 C3Evaluation/bin/com/question_3/DsaEvaluation.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C3Evaluation/bin/com/question_3/DsaEvaluation.class -------------------------------------------------------------------------------- /JA111 C3Evaluation/bin/com/question_6/ScienceStudent.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C3Evaluation/bin/com/question_6/ScienceStudent.class -------------------------------------------------------------------------------- /JA111 C3Evaluation/src/com/question_5/Vehicle.java: -------------------------------------------------------------------------------- 1 | package com.question_5; 2 | 3 | public interface Vehicle { 4 | 5 | public void run(); // unimplemented method 6 | 7 | } 8 | -------------------------------------------------------------------------------- /SB101_C1_EVALUATION/bin/com/question_3/CardPayment.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C1_EVALUATION/bin/com/question_3/CardPayment.class -------------------------------------------------------------------------------- /SB101_C1_EVALUATION/bin/com/question_3/CashPayment.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C1_EVALUATION/bin/com/question_3/CashPayment.class -------------------------------------------------------------------------------- /SB101_C2_EVALUATION/bin/com/question_1/BookException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/SB101_C2_EVALUATION/bin/com/question_1/BookException.class -------------------------------------------------------------------------------- /JA111 C3Evaluation/bin/com/question_3/CodingEvaluation.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C3Evaluation/bin/com/question_3/CodingEvaluation.class -------------------------------------------------------------------------------- /JA111 C3Evaluation/bin/com/question_6/CommerceStudent.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/JA111 C3Evaluation/bin/com/question_6/CommerceStudent.class -------------------------------------------------------------------------------- /Sort_HashMapBy_Key_and_Value/bin/com/practice/Student.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/Sort_HashMapBy_Key_and_Value/bin/com/practice/Student.class -------------------------------------------------------------------------------- /Sort_HashMapBy_Key_and_Value/bin/com/practice/SortByKey.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/Sort_HashMapBy_Key_and_Value/bin/com/practice/SortByKey.class -------------------------------------------------------------------------------- /Sort_HashMapBy_Key_and_Value/bin/com/practice/SortByValue.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/Sort_HashMapBy_Key_and_Value/bin/com/practice/SortByValue.class -------------------------------------------------------------------------------- /Sort_HashMapBy_Key_and_Value/bin/com/practice/StuedentComp.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandsinghyadav/Java_Evaluation/HEAD/Sort_HashMapBy_Key_and_Value/bin/com/practice/StuedentComp.class -------------------------------------------------------------------------------- /SB101_C2_EVALUATION/src/com/question_1/BookException.java: -------------------------------------------------------------------------------- 1 | package com.question_1; 2 | 3 | public class BookException extends Exception { 4 | 5 | public BookException(String msg) { 6 | super(msg); 7 | 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /JA111 C3Evaluation/src/com/question_5/Main.java: -------------------------------------------------------------------------------- 1 | package com.question_5; 2 | 3 | public class Main { 4 | public static void main(String[] args) { 5 | 6 | FuelCar fc = new FuelCar(); 7 | fc.run(); 8 | fc.service(); 9 | 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /JA111 C3Evaluation/src/com/question_2/Test.java: -------------------------------------------------------------------------------- 1 | package com.question_2; 2 | 3 | public class Test { 4 | 5 | public static void main(String[] args) { 6 | Cycle cycle = new Cycle(); 7 | Cycle heroculas = new Heroculas(); 8 | cycle.run(); 9 | heroculas.run(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /JA111 C3Evaluation/src/com/question_2/Cycle.java: -------------------------------------------------------------------------------- 1 | package com.question_2; 2 | 3 | public class Cycle { 4 | 5 | public void run() { 6 | System.out.println("Cycle is running."); 7 | } 8 | 9 | // public static void run() { // for early binding 10 | // System.out.println("Cycle is running."); 11 | // } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /JA111 C3Evaluation/src/com/question_5/FuelCar.java: -------------------------------------------------------------------------------- 1 | package com.question_5; 2 | 3 | public class FuelCar implements Vehicle{ 4 | 5 | @Override 6 | public void run() { 7 | System.out.println("Fuel Car is running...."); 8 | 9 | } 10 | public void service() { 11 | System.out.println("Car needs service..."); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /JA111 C3Evaluation/src/com/question_2/Heroculas.java: -------------------------------------------------------------------------------- 1 | package com.question_2; 2 | 3 | public class Heroculas extends Cycle{ 4 | 5 | 6 | public void run() { 7 | System.out.println("Heroculas is running."); 8 | } 9 | 10 | 11 | // public static void run() { 12 | // System.out.println("Heroculas is running."); 13 | // } 14 | } 15 | -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/src/com/question_1/ThreadB.java: -------------------------------------------------------------------------------- 1 | package com.question_1; 2 | 3 | class ThreadB extends Thread{ 4 | A a1; 5 | B b1; 6 | 7 | public ThreadB(A a1,B b1) { 8 | 9 | this.b1=b1; 10 | this.a1=a1; 11 | 12 | } 13 | 14 | @Override 15 | public void run() { 16 | b1.funB(a1); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /JA111 C3Evaluation/src/com/question_3/DsaEvaluation.java: -------------------------------------------------------------------------------- 1 | package com.question_3; 2 | 3 | public class DsaEvaluation extends Evaluation{ 4 | @Override 5 | void evaluationTiming() { 6 | System.out.println("Evaluation timing is 9:30 to 11:00"); 7 | } 8 | 9 | public DsaEvaluation(int question) { 10 | super(question); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /JA111 C3Evaluation/src/com/question_5/ElectricCar.java: -------------------------------------------------------------------------------- 1 | package com.question_5; 2 | 3 | public class ElectricCar implements Vehicle{ 4 | 5 | @Override 6 | public void run() { 7 | System.out.println("Electric car is running...."); 8 | 9 | } 10 | 11 | public void service() { 12 | System.out.println("Car needs Service"); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/src/com/question_1/ThreadA.java: -------------------------------------------------------------------------------- 1 | package com.question_1; 2 | 3 | class ThreadA extends Thread{ 4 | A a1; 5 | B b1; 6 | 7 | public ThreadA(A a1,B b1) { 8 | 9 | this.b1=b1; 10 | this.a1=a1; 11 | 12 | } 13 | 14 | @Override 15 | public void run() { 16 | 17 | a1.funA(b1); 18 | 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /JA111 C3Evaluation/src/com/question_3/CodingEvaluation.java: -------------------------------------------------------------------------------- 1 | package com.question_3; 2 | 3 | public class CodingEvaluation extends Evaluation { 4 | 5 | public CodingEvaluation(int question) { 6 | super(question); 7 | } 8 | 9 | @Override 10 | void evaluationTiming() { 11 | System.out.println("Evaluation timing is 2:00 to 3:30"); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /JA111 C3Evaluation/src/com/question_5/B.java: -------------------------------------------------------------------------------- 1 | package com.question_5; 2 | 3 | public class B implements A{ 4 | 5 | void methodB() { 6 | // i=222; 7 | } 8 | 9 | } 10 | 11 | // Its giving CE: because inside the interface every varibale 12 | // is by default public static final therefore as we know 13 | // once final variable initialized can't initialize again 14 | -------------------------------------------------------------------------------- /SB101_C1_EVALUATION/src/com/question_3/CashPayment.java: -------------------------------------------------------------------------------- 1 | package com.question_3; 2 | 3 | public class CashPayment implements Payment{ 4 | 5 | private int amount; 6 | 7 | public CashPayment(int amt) { 8 | this.amount = amt; 9 | } 10 | 11 | @Override 12 | public void doPayment() { 13 | System.out.println("Payment done using Cash "+amount); 14 | } 15 | 16 | 17 | } 18 | -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/src/com/question_1/DeadLock.java: -------------------------------------------------------------------------------- 1 | package com.question_1; 2 | 3 | public class DeadLock { 4 | 5 | public static void main(String[] args) { 6 | 7 | A a1 = new A(); 8 | B b1 = new B(); 9 | 10 | ThreadA t1 = new ThreadA(a1, b1); 11 | ThreadB t2 = new ThreadB(a1, b1); 12 | 13 | t1.start();//2 14 | t2.start();//3 15 | 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /SB101_C1_EVALUATION/src/com/question_3/CardPayment.java: -------------------------------------------------------------------------------- 1 | package com.question_3; 2 | 3 | public class CardPayment implements Payment{ 4 | private int amount; 5 | 6 | public CardPayment(int amt) { 7 | this.amount=amt; 8 | } 9 | 10 | @Override 11 | public void doPayment() { 12 | System.out.println("Payment done using Card "+amount); 13 | 14 | } 15 | 16 | 17 | 18 | } 19 | -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/src/com/question_1/A.java: -------------------------------------------------------------------------------- 1 | package com.question_1; 2 | 3 | public class A { 4 | 5 | public synchronized void funA(B b1){ 6 | 7 | System.out.println("funA of A starts"); 8 | 9 | b1.fun2(); 10 | 11 | System.out.println("funA of A ends"); 12 | 13 | } 14 | 15 | public void fun1(){ 16 | 17 | System.out.println("inside fun1 of A"); 18 | 19 | } 20 | 21 | 22 | } 23 | -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/src/com/question_2/ThreadA.java: -------------------------------------------------------------------------------- 1 | package com.question_2; 2 | 3 | public class ThreadA implements Runnable { 4 | 5 | int product=1; 6 | 7 | @Override 8 | public void run() { 9 | 10 | synchronized (this) { 11 | 12 | for(int i=1;i<=10;i++) { 13 | product*=i; 14 | } 15 | this.notify(); 16 | 17 | } 18 | 19 | 20 | } 21 | 22 | 23 | } 24 | -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/src/com/question_1/B.java: -------------------------------------------------------------------------------- 1 | package com.question_1; 2 | 3 | public class B { 4 | 5 | public synchronized void funB(A a1){ 6 | 7 | System.out.println("funB of B starts"); 8 | 9 | a1.fun1(); 10 | 11 | System.out.println("funB of B ends"); 12 | 13 | } 14 | public synchronized void fun2(){ 15 | System.out.println("inside fun2 of B"); 16 | 17 | } 18 | 19 | 20 | } 21 | -------------------------------------------------------------------------------- /JA111 C2Evaluation/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /JA111 C3Evaluation/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /JA111 C4Evaluation/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /SB101_C1_EVALUATION/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /SB101_C2_EVALUATION/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Sort_HashMapBy_Key_and_Value/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /JA111 C2Evaluation/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | JA111 C2Evaluation 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 | -------------------------------------------------------------------------------- /JA111 C3Evaluation/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | JA111 C3Evaluation 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 | -------------------------------------------------------------------------------- /JA111 C4Evaluation/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | JA111 C4Evaluation 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 | -------------------------------------------------------------------------------- /SB101_C1_EVALUATION/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | SB101_C1_EVALUATION 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 | -------------------------------------------------------------------------------- /SB101_C2_EVALUATION/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | SB101_C2_EVALUATION 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 | -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | SB101_C3_EVALUATION 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 | -------------------------------------------------------------------------------- /JA111 C3Evaluation/src/com/question_3/Evaluation.java: -------------------------------------------------------------------------------- 1 | package com.question_3; 2 | 3 | public abstract class Evaluation { 4 | 5 | private final int numberOfQuestions; 6 | abstract void evaluationTiming(); 7 | void printNoOfQuestions() { 8 | System.out.println("No. of Questions in Evaluation is :" +numberOfQuestions); 9 | } 10 | 11 | public Evaluation(int question) { 12 | // TODO Auto-generated constructor stub 13 | this.numberOfQuestions=question; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /Sort_HashMapBy_Key_and_Value/src/com/practice/StuedentComp.java: -------------------------------------------------------------------------------- 1 | package com.practice; 2 | 3 | import java.util.Comparator; 4 | import java.util.Map; 5 | import java.util.Map.Entry; 6 | 7 | public class StuedentComp implements Comparator>{ 8 | 9 | @Override 10 | public int compare(Entry o1, Entry o2) { 11 | 12 | return o1.getValue().getMarks()>o2.getValue().getMarks()?1:-1; 13 | 14 | } 15 | 16 | 17 | 18 | } 19 | -------------------------------------------------------------------------------- /Sort_HashMapBy_Key_and_Value/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Sort_HashMapBy_Key_and_Value 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 | -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/src/com/question_4/ThreadB.java: -------------------------------------------------------------------------------- 1 | package com.question_4; 2 | 3 | public class ThreadB extends Thread{ 4 | 5 | 6 | int sum=0; 7 | 8 | @Override 9 | public void run() { 10 | 11 | 12 | String name = Thread.currentThread().getName(); 13 | System.out.println(name+" is started"); 14 | 15 | for(int i=0;i<=20;i++) { 16 | sum+=i; 17 | } 18 | System.out.println("Sum is "+sum); 19 | System.out.println(name+" thread is ended"); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/bin/com/question_1/DeadLock.txt: -------------------------------------------------------------------------------- 1 | 2 | Question1: - Explain the meaning of the deadlock in multithreaded application, when it can occur in 3 | multithreading applications 4 | 5 | Answer: When two and more threads are waiting for each other that situation is known as Deadlock. 6 | For Deadlock synchronized keyword is responsible. 7 | For Deadlock there is no any solution but there are several preventions. 8 | 9 | Example: Refer to Classes. -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/src/com/question_1/DeadLock.txt: -------------------------------------------------------------------------------- 1 | 2 | Question1: - Explain the meaning of the deadlock in multithreaded application, when it can occur in 3 | multithreading applications 4 | 5 | Answer: When two and more threads are waiting for each other that situation is known as Deadlock. 6 | For Deadlock synchronized keyword is responsible. 7 | For Deadlock there is no any solution but there are several preventions. 8 | 9 | Example: Refer to Classes. -------------------------------------------------------------------------------- /JA111 C4Evaluation/src/com/question_4/Main.java: -------------------------------------------------------------------------------- 1 | package com.question_4; 2 | 3 | public class Main { 4 | 5 | public static void main(String[] args) { 6 | 7 | Ecommerce ecom = new Ecommerce(); 8 | 9 | ecom.addToProductList(new Product("Rakesh Kumar", 35244, "apple", 2)); 10 | ecom.addToProductList(new Product("Rakesh Kumar", 35244, "apple", 2)); 11 | ecom.addToProductList(new Product("Anand Singh Yadav", 45123, "nokia", 3)); 12 | ecom.showAllProduct(); 13 | 14 | 15 | } 16 | 17 | 18 | 19 | 20 | 21 | } 22 | -------------------------------------------------------------------------------- /JA111 C4Evaluation/src/com/question_3/Main.java: -------------------------------------------------------------------------------- 1 | package com.question_3; 2 | 3 | import java.util.Set; 4 | import java.util.TreeSet; 5 | 6 | public class Main { 7 | 8 | public static void main(String[] args) { 9 | 10 | 11 | Set stu = new TreeSet<>(new StudentComp()); 12 | stu.add(new Student(3, "anand", 30, 20, 50)); 13 | stu.add(new Student(2, "pnand", 20, 50, 30)); 14 | stu.add(new Student(4, "anand", 30, 20, 50)); 15 | stu.add(new Student(5, "anand", 30, 20, 50)); 16 | 17 | System.out.println(stu); 18 | 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/src/com/question_4/Main.java: -------------------------------------------------------------------------------- 1 | package com.question_4; 2 | 3 | public class Main { 4 | 5 | public static void main(String[] args) { 6 | 7 | 8 | ThreadB dhoni = new ThreadB(); 9 | ThreadC rohit = new ThreadC(dhoni); 10 | ThreadA kohli = new ThreadA(rohit); 11 | 12 | 13 | kohli.setName("Kohli"); 14 | dhoni.setName("Dhoni"); 15 | rohit.setName("Rohit"); 16 | 17 | dhoni.setPriority(10); 18 | 19 | kohli.start(); 20 | dhoni.start(); 21 | rohit.start(); 22 | 23 | 24 | 25 | 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/src/com/question_2/Main.java: -------------------------------------------------------------------------------- 1 | package com.question_2; 2 | 3 | public class Main { 4 | 5 | public static void main(String[] args){ 6 | 7 | ThreadA a = new ThreadA(); 8 | 9 | Thread t = new Thread(a); 10 | 11 | t.start(); 12 | 13 | synchronized (a) { 14 | try { 15 | a.wait(); 16 | System.out.println("Product from 1 to 10 is: "+a.product); 17 | } catch (InterruptedException e) { 18 | // TODO Auto-generated catch block 19 | e.printStackTrace(); 20 | } 21 | 22 | 23 | } 24 | 25 | 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /JA111 C4Evaluation/src/com/question_1/Library.java: -------------------------------------------------------------------------------- 1 | package com.question_1; 2 | 3 | import java.util.*; 4 | 5 | 6 | public class Library { 7 | 8 | public static void main(String[] args) { 9 | 10 | Set booksCollection = new HashSet<>(); 11 | 12 | booksCollection.add(new Book(1,"Name1","Author1")); 13 | booksCollection.add(new Book(2,"Name2","Author1")); 14 | booksCollection.add(new Book(3,"Name1","Author1")); 15 | booksCollection.add(new Book(1,"Name4","Author2")); 16 | 17 | for(Book b: booksCollection) { 18 | System.out.println(b); 19 | } 20 | 21 | 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /SB101_C1_EVALUATION/src/com/question_3/Demo.java: -------------------------------------------------------------------------------- 1 | package com.question_3; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | 6 | public class Demo { 7 | 8 | public static void doTransaction(List list) { 9 | for(Payment p : list) { 10 | p.doPayment(); 11 | } 12 | } 13 | 14 | public static void main(String[] args) { 15 | List list1 = Arrays.asList(new CashPayment(8000),new CashPayment(7000)); 16 | List list2 = Arrays.asList(new CardPayment(6000),new CardPayment(9000)); 17 | doTransaction(list1); // for CashPayment 18 | doTransaction(list2); // for CardPayment 19 | 20 | 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/src/com/question_3/MyCallable.java: -------------------------------------------------------------------------------- 1 | package com.question_3; 2 | 3 | import java.util.concurrent.Callable; 4 | 5 | public class MyCallable implements Callable{ 6 | 7 | 8 | int num; 9 | 10 | public MyCallable(int n) { 11 | // TODO Auto-generated constructor stub 12 | this.num=n; 13 | } 14 | 15 | 16 | @Override 17 | public Object call() throws Exception { 18 | System.out.println(Thread.currentThread().getName()+" is findding Product of first "+num+" numbers"); 19 | 20 | long product =1; 21 | 22 | for(int i=1;i<=num;i++) { 23 | product*=i; 24 | } 25 | 26 | return product; 27 | 28 | } 29 | 30 | 31 | 32 | } 33 | -------------------------------------------------------------------------------- /JA111 C2Evaluation/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.release=enabled 12 | org.eclipse.jdt.core.compiler.source=1.8 13 | -------------------------------------------------------------------------------- /JA111 C4Evaluation/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.release=enabled 12 | org.eclipse.jdt.core.compiler.source=1.8 13 | -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/src/com/question_4/ThreadA.java: -------------------------------------------------------------------------------- 1 | package com.question_4; 2 | 3 | public class ThreadA extends Thread { 4 | 5 | ThreadC c; 6 | 7 | public ThreadA(ThreadC ob) { 8 | // TODO Auto-generated constructor stub 9 | this.c = ob; 10 | } 11 | 12 | // kohli Thread 13 | @Override 14 | public void run() { 15 | 16 | try { 17 | c.join(); 18 | } catch (InterruptedException e) { 19 | // TODO Auto-generated catch block 20 | e.printStackTrace(); 21 | } 22 | 23 | String name = Thread.currentThread().getName(); 24 | System.out.println(name+" thread is stated"); 25 | for(int i=1;i<=10;i++) { 26 | System.out.println(name+" is running "+i); 27 | } 28 | System.out.println(name+" is ended"); 29 | } 30 | 31 | 32 | } 33 | -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/src/com/question_4/ThreadC.java: -------------------------------------------------------------------------------- 1 | package com.question_4; 2 | 3 | public class ThreadC extends Thread{ 4 | ThreadB b; 5 | 6 | public ThreadC(ThreadB ob) { 7 | // TODO Auto-generated constructor stub 8 | this.b = ob; 9 | } 10 | int product =1; 11 | 12 | @Override 13 | public void run() { 14 | 15 | try { 16 | b.join(); 17 | } catch (InterruptedException e) { 18 | // TODO Auto-generated catch block 19 | e.printStackTrace(); 20 | } 21 | String name = Thread.currentThread().getName(); 22 | 23 | System.out.println(name+" thread is started."); 24 | for(int i=1;i<=10;i++) { 25 | product*=i; 26 | } 27 | System.out.println("Product is "+product); 28 | System.out.println(name+" is ended."); 29 | 30 | } 31 | 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /JA111 C3Evaluation/src/com/question_4/Main.java: -------------------------------------------------------------------------------- 1 | package com.question_4; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Main { 6 | 7 | public static void main(String[] args) { 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.println("Enter the String =>"); 12 | String string = sc.nextLine(); 13 | 14 | System.out.println("Enter the position =>"); 15 | int position = Integer.parseInt(sc.nextLine()); 16 | 17 | while(true) { 18 | if(position>string.length()) { 19 | System.out.println("Invalid Position, Please enter a valid position =>"); 20 | position = Integer.parseInt(sc.nextLine()); 21 | } 22 | else { 23 | char ch = string.charAt(position-1); 24 | System.out.println("Character at the position "+position+" =>"+" "+ch); 25 | break; 26 | } 27 | } 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /JA111 C3Evaluation/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=12 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=12 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled 11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 12 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning 13 | org.eclipse.jdt.core.compiler.release=enabled 14 | org.eclipse.jdt.core.compiler.source=12 15 | -------------------------------------------------------------------------------- /SB101_C1_EVALUATION/src/com/quesiton_4/Main.java: -------------------------------------------------------------------------------- 1 | package com.quesiton_4; 2 | 3 | public class Main { 4 | 5 | public static void main(String args[]) 6 | { 7 | try 8 | { 9 | System.out.print("A"); 10 | int num = 99/0; 11 | System.out.print("B"); 12 | } 13 | catch(ArithmeticException ex) 14 | { 15 | System.out.print("C"); 16 | } 17 | catch(Exception ex) 18 | { 19 | System.out.print("D"); 20 | } 21 | System.out.print("E"); 22 | } 23 | 24 | /*Reason: Inside First try block It will print A then at line no:10 will throw Arithmetic Exception 25 | * so after line no: 10 nothing will be printed. It will go directly to Arithmetic catch block and print 26 | * C then It won't go to Exception catch as there is no such Exception happening. Then It will go out 27 | * and print E so the final Output is : ACE 28 | */ 29 | 30 | } 31 | -------------------------------------------------------------------------------- /SB101_C1_EVALUATION/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=17 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled 11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 12 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning 13 | org.eclipse.jdt.core.compiler.release=enabled 14 | org.eclipse.jdt.core.compiler.source=17 15 | -------------------------------------------------------------------------------- /SB101_C2_EVALUATION/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=17 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled 11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 12 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning 13 | org.eclipse.jdt.core.compiler.release=enabled 14 | org.eclipse.jdt.core.compiler.source=17 15 | -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=17 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled 11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 12 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning 13 | org.eclipse.jdt.core.compiler.release=enabled 14 | org.eclipse.jdt.core.compiler.source=17 15 | -------------------------------------------------------------------------------- /Sort_HashMapBy_Key_and_Value/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=17 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled 11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 12 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning 13 | org.eclipse.jdt.core.compiler.release=enabled 14 | org.eclipse.jdt.core.compiler.source=17 15 | -------------------------------------------------------------------------------- /JA111 C4Evaluation/src/com/question_3/StudentComp.java: -------------------------------------------------------------------------------- 1 | package com.question_3; 2 | 3 | import java.util.Comparator; 4 | 5 | public class StudentComp implements Comparator{ 6 | @Override 7 | public int compare(Student o1, Student o2) { 8 | 9 | int total1 = o1.getEngMarks()+o1.getMathsMarks()+o1.getScienceMarks(); 10 | int total2 = o2.getEngMarks()+o2.getMathsMarks()+o2.getScienceMarks(); 11 | if(total1==total2) { 12 | if(o1.getName().equalsIgnoreCase(o2.getName())) { 13 | return o1.getRollNo()-o2.getRollNo(); 14 | } 15 | else { 16 | return -1*(o1.getName().compareTo(o2.getName())); // decending order 17 | } 18 | 19 | } 20 | else if(total1>total2) { 21 | return 1; 22 | } 23 | else { 24 | return -1; 25 | } 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/src/com/question_3/Demo.java: -------------------------------------------------------------------------------- 1 | package com.question_3; 2 | 3 | import java.util.concurrent.ExecutionException; 4 | import java.util.concurrent.ExecutorService; 5 | import java.util.concurrent.Executors; 6 | import java.util.concurrent.Future; 7 | 8 | public class Demo { 9 | 10 | public static void main(String[] args) throws InterruptedException, ExecutionException { 11 | 12 | MyCallable [] jobs = { 13 | new MyCallable(5), 14 | new MyCallable(10), 15 | new MyCallable(15), 16 | new MyCallable(20), 17 | new MyCallable(25), 18 | 19 | }; 20 | 21 | ExecutorService service = Executors.newFixedThreadPool(3); 22 | 23 | for(MyCallable c: jobs) { 24 | Future ans = service.submit(c); 25 | 26 | System.out.println(ans.get()); 27 | } 28 | 29 | service.shutdown(); 30 | 31 | 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /Sort_HashMapBy_Key_and_Value/src/com/practice/Student.java: -------------------------------------------------------------------------------- 1 | package com.practice; 2 | 3 | public class Student { 4 | private Integer rollNo; 5 | private String name; 6 | private Integer marks; 7 | 8 | public Student() { 9 | // TODO Auto-generated constructor stub 10 | } 11 | 12 | public Student(Integer rollNo, String name, Integer marks) { 13 | super(); 14 | this.rollNo = rollNo; 15 | this.name = name; 16 | this.marks = marks; 17 | } 18 | 19 | public Integer getRollNo() { 20 | return rollNo; 21 | } 22 | 23 | public void setRollNo(Integer rollNo) { 24 | this.rollNo = rollNo; 25 | } 26 | 27 | public String getName() { 28 | return name; 29 | } 30 | 31 | public void setName(String name) { 32 | this.name = name; 33 | } 34 | 35 | public Integer getMarks() { 36 | return marks; 37 | } 38 | 39 | public void setMarks(Integer marks) { 40 | this.marks = marks; 41 | } 42 | 43 | 44 | } 45 | -------------------------------------------------------------------------------- /JA111 C3Evaluation/src/com/question_3/Main.java: -------------------------------------------------------------------------------- 1 | package com.question_3; 2 | 3 | public class Main { 4 | 5 | public static void maessageToStudents(Evaluation evaluation) { 6 | 7 | if(evaluation instanceof DsaEvaluation) { 8 | System.out.println("Its a DSA Evaluation."); 9 | evaluation.printNoOfQuestions(); 10 | evaluation.evaluationTiming(); 11 | System.out.println("=================================="); 12 | } 13 | if(evaluation instanceof CodingEvaluation) { 14 | System.out.println("Its a Coding Evaluation"); 15 | evaluation.printNoOfQuestions(); 16 | evaluation.evaluationTiming(); 17 | System.out.println("================================="); 18 | } 19 | 20 | } 21 | 22 | public static void main(String[] args) { 23 | maessageToStudents(new DsaEvaluation(5)); 24 | maessageToStudents(new CodingEvaluation(4)); 25 | 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /SB101_C2_EVALUATION/src/com/question_4/Main.java: -------------------------------------------------------------------------------- 1 | package com.question_4; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | import java.util.stream.Collectors; 6 | 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | 11 | List names = Arrays.asList("deepak","Vikash","kunal","ram","anand","prakash","chanchal","sunil","pankaj","sita"); 12 | System.out.println("Before Transformation"); 13 | System.out.println("---------------------------"); 14 | names.forEach(System.out::println); 15 | System.out.println("==========================="); 16 | List transformedName = names.stream().filter(i->i.length()%2==0).map(i->i.toUpperCase()).sorted((n1,n2)->n2.compareTo(n1)).collect(Collectors.toList()); 17 | System.out.println("After Transformation"); 18 | System.out.println("----------------------------"); 19 | transformedName.forEach(System.out::println); 20 | 21 | 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /JA111 C2Evaluation/src/com/question_2/Student.java: -------------------------------------------------------------------------------- 1 | package com.question_2; 2 | 3 | public class Student { 4 | private int rollNumber; 5 | private String studentName; 6 | private int marks; 7 | 8 | public Student() { 9 | // TODO Auto-generated constructor stub 10 | } 11 | 12 | public Student(int rollNumber, String studentName, int marks) { 13 | super(); 14 | this.rollNumber = rollNumber; 15 | this.studentName = studentName; 16 | this.marks = marks; 17 | } 18 | 19 | public int getRollNumber() { 20 | return rollNumber; 21 | } 22 | 23 | public void setRollNumber(int rollNumber) { 24 | this.rollNumber = rollNumber; 25 | } 26 | 27 | public String getStudentName() { 28 | return studentName; 29 | } 30 | 31 | public void setStudentName(String studentName) { 32 | this.studentName = studentName; 33 | } 34 | 35 | public int getMarks() { 36 | return marks; 37 | } 38 | 39 | public void setMarks(int marks) { 40 | this.marks = marks; 41 | } 42 | 43 | 44 | } 45 | -------------------------------------------------------------------------------- /JA111 C4Evaluation/src/com/question_4/Ecommerce.java: -------------------------------------------------------------------------------- 1 | package com.question_4; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | public class Ecommerce { 7 | 8 | static List productList = new ArrayList<>(); 9 | 10 | public void addToProductList(Product product) { 11 | int count=0; 12 | for(Product pro : productList) { 13 | if(pro.getCompany().equalsIgnoreCase(product.getCompany())&&pro.getName().equalsIgnoreCase(product.getName())&&pro.getPrice()==product.getPrice()) { 14 | pro.setCount(product.getCount()+1); 15 | System.out.println("Count updated Product already exists"); 16 | count=1; 17 | } 18 | } 19 | if(count==0) { 20 | productList.add(product); 21 | System.out.println("Product is added successfully"); 22 | } 23 | 24 | } 25 | 26 | public void showAllProduct() { 27 | for(Product pro : productList) { 28 | System.out.println(pro); 29 | System.out.println("-----------------"); 30 | } 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /JA111 C3Evaluation/src/com/question_1/Student.java: -------------------------------------------------------------------------------- 1 | package com.question_1; 2 | 3 | public class Student { 4 | 5 | private int roll; 6 | private String name; 7 | private int marks; 8 | 9 | public Student() { 10 | // TODO Auto-generated constructor stub 11 | } 12 | 13 | public Student(int roll, String name, int marks) { 14 | super(); 15 | this.roll = roll; 16 | this.name = name; 17 | this.marks = marks; 18 | } 19 | 20 | public int getRoll() { 21 | return roll; 22 | } 23 | 24 | public void setRoll(int roll) { 25 | this.roll = roll; 26 | } 27 | 28 | public String getName() { 29 | return name; 30 | } 31 | 32 | public void setName(String name) { 33 | this.name = name; 34 | } 35 | 36 | public int getMarks() { 37 | return marks; 38 | } 39 | 40 | public void setMarks(int marks) { 41 | this.marks = marks; 42 | } 43 | 44 | @Override 45 | public String toString() { 46 | return "Student [roll=" + roll + ", name=" + name + ", marks=" + marks + "]"; 47 | } 48 | 49 | 50 | 51 | 52 | 53 | } 54 | -------------------------------------------------------------------------------- /JA111 C2Evaluation/src/com/question_4/GraphicCard.java: -------------------------------------------------------------------------------- 1 | package com.question_4; 2 | 3 | public class GraphicCard { 4 | 5 | private String manufacturer; 6 | private String capacity; 7 | private String series; 8 | 9 | public GraphicCard() { 10 | // TODO Auto-generated constructor stub 11 | } 12 | 13 | public GraphicCard(String manufacturer, String capacity, String series) { 14 | super(); 15 | this.manufacturer = manufacturer; 16 | this.capacity = capacity; 17 | this.series = series; 18 | } 19 | 20 | public String getManufacturer() { 21 | return manufacturer; 22 | } 23 | 24 | public void setManufacturer(String manufacturer) { 25 | this.manufacturer = manufacturer; 26 | } 27 | 28 | public String getCapacity() { 29 | return capacity; 30 | } 31 | 32 | public void setCapacity(String capacity) { 33 | this.capacity = capacity; 34 | } 35 | 36 | public String getSeries() { 37 | return series; 38 | } 39 | 40 | public void setSeries(String series) { 41 | this.series = series; 42 | } 43 | 44 | 45 | 46 | 47 | } 48 | -------------------------------------------------------------------------------- /Java Boiler Code.txt: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | import java.io.*; 3 | class Main{ 4 | static class FastReader //ankush has created this class. // own class 5 | { 6 | BufferedReader br; 7 | StringTokenizer st; 8 | public FastReader() 9 | { 10 | br = new BufferedReader(new InputStreamReader(System.in)); 11 | } 12 | String next() 13 | { 14 | while (st == null || !st.hasMoreElements()){ 15 | try { st = new StringTokenizer(br.readLine()); } 16 | catch (IOException e) { e.printStackTrace(); } 17 | } 18 | return st.nextToken(); 19 | } 20 | int nextInt() { return Integer.parseInt(next()); } 21 | long nextLong() { return Long.parseLong(next()); } 22 | double nextDouble(){ return Double.parseDouble(next()); } 23 | String nextLine(){ 24 | String str = ""; 25 | try { str = br.readLine(); } 26 | catch (IOException e) { e.printStackTrace(); } 27 | return str; 28 | } 29 | } 30 | public static void main(String[] args){ 31 | 32 | 33 | } 34 | } -------------------------------------------------------------------------------- /JA111 C2Evaluation/src/com/question_4/CPU.java: -------------------------------------------------------------------------------- 1 | package com.question_4; 2 | 3 | public class CPU { 4 | 5 | private String manufacturer; 6 | private String processor; 7 | private double clockSpeed; 8 | 9 | public CPU() { 10 | // TODO Auto-generated constructor stub 11 | } 12 | 13 | public CPU(String manufacturer, String processor, double clockSpeed) { 14 | super(); 15 | this.manufacturer = manufacturer; 16 | this.processor = processor; 17 | this.clockSpeed = clockSpeed; 18 | } 19 | 20 | public String getManufacturer() { 21 | return manufacturer; 22 | } 23 | 24 | public void setManufacturer(String manufacturer) { 25 | this.manufacturer = manufacturer; 26 | } 27 | 28 | public String getProcessor() { 29 | return processor; 30 | } 31 | 32 | public void setProcessor(String processor) { 33 | this.processor = processor; 34 | } 35 | 36 | public double getClockSpeed() { 37 | return clockSpeed; 38 | } 39 | 40 | public void setClockSpeed(double clockSpeed) { 41 | this.clockSpeed = clockSpeed; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /SB101_C1_EVALUATION/src/com/question_1/Employee.java: -------------------------------------------------------------------------------- 1 | package com.question_1; 2 | 3 | public class Employee { 4 | 5 | private Integer empId; 6 | private String name; 7 | private long salary; 8 | 9 | public Employee() { 10 | // TODO Auto-generated constructor stub 11 | } 12 | 13 | public Employee(Integer empId, String name, long salary) { 14 | super(); 15 | this.empId = empId; 16 | this.name = name; 17 | this.salary = salary; 18 | } 19 | 20 | public Integer getEmpId() { 21 | return empId; 22 | } 23 | 24 | public void setEmpId(Integer empId) { 25 | this.empId = empId; 26 | } 27 | 28 | public String getName() { 29 | return name; 30 | } 31 | 32 | public void setName(String name) { 33 | this.name = name; 34 | } 35 | 36 | public long getSalary() { 37 | return salary; 38 | } 39 | 40 | public void setSalary(long salary) { 41 | this.salary = salary; 42 | } 43 | 44 | @Override 45 | public String toString() { 46 | return "Employee [empId=" + empId + ", name=" + name + ", salary=" + salary + "]"; 47 | } 48 | 49 | 50 | 51 | } 52 | -------------------------------------------------------------------------------- /JA111 C3Evaluation/src/com/question_6/ArtStudent.java: -------------------------------------------------------------------------------- 1 | package com.question_6; 2 | 3 | public class ArtStudent implements Student { 4 | 5 | private int hindi; 6 | private int english; 7 | private int history; 8 | 9 | public ArtStudent() { 10 | // TODO Auto-generated constructor stub 11 | } 12 | 13 | public ArtStudent(int hindi, int english, int history) { 14 | super(); 15 | this.hindi = hindi; 16 | this.english = english; 17 | this.history = history; 18 | } 19 | 20 | public int getHindi() { 21 | return hindi; 22 | } 23 | 24 | public void setHindi(int hindi) { 25 | this.hindi = hindi; 26 | } 27 | 28 | public int getEnglish() { 29 | return english; 30 | } 31 | 32 | public void setEnglish(int english) { 33 | this.english = english; 34 | } 35 | 36 | public int getHistory() { 37 | return history; 38 | } 39 | 40 | public void setHistory(int history) { 41 | this.history = history; 42 | } 43 | 44 | @Override 45 | public double findPercentage() { 46 | int total = english+hindi+history; 47 | return total/3; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /JA111 C3Evaluation/src/com/question_1/Employee.java: -------------------------------------------------------------------------------- 1 | package com.question_1; 2 | 3 | public class Employee { 4 | 5 | private int employeeId; 6 | private String name; 7 | private double salary; 8 | 9 | public Employee() { 10 | // TODO Auto-generated constructor stub 11 | } 12 | 13 | public Employee(int employeeId, String name, double salary) { 14 | super(); 15 | this.employeeId = employeeId; 16 | this.name = name; 17 | this.salary = salary; 18 | } 19 | 20 | public int getEmployeeId() { 21 | return employeeId; 22 | } 23 | 24 | public void setEmployeeId(int employeeId) { 25 | this.employeeId = employeeId; 26 | } 27 | 28 | public String getName() { 29 | return name; 30 | } 31 | 32 | public void setName(String name) { 33 | this.name = name; 34 | } 35 | 36 | public double getSalary() { 37 | return salary; 38 | } 39 | 40 | public void setSalary(double salary) { 41 | this.salary = salary; 42 | } 43 | 44 | @Override 45 | public String toString() { 46 | return "Employee [employeeId=" + employeeId + ", name=" + name + ", salary=" + salary + "]"; 47 | } 48 | 49 | 50 | } 51 | -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/src/com/question_5/Address.java: -------------------------------------------------------------------------------- 1 | package com.question_5; 2 | 3 | import java.io.Serializable; 4 | 5 | public class Address implements Serializable{ 6 | private String state; 7 | private String city; 8 | private String pincode; 9 | 10 | public Address() { 11 | // TODO Auto-generated constructor stub 12 | } 13 | 14 | public Address(String state, String city, String pincode) { 15 | super(); 16 | this.state = state; 17 | this.city = city; 18 | this.pincode = pincode; 19 | } 20 | 21 | public String getState() { 22 | return state; 23 | } 24 | 25 | public void setState(String state) { 26 | this.state = state; 27 | } 28 | 29 | public String getCity() { 30 | return city; 31 | } 32 | 33 | public void setCity(String city) { 34 | this.city = city; 35 | } 36 | 37 | public String getPincode() { 38 | return pincode; 39 | } 40 | 41 | public void setPincode(String pincode) { 42 | this.pincode = pincode; 43 | } 44 | 45 | @Override 46 | public String toString() { 47 | return "Address [state=" + state + ", city=" + city + ", pincode=" + pincode + "]"; 48 | } 49 | 50 | 51 | } 52 | -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/src/com/question_5/Main2.java: -------------------------------------------------------------------------------- 1 | package com.question_5; 2 | 3 | import java.io.FileInputStream; 4 | import java.io.IOException; 5 | import java.io.ObjectInputStream; 6 | import java.util.List; 7 | 8 | public class Main2 { 9 | // Desrialization 10 | 11 | public static void main(String[] args)throws IOException { 12 | 13 | 14 | ObjectInputStream ois = new ObjectInputStream(new FileInputStream("student.txt")); 15 | 16 | 17 | try { 18 | List ob = (List) ois.readObject(); 19 | 20 | ob.add(new Student(3, "raghav", 342, "ragahv@123", "raghav123", new Address("MP", "HPP", "478989"))); 21 | 22 | for(Student s: ob) { 23 | System.out.println(s.getName()); 24 | System.out.println(s.getAddress()); 25 | System.out.println(s.getPassword()); 26 | System.out.println("-------------------"); 27 | } 28 | 29 | 30 | } catch (ClassNotFoundException e) { 31 | // TODO Auto-generated catch block 32 | e.printStackTrace(); 33 | } catch (IOException e) { 34 | // TODO Auto-generated catch block 35 | e.printStackTrace(); 36 | } 37 | 38 | 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /SB101_C2_EVALUATION/src/com/question_3/Main.java: -------------------------------------------------------------------------------- 1 | package com.question_3; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.stream.Collectors; 6 | 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | 11 | List students = new ArrayList<>(); 12 | 13 | students.add(new Student(23, "Anand",540, "Noida")); 14 | students.add(new Student(11, "Prince", 280, "Delhi")); 15 | students.add(new Student(34, "Rakesh", 765, "Punjab")); 16 | students.add(new Student(78, "Suresh",236,"Haryana")); 17 | students.add(new Student(10, "Sita", 509, "Bihar")); 18 | 19 | students.forEach(System.out::println); 20 | System.out.println("===========After Updation=========="); 21 | List emList = students.stream().filter(i->i. 22 | getMarks()>500).map(i->new Employee(i.getRoll(), i.getName(), 23 | i.getMarks()*1000, i.getAddress())).collect(Collectors.toList()); 24 | emList.forEach(i->System.out.println(i)); 25 | } 26 | 27 | 28 | 29 | 30 | } 31 | -------------------------------------------------------------------------------- /JA111 C2Evaluation/src/com/question_2/Main.java: -------------------------------------------------------------------------------- 1 | package com.question_2; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Main { 6 | 7 | public static void main(String[] args) { 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.println("Enter Number of Student, Do you want to add: "); 12 | int number = Integer.parseInt(sc.nextLine()); 13 | int i=1; 14 | while(i<=number) { 15 | 16 | System.out.println("Enter Roll Number: "); 17 | int rollNumber = Integer.parseInt(sc.nextLine()); 18 | 19 | System.out.println("Enter Name: "); 20 | String name = sc.nextLine(); 21 | 22 | System.out.println("Enter Marks: "); 23 | int marks = Integer.parseInt(sc.nextLine()); 24 | 25 | Student s1 = new Student(rollNumber,name,marks); 26 | 27 | System.out.println("Student Detail: "+i); 28 | System.out.println("Student Roll Number: "+s1.getRollNumber()); 29 | System.out.println("Student Name: "+s1.getStudentName()); 30 | System.out.println("Student Marks: "+s1.getMarks()); 31 | System.out.println("=========================================="); 32 | i++; 33 | } 34 | 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /SB101_C2_EVALUATION/src/com/question_3/Student.java: -------------------------------------------------------------------------------- 1 | package com.question_3; 2 | 3 | public class Student { 4 | private Integer roll; 5 | private String name; 6 | private Integer marks; 7 | private String address; 8 | 9 | public Student() { 10 | // TODO Auto-generated constructor stub 11 | } 12 | 13 | public Student(Integer roll, String name, Integer marks, String address) { 14 | super(); 15 | this.roll = roll; 16 | this.name = name; 17 | this.marks = marks; 18 | this.address = address; 19 | } 20 | 21 | public Integer getRoll() { 22 | return roll; 23 | } 24 | 25 | public void setRoll(Integer roll) { 26 | this.roll = roll; 27 | } 28 | 29 | public String getName() { 30 | return name; 31 | } 32 | 33 | public void setName(String name) { 34 | this.name = name; 35 | } 36 | 37 | public Integer getMarks() { 38 | return marks; 39 | } 40 | 41 | public void setMarks(Integer marks) { 42 | this.marks = marks; 43 | } 44 | 45 | public String getAddress() { 46 | return address; 47 | } 48 | 49 | public void setAddress(String address) { 50 | this.address = address; 51 | } 52 | 53 | @Override 54 | public String toString() { 55 | return "Student [roll=" + roll + ", name=" + name + ", marks=" + marks + ", address=" + address + "]"; 56 | } 57 | 58 | 59 | 60 | } 61 | -------------------------------------------------------------------------------- /JA111 C3Evaluation/src/com/question_6/CommerceStudent.java: -------------------------------------------------------------------------------- 1 | package com.question_6; 2 | 3 | public class CommerceStudent implements Student{ 4 | 5 | private int accountMarks; 6 | private int economics; 7 | private int businessStudies; 8 | 9 | public CommerceStudent() { 10 | // TODO Auto-generated constructor stub 11 | } 12 | 13 | public CommerceStudent(int accountMarks, int economics, int businessStudies) { 14 | super(); 15 | this.accountMarks = accountMarks; 16 | this.economics = economics; 17 | this.businessStudies = businessStudies; 18 | } 19 | 20 | public int getAccountMarks() { 21 | return accountMarks; 22 | } 23 | 24 | 25 | public void setAccountMarks(int accountMarks) { 26 | this.accountMarks = accountMarks; 27 | } 28 | 29 | 30 | public int getEconomics() { 31 | return economics; 32 | } 33 | 34 | 35 | public void setEconomics(int economics) { 36 | this.economics = economics; 37 | } 38 | 39 | 40 | public int getBusinessStudies() { 41 | return businessStudies; 42 | } 43 | 44 | 45 | public void setBusinessStudies(int businessStudies) { 46 | this.businessStudies = businessStudies; 47 | } 48 | 49 | 50 | @Override 51 | public double findPercentage() { 52 | int total = accountMarks+businessStudies+economics; 53 | return total/3; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /JA111 C2Evaluation/src/com/question_3/Ticket.java: -------------------------------------------------------------------------------- 1 | package com.question_3; 2 | 3 | public class Ticket { 4 | 5 | private int ticketId; 6 | private int price; 7 | static int availableTickets; 8 | 9 | public Ticket() { 10 | // TODO Auto-generated constructor stub 11 | } 12 | 13 | 14 | 15 | public Ticket(int ticketId, int price) { 16 | super(); 17 | this.ticketId = ticketId; 18 | this.price = price; 19 | } 20 | 21 | 22 | 23 | public int getTicketId() { 24 | return ticketId; 25 | } 26 | 27 | 28 | 29 | public void setTicketId(int ticketId) { 30 | this.ticketId = ticketId; 31 | } 32 | 33 | 34 | 35 | public int getPrice() { 36 | return price; 37 | } 38 | 39 | 40 | 41 | public void setPrice(int price) { 42 | this.price = price; 43 | } 44 | 45 | 46 | 47 | public static int getAvailableTickets() { 48 | return availableTickets; 49 | } 50 | 51 | 52 | 53 | public static void setAvailableTickets(int availableTickets) { 54 | Ticket.availableTickets = availableTickets; 55 | } 56 | 57 | 58 | 59 | public int calculateTicketCost(int noOfTickets){ 60 | int cost; 61 | if(noOfTickets list = new ArrayList<>(); 17 | 18 | list.add(new Student(34, "anand", 459, "anand@gmail.com", "anand123", new Address("UP", "Noida", "201301"))); 19 | list.add(new Student(12, "prince", 259, "prince@gmail.com", "prince123", new Address("MP", "Bhopal", "458821"))); 20 | list.add(new Student(17, "rohit", 129, "rohit@gmail.com", "rohit123", new Address("Bihar", "Siwan", "200192"))); 21 | list.add(new Student(89, "bamlesh", 759, "bamlesh@gmail.com", "bamlesh123", new Address("Delhi", "Delhi", "41301"))); 22 | list.add(new Student(13, "deepak", 959, "deepak@gmail.com", "deepak123", new Address("Mumbai", "Andheri", "876721"))); 23 | 24 | 25 | ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("student.txt")); 26 | 27 | oos.writeObject(list); 28 | 29 | oos.close(); 30 | System.out.println("Serialization is done"); 31 | 32 | 33 | 34 | 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /JA111 C4Evaluation/src/com/question_1/Book.java: -------------------------------------------------------------------------------- 1 | package com.question_1; 2 | 3 | import java.util.Objects; 4 | 5 | public class Book { 6 | private Integer bookId; 7 | private String bookName; 8 | private String author; 9 | 10 | public Book() { 11 | // TODO Auto-generated constructor stub 12 | } 13 | 14 | public Book(Integer bookId, String bookName, String author) { 15 | super(); 16 | this.bookId = bookId; 17 | this.bookName = bookName; 18 | this.author = author; 19 | } 20 | 21 | public Integer getBookId() { 22 | return bookId; 23 | } 24 | 25 | public void setBookId(Integer bookId) { 26 | this.bookId = bookId; 27 | } 28 | 29 | public String getBookName() { 30 | return bookName; 31 | } 32 | 33 | public void setBookName(String bookName) { 34 | this.bookName = bookName; 35 | } 36 | 37 | public String getAuthor() { 38 | return author; 39 | } 40 | 41 | public void setAuthor(String author) { 42 | this.author = author; 43 | } 44 | 45 | @Override 46 | public String toString() { 47 | return "Book [bookId=" + bookId + ", bookName=" + bookName + ", author=" + author + "]"; 48 | } 49 | 50 | @Override 51 | public boolean equals(Object obj) { 52 | Book book1 = this; 53 | Book book2 =(Book)obj; 54 | 55 | return (book1.getBookId()==book2.bookId); 56 | 57 | } 58 | 59 | @Override 60 | public int hashCode() { 61 | return Objects.hash(bookId); 62 | } 63 | 64 | 65 | } 66 | -------------------------------------------------------------------------------- /JA111 C2Evaluation/src/com/question_5/Main.java: -------------------------------------------------------------------------------- 1 | package com.question_5; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Main { 6 | 7 | 8 | public static void main(String[] args) { 9 | 10 | 11 | Scanner id = new Scanner(System.in); 12 | 13 | System.out.println("Enter Id:"); 14 | int employeedId = id.nextInt(); 15 | 16 | System.out.println("Enter Name:"); 17 | String employeeName = id.next(); 18 | 19 | id.nextLine(); 20 | 21 | System.out.println("Enter Salary:"); 22 | double salary = id.nextDouble(); 23 | 24 | System.out.println("Enter PF"); 25 | int pfPercentage = id.nextInt(); 26 | 27 | 28 | Employee E1 = new Employee(); 29 | 30 | E1.setEmployeedId(employeedId); 31 | E1.setEmployeeName(employeeName); 32 | E1.setSalary(salary); 33 | 34 | // int pf = Employee.getPFPercentage(pfPercentage); 35 | E1.calculateNetSalary(pfPercentage); 36 | 37 | System.out.println("------------------------------------"); 38 | 39 | System.out.println("===Employee Details=========="); 40 | System.out.println("------------------------------------"); 41 | 42 | System.out.println("Id :"+E1.getEmployeedId()); 43 | System.out.println("Name :"+E1.getEmployeeName()); 44 | System.out.println("Salary :"+E1.getSalary()); 45 | System.out.println("netSalary :"+E1.getNetSalary()); 46 | System.out.println("Net pf Percentage is:"+Employee.getPFPercentage(E1)); 47 | 48 | 49 | id.close(); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /JA111 C3Evaluation/src/com/question_1/Main.java: -------------------------------------------------------------------------------- 1 | package com.question_1; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Main { 6 | 7 | 8 | public static Object[] changeArray(Object[] obj) { 9 | int index =0; 10 | for(Object ob : obj) { 11 | if(ob instanceof Student) { 12 | Student student = (Student)ob; 13 | student.setMarks(student.getMarks()+10); 14 | } 15 | else if(ob instanceof Employee) { 16 | Employee employee = (Employee)ob; 17 | employee.setSalary(employee.getSalary()+10000); 18 | } 19 | else if(ob instanceof String) { 20 | String string = (String)ob; 21 | StringBuilder sb = new StringBuilder(string); 22 | sb.reverse(); 23 | obj[index]=sb; 24 | } 25 | else if(ob instanceof Integer) { 26 | Integer integer = (Integer)ob; 27 | obj[index] = integer+ 20; 28 | } 29 | index++; 30 | } 31 | return obj; 32 | 33 | } 34 | 35 | 36 | public static void main(String[] args) { 37 | 38 | Object[] obj = {new Student(23, "Rakesh", 450),new Employee(12, "Lokesh", 84000),"String",50}; 39 | 40 | System.out.println("Before updating...."); 41 | for(Object ob : obj) { 42 | System.out.println(ob); 43 | } 44 | 45 | Object[] object = changeArray(obj); 46 | 47 | // for printing 48 | System.out.println("After updating...."); 49 | for(Object ob : object) { 50 | System.out.println(ob); 51 | } 52 | 53 | } 54 | 55 | 56 | } 57 | -------------------------------------------------------------------------------- /JA111 C2Evaluation/src/com/question_3/Main.java: -------------------------------------------------------------------------------- 1 | package com.question_3; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Main { 6 | 7 | public static void main(String[] args) { 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.println("Enter no of bookings: "); 12 | int booking = Integer.parseInt(sc.nextLine()); 13 | 14 | System.out.println("Enter the available tickets: "); 15 | int availableTickets = Integer.parseInt(sc.nextLine()); 16 | Ticket.setAvailableTickets(availableTickets); 17 | 18 | while(booking>0) { 19 | System.out.println("Enter the ticketsId: "); 20 | int ticketId = Integer.parseInt(sc.nextLine()); 21 | System.out.println("Enter the price: "); 22 | int price = Integer.parseInt(sc.nextLine()); 23 | System.out.println("Enter the no of tickets: "); 24 | int noOfTickets = Integer.parseInt(sc.nextLine()); 25 | 26 | Ticket t1 = new Ticket(ticketId, price); 27 | System.out.println("Available Tickets: "+t1.getAvailableTickets()); 28 | int totalCost = t1.calculateTicketCost(noOfTickets); 29 | if(totalCost!=-1) { 30 | System.out.println("Total Amounts: "+totalCost); 31 | System.out.println("Available Tickets after Bookings: "+t1.getAvailableTickets()); 32 | System.out.println("================================================"); 33 | } 34 | else { 35 | System.out.println("Enter Tickets less thank Equals to Available Tickets."); 36 | } 37 | booking--; 38 | 39 | 40 | } 41 | System.out.println("Thank you for booking......"); 42 | 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /JA111 C4Evaluation/src/com/question_5/Main.java: -------------------------------------------------------------------------------- 1 | package com.question_5; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collections; 5 | import java.util.LinkedHashSet; 6 | import java.util.List; 7 | import java.util.Set; 8 | 9 | public class Main { 10 | 11 | public static void main(String[] args) { 12 | 13 | String string = "hello Hello HEllo hi hi: hi! Welcome, welcome"; 14 | 15 | char[] str = string.toCharArray(); 16 | 17 | List Clist = new ArrayList<>(); 18 | 19 | List list = new ArrayList<>(); 20 | 21 | for(Character s:str) { 22 | if(s==','||s=='!'||s=='?'||s=='.'||s==':') { 23 | continue; 24 | } 25 | Clist.add(s); 26 | 27 | } 28 | 29 | 30 | // print 31 | String temp =""; 32 | for(Character s: Clist) { 33 | if(s==' ') { 34 | list.add(temp.toLowerCase()); 35 | temp=""; 36 | continue; 37 | } 38 | temp +=s; 39 | } 40 | 41 | list.add(temp.toLowerCase()); 42 | 43 | Collections.sort(list); 44 | 45 | System.out.println(list); 46 | 47 | int total = list.size(); 48 | 49 | Set set = new LinkedHashSet<>(list); 50 | 51 | int i=1; 52 | for(String s: set) { 53 | System.out.print(" "+i+". "+s); 54 | i++; 55 | } 56 | System.out.println(); 57 | 58 | int uniqueWords = set.size(); 59 | 60 | System.out.println("Totol Words: "+total+" Unique Words: "+uniqueWords); 61 | 62 | 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /SB101_C2_EVALUATION/src/com/question_1/Book.java: -------------------------------------------------------------------------------- 1 | package com.question_1; 2 | 3 | import java.util.Objects; 4 | 5 | public class Book { 6 | private Integer isbn; 7 | private String bookName; 8 | private String author; 9 | 10 | public Book() { 11 | // TODO Auto-generated constructor stub 12 | } 13 | 14 | public Book(Integer isbn, String bookName, String author) { 15 | super(); 16 | this.isbn = isbn; 17 | this.bookName = bookName; 18 | this.author = author; 19 | } 20 | 21 | 22 | 23 | @Override 24 | public int hashCode() { 25 | return Objects.hash(author, bookName, isbn); 26 | } 27 | 28 | @Override 29 | public boolean equals(Object obj) { 30 | if (this == obj) 31 | return true; 32 | if (obj == null) 33 | return false; 34 | if (getClass() != obj.getClass()) 35 | return false; 36 | Book other = (Book) obj; 37 | return author.equalsIgnoreCase(other.author)&&isbn==other.isbn&&bookName.equalsIgnoreCase(other.getBookName()); 38 | } 39 | 40 | public Integer getIsbn() { 41 | return isbn; 42 | } 43 | 44 | public void setIsbn(Integer isbn) { 45 | this.isbn = isbn; 46 | } 47 | 48 | public String getBookName() { 49 | return bookName; 50 | } 51 | 52 | public void setBookName(String bookName) { 53 | this.bookName = bookName; 54 | } 55 | 56 | public String getAuthor() { 57 | return author; 58 | } 59 | 60 | public void setAuthor(String author) { 61 | this.author = author; 62 | } 63 | 64 | @Override 65 | public String toString() { 66 | return "Book [isbn=" + isbn + ", bookName=" + bookName + ", author=" + author + "]"; 67 | } 68 | 69 | 70 | 71 | } 72 | -------------------------------------------------------------------------------- /JA111 C4Evaluation/src/com/question_3/Student.java: -------------------------------------------------------------------------------- 1 | package com.question_3; 2 | 3 | public class Student { 4 | 5 | private Integer rollNo; 6 | private String name; 7 | private Integer mathsMarks; 8 | private Integer scienceMarks; 9 | private Integer engMarks; 10 | 11 | public Student() { 12 | // TODO Auto-generated constructor stub 13 | } 14 | 15 | public Student(Integer rollNo, String name, Integer mathsMarks, Integer scienceMarks, Integer engMarks) { 16 | super(); 17 | this.rollNo = rollNo; 18 | this.name = name; 19 | this.mathsMarks = mathsMarks; 20 | this.scienceMarks = scienceMarks; 21 | this.engMarks = engMarks; 22 | } 23 | 24 | public Integer getRollNo() { 25 | return rollNo; 26 | } 27 | 28 | public void setRollNo(Integer rollNo) { 29 | this.rollNo = rollNo; 30 | } 31 | 32 | public String getName() { 33 | return name; 34 | } 35 | 36 | public void setName(String name) { 37 | this.name = name; 38 | } 39 | 40 | public Integer getMathsMarks() { 41 | return mathsMarks; 42 | } 43 | 44 | public void setMathsMarks(Integer mathsMarks) { 45 | this.mathsMarks = mathsMarks; 46 | } 47 | 48 | public Integer getScienceMarks() { 49 | return scienceMarks; 50 | } 51 | 52 | public void setScienceMarks(Integer scienceMarks) { 53 | this.scienceMarks = scienceMarks; 54 | } 55 | 56 | public Integer getEngMarks() { 57 | return engMarks; 58 | } 59 | 60 | public void setEngMarks(Integer engMarks) { 61 | this.engMarks = engMarks; 62 | } 63 | 64 | @Override 65 | public String toString() { 66 | return "Student [rollNo=" + rollNo + ", name=" + name + ", mathsMarks=" + mathsMarks + ", scienceMarks=" 67 | + scienceMarks + ", engMarks=" + engMarks + "]"; 68 | } 69 | 70 | 71 | 72 | } 73 | -------------------------------------------------------------------------------- /Sort_HashMapBy_Key_and_Value/src/com/practice/SortByKey.java: -------------------------------------------------------------------------------- 1 | package com.practice; 2 | 3 | import java.util.Comparator; 4 | import java.util.HashMap; 5 | import java.util.LinkedHashMap; 6 | import java.util.Map; 7 | import java.util.Set; 8 | import java.util.TreeSet; 9 | 10 | public class SortByKey { 11 | 12 | public static void main(String[] args) { 13 | 14 | HashMap map = new HashMap<>(); 15 | 16 | map.put(new Student(23, "Mohit", 120),"Delhi"); 17 | map.put(new Student(12, "Sita", 120),"Noida"); 18 | map.put(new Student(89, "Sunil", 789),"Kanpur"); 19 | map.put(new Student(19, "Bamlesh", 489),"Banaras"); 20 | map.put(new Student(90, ",Rakesh", 280),"Bihar"); 21 | 22 | 23 | Set> set = map.entrySet(); 24 | 25 | Comparator> stuC = (s1,s2)->{ 26 | return s1.getKey().getMarks()>s2.getKey().getMarks()?1:-1; 27 | }; 28 | 29 | Set> sortedSet= new TreeSet<>(stuC); 30 | sortedSet.addAll(set); 31 | 32 | LinkedHashMap finalMap = new LinkedHashMap<>(); 33 | 34 | for(Map.Entry s: sortedSet) { 35 | finalMap.put(s.getKey(), s.getValue()); 36 | } 37 | 38 | 39 | 40 | for(Map.Entry m : finalMap.entrySet()) { 41 | 42 | System.out.println("Student is from: "+m.getValue()); 43 | Student stu = m.getKey(); 44 | 45 | System.out.println("Student Name: "+stu.getName()); 46 | System.out.println("Student RollNo: "+stu.getRollNo()); 47 | System.out.println("Student Marks: "+stu.getMarks()); 48 | System.out.println("------------------------------------"); 49 | } 50 | 51 | 52 | 53 | } 54 | 55 | 56 | 57 | } 58 | -------------------------------------------------------------------------------- /SB101_C2_EVALUATION/src/com/question_1/Library.java: -------------------------------------------------------------------------------- 1 | package com.question_1; 2 | 3 | import java.util.ArrayList; 4 | import java.util.LinkedHashSet; 5 | import java.util.List; 6 | import java.util.Set; 7 | 8 | 9 | public class Library { 10 | 11 | static Set bookSet = new LinkedHashSet<>(); 12 | 13 | public void addBook(Book book)throws BookException{ 14 | if(bookSet.add(book)==false) { 15 | throw new BookException(book.getBookName()+" Book is Already exist."); 16 | }else { 17 | bookSet.add(book); 18 | System.out.println("Book added Successfully"); 19 | } 20 | } 21 | 22 | public List viewAllBooks()throws BookException{ 23 | if(bookSet.size()==0) 24 | throw new BookException("No Books Found in the Library."); 25 | else 26 | return new ArrayList<>(bookSet); 27 | } 28 | 29 | public List viewBooksByAuthor(String author)throws BookException{ 30 | List bookByAuthorList = new ArrayList<>(); 31 | for(Book b : bookSet) { 32 | if(b.getAuthor().equalsIgnoreCase(author)) { 33 | bookByAuthorList.add(b); 34 | } 35 | } 36 | if(bookByAuthorList.size()==0) 37 | throw new BookException("None of the book published by the author "+author); 38 | else 39 | return bookByAuthorList; 40 | } 41 | 42 | public Book getBookByISBN(Integer isbn)throws BookException{ 43 | Book book = null; 44 | for(Book b:bookSet) { 45 | if(b.getIsbn()==isbn) 46 | book = b; 47 | } 48 | if(book==null) { 49 | throw new BookException("No Book Found with this ISBN: "+isbn); 50 | }else { 51 | return book; 52 | } 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /JA111 C2Evaluation/src/com/question_4/Main.java: -------------------------------------------------------------------------------- 1 | package com.question_4; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Main { 6 | 7 | public static Laptop getLaptop(String laptopPurpose){ 8 | 9 | if(laptopPurpose.equals("gaming")) { 10 | 11 | Laptop gamingLaptop = new Laptop(); 12 | gamingLaptop.setColor("Black"); 13 | gamingLaptop.setCompanyName("Radeon"); 14 | gamingLaptop.setPurpose("gaming"); 15 | gamingLaptop.setName("Acer"); 16 | 17 | CPU cpu = new CPU("Radeon","Ryzen 95800H", 3200); 18 | gamingLaptop.setCpu(cpu); 19 | GraphicCard graphic = new GraphicCard("Radeon", "RTX 3050 Ti","15GB"); 20 | gamingLaptop.setGraphicCard(graphic); 21 | 22 | return gamingLaptop; 23 | } 24 | else if(laptopPurpose.equals("business")) { 25 | 26 | Laptop businessLaptop = new Laptop(); 27 | businessLaptop.setColor("Rose Gold"); 28 | businessLaptop.setCompanyName("HP"); 29 | businessLaptop.setPurpose("business"); 30 | businessLaptop.setName("Aero 13"); 31 | 32 | CPU cpu = new CPU("Intel","i5 10210U", 1800); 33 | businessLaptop.setCpu(cpu); 34 | GraphicCard graphic = new GraphicCard("Intel", "Lris Xe","Inegrated"); 35 | businessLaptop.setGraphicCard(graphic); 36 | 37 | return businessLaptop; 38 | 39 | } 40 | else 41 | return null; 42 | 43 | } 44 | 45 | public static void main(String[] args) { 46 | 47 | Scanner sc = new Scanner(System.in); 48 | 49 | System.out.println("Please Enter the purpose: "); 50 | String purpose = sc.nextLine(); 51 | 52 | Laptop laptop=getLaptop(purpose); 53 | if(laptop!=null) { 54 | laptop.displayDetails(); 55 | } 56 | else 57 | System.out.println("Please Enter the correct Purpose"); 58 | } 59 | 60 | 61 | } 62 | -------------------------------------------------------------------------------- /SB101_C3_EVALUATION/src/com/question_5/Student.java: -------------------------------------------------------------------------------- 1 | package com.question_5; 2 | 3 | import java.io.Serializable; 4 | 5 | public class Student implements Serializable { 6 | 7 | private Integer roll; 8 | private String name; 9 | private Integer marks; 10 | private String email; 11 | private transient String password; 12 | private Address address; 13 | 14 | public Student() { 15 | // TODO Auto-generated constructor stub 16 | } 17 | 18 | public Student(Integer roll, String name, Integer marks, String email, String password, Address address) { 19 | super(); 20 | this.roll = roll; 21 | this.name = name; 22 | this.marks = marks; 23 | this.email = email; 24 | this.password = password; 25 | this.address = address; 26 | } 27 | 28 | public Integer getRoll() { 29 | return roll; 30 | } 31 | 32 | public void setRoll(Integer roll) { 33 | this.roll = roll; 34 | } 35 | 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | 44 | public Integer getMarks() { 45 | return marks; 46 | } 47 | 48 | public void setMarks(Integer marks) { 49 | this.marks = marks; 50 | } 51 | 52 | public String getEmail() { 53 | return email; 54 | } 55 | 56 | public void setEmail(String email) { 57 | this.email = email; 58 | } 59 | 60 | public String getPassword() { 61 | return password; 62 | } 63 | 64 | public void setPassword(String password) { 65 | this.password = password; 66 | } 67 | 68 | public Address getAddress() { 69 | return address; 70 | } 71 | 72 | public void setAddress(Address address) { 73 | this.address = address; 74 | } 75 | 76 | @Override 77 | public String toString() { 78 | return "Student [roll=" + roll + ", name=" + name + ", marks=" + marks + ", email=" + email + ", address=" 79 | + address + "]"; 80 | } 81 | 82 | 83 | 84 | } 85 | -------------------------------------------------------------------------------- /JA111 C2Evaluation/src/com/question_5/Employee.java: -------------------------------------------------------------------------------- 1 | package com.question_5; 2 | 3 | public class Employee { 4 | 5 | private int employeedId; 6 | private String employeeName; 7 | private double salary; 8 | private double netSalary; 9 | 10 | 11 | public Employee() { 12 | // zero argument constructor 13 | } 14 | 15 | // parameterized constructor 16 | public Employee(int employeedId, String employeeName, double salary) { 17 | super(); 18 | this.employeedId = employeedId; 19 | this.employeeName = employeeName; 20 | this.salary = salary; 21 | } 22 | 23 | // Getter and setter 24 | 25 | public int getEmployeedId() { 26 | return employeedId; 27 | } 28 | 29 | public void setEmployeedId(int employeedId) { 30 | this.employeedId = employeedId; 31 | } 32 | 33 | public String getEmployeeName() { 34 | return employeeName; 35 | } 36 | 37 | public void setEmployeeName(String employeeName) { 38 | this.employeeName = employeeName; 39 | } 40 | 41 | public double getSalary() { 42 | return salary; 43 | } 44 | 45 | public void setSalary(double salary) { 46 | this.salary = salary; 47 | } 48 | 49 | public double getNetSalary() { 50 | return netSalary; 51 | } 52 | 53 | public void setNetSalary(double netSalary) { 54 | this.netSalary = netSalary; 55 | } 56 | 57 | public static int getPFPercentage(Employee e) 58 | { 59 | 60 | return (int)(Math.round((1-(e.netSalary/e.salary))*100)); 61 | } 62 | 63 | public void calculateNetSalary(int pfPercentage) 64 | { 65 | 66 | double finalSalary = getSalary()-((getSalary())*pfPercentage)/100; 67 | 68 | netSalary = finalSalary; 69 | 70 | //System.out.println(this.netSalary); 71 | 72 | } 73 | 74 | 75 | public static Employee getEmployeeDetails(int employeedId, String employeeName, double salary) 76 | { 77 | Employee em = new Employee(employeedId,employeeName,salary); 78 | return em; 79 | } 80 | 81 | } 82 | 83 | -------------------------------------------------------------------------------- /SB101_C1_EVALUATION/src/com/question_2/Mobile.java: -------------------------------------------------------------------------------- 1 | package com.question_2; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashMap; 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | public class Mobile { 9 | 10 | static HashMap> mobiles = new HashMap<>(); 11 | 12 | public String addMobile(String company, String model) { 13 | 14 | for(Map.Entry> s: mobiles.entrySet()) { 15 | if(s.getKey().contains(company)) { 16 | s.getValue().add(model); 17 | return "Mobile Added Successfully"; 18 | } 19 | } 20 | ArrayList s = new ArrayList<>(); 21 | s.add(model); 22 | mobiles.put(company,s); 23 | 24 | return "Mobile Added Successfully"; 25 | 26 | 27 | } 28 | 29 | public List getMobile(String company){ 30 | List models = new ArrayList<>(); 31 | 32 | for(Map.Entry> s: mobiles.entrySet()) { 33 | if(s.getKey().contains(company)) { 34 | for(String sub:s.getValue()) { 35 | models.add(sub); 36 | } 37 | } 38 | } 39 | return models; 40 | } 41 | 42 | public static void main(String[] args) { 43 | 44 | Mobile m = new Mobile(); 45 | System.out.println(m.addMobile("Apple", "iphone13")); 46 | System.out.println(m.addMobile("Nokia", "nokia5233")); 47 | System.out.println(m.addMobile("Apple", "iphone12")); 48 | System.out.println(m.addMobile("Vivo", "v21")); 49 | System.out.println(m.addMobile("Oppo", "Reno621")); 50 | System.out.println(m.addMobile("Vivo", "v24")); 51 | System.out.println("Available Stock---------------"); 52 | System.out.println(mobiles); 53 | System.out.println("---------------------------------"); 54 | List result =m.getMobile("Samsung"); 55 | if(result.size()==0) { 56 | System.out.println("No models available with this company.."); 57 | } 58 | else 59 | System.out.println(result); 60 | 61 | } 62 | 63 | 64 | 65 | } 66 | -------------------------------------------------------------------------------- /Sort_HashMapBy_Key_and_Value/src/com/practice/SortByValue.java: -------------------------------------------------------------------------------- 1 | package com.practice; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashMap; 5 | import java.util.LinkedHashMap; 6 | import java.util.List; 7 | import java.util.Map; 8 | import java.util.Set; 9 | import java.util.TreeSet; 10 | 11 | public class SortByValue { 12 | 13 | public static Map sortByMapValue(HashMap map){ 14 | 15 | // Comparator> marksComp = (s1,s2)->{ 16 | // return s1.getValue().getMarks()>s2.getValue().getMarks()?1:-1; 17 | // }; 18 | 19 | Set> set=map.entrySet(); 20 | 21 | Set> sortedMap = new TreeSet<>(new StuedentComp()); 22 | sortedMap.addAll(set); 23 | 24 | LinkedHashMap finalMap = new LinkedHashMap<>(); 25 | 26 | for(Map.Entry s: sortedMap) { 27 | finalMap.put(s.getKey(), s.getValue()); 28 | } 29 | return finalMap; 30 | 31 | } 32 | 33 | public static void main(String[] args) { 34 | 35 | HashMap map = new HashMap<>(); 36 | 37 | map.put("Delhi", new Student(23, "Mohit", 120)); 38 | map.put("Noida", new Student(12, "Sita", 120)); 39 | map.put("Kanpur", new Student(89, "Sunil", 789)); 40 | map.put("Banaras", new Student(19, "Bamlesh", 489)); 41 | map.put("Bihar", new Student(90, "Rakesh", 280)); 42 | 43 | Map sortedMap = sortByMapValue(map); 44 | 45 | for(Map.Entry s: sortedMap.entrySet()) { 46 | 47 | System.out.println("Student is from: "+s.getKey()); 48 | System.out.println("---------------------------------"); 49 | Student stu = s.getValue(); 50 | 51 | System.out.println("Student Name: "+stu.getName()); 52 | System.out.println("Student RollNo: "+stu.getRollNo()); 53 | System.out.println("Student Marks: "+stu.getMarks()); 54 | System.out.println("------------------------------------"); 55 | } 56 | 57 | 58 | 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /SB101_C1_EVALUATION/src/com/question_1/Demo.java: -------------------------------------------------------------------------------- 1 | package com.question_1; 2 | 3 | import java.util.Comparator; 4 | import java.util.HashMap; 5 | import java.util.LinkedHashMap; 6 | import java.util.Map; 7 | import java.util.Set; 8 | import java.util.TreeSet; 9 | 10 | public class Demo { 11 | 12 | public Map sortMapUsingEmployeeSalary(Map originalMap){ 13 | 14 | Comparator> marksComp= (e1,e2)->{ 15 | return e1.getKey().getSalary()>e2.getKey().getSalary()?1:-1; 16 | }; 17 | 18 | Set> set = originalMap.entrySet(); 19 | 20 | Set> sortedSet = new TreeSet<>(marksComp); 21 | sortedSet.addAll(set); 22 | 23 | LinkedHashMap sortedMap = new LinkedHashMap<>(); 24 | 25 | for(Map.Entry s:sortedSet) { 26 | sortedMap.put(s.getKey(), s.getValue()); 27 | } 28 | return sortedMap; 29 | 30 | } 31 | 32 | 33 | public static void main(String[] args) { 34 | 35 | Demo d = new Demo(); 36 | 37 | Map map = new HashMap<>(); 38 | map.put(new Employee(23, "Rakesh", 65888), "Delhi"); 39 | map.put(new Employee(12, "Avdesh", 8452), "Kanpur"); 40 | map.put(new Employee(19, "Raju", 97352), "Patna"); 41 | map.put(new Employee(34, "Bamlesh", 1211), "Vanaras"); 42 | map.put(new Employee(10, "Raghvendra", 78666), "Bihar"); 43 | 44 | Map finalMap = d.sortMapUsingEmployeeSalary(map); 45 | 46 | // for printing using enchance loop 47 | 48 | for(Map.Entry l:finalMap.entrySet()) { 49 | System.out.println("Employee From: "+l.getValue()); 50 | System.out.println("================================"); 51 | Employee em = l.getKey(); 52 | System.out.println("Employee Id: "+em.getEmpId()); 53 | System.out.println("Employee Name: "+em.getName()); 54 | System.out.println("Employee Salary: "+em.getSalary()); 55 | System.out.println("----------------------------------"); 56 | } 57 | 58 | 59 | } 60 | 61 | 62 | } 63 | -------------------------------------------------------------------------------- /JA111 C3Evaluation/src/com/question_6/Main.java: -------------------------------------------------------------------------------- 1 | package com.question_6; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Main { 6 | 7 | static Scanner sc = new Scanner(System.in); 8 | public static double getStudent(int choice ) { 9 | 10 | if(choice==1) { 11 | 12 | System.out.println("Enter the Marks for Hindi: "); 13 | int hindi = sc.nextInt(); 14 | System.out.println("Enter the Marks for English: "); 15 | int english = sc.nextInt(); 16 | System.out.println("Enter the Marks for History: "); 17 | int history = sc.nextInt(); 18 | Student marks = new ArtStudent(hindi,english ,history); 19 | return marks.findPercentage(); 20 | } 21 | else if(choice ==2) { 22 | System.out.println("Enter the Marks for Maths: "); 23 | int maths = sc.nextInt(); 24 | System.out.println("Enter the Marks for Chemistry: "); 25 | int chemistry = sc.nextInt(); 26 | System.out.println("Enter the Marks for Physics: "); 27 | int physics = sc.nextInt(); 28 | System.out.println("Enter the Marks for Biology: "); 29 | int biology = sc.nextInt(); 30 | Student marks = new ScienceStudent(maths, chemistry, physics, biology); 31 | return marks.findPercentage(); 32 | } 33 | else if(choice ==3) { 34 | System.out.println("Enter the Marks for Account: "); 35 | int account = sc.nextInt(); 36 | System.out.println("Enter the Marks for Economics: "); 37 | int economics = sc.nextInt(); 38 | System.out.println("Enter the Marks for Business Studies: "); 39 | int businessStudies = sc.nextInt(); 40 | CommerceStudent marks = new CommerceStudent(account, economics, businessStudies); 41 | return marks.findPercentage(); 42 | } 43 | 44 | return 0; 45 | } 46 | 47 | public static void main(String[] args) { 48 | Scanner sc = new Scanner(System.in); 49 | System.out.println("Which Student percentage do you want to find: "+ 50 | "\n 1. ArtStudent"+ 51 | "\n 2. ScienceStudent"+ 52 | "\n 3. CommerceStudent "); 53 | 54 | int choice = sc.nextInt(); 55 | double percetange =getStudent(choice); 56 | if(percetange==0) 57 | System.out.println("Please enter correct option"); 58 | else { 59 | System.out.println("============================"); 60 | System.out.println("Percentage is: "+percetange); 61 | } 62 | 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /SB101_C2_EVALUATION/src/com/question_2/Main.java: -------------------------------------------------------------------------------- 1 | package com.question_2; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.function.Function; 6 | import java.util.function.Supplier; 7 | 8 | import com.question_3.Student; 9 | 10 | public class Main { 11 | 12 | public static void main(String[] args) { 13 | 14 | List students = new ArrayList<>(); 15 | 16 | students.add(new Student(23, "Anand",540, "Noida")); 17 | students.add(new Student(11, "Prince", 280, "Delhi")); 18 | students.add(new Student(34, "Rakesh", 765, "Punjab")); 19 | students.add(new Student(78, "Suresh",236,"Haryana")); 20 | students.add(new Student(10, "Sita", 509, "Bihar")); 21 | 22 | 23 | // First use of Predicate: 24 | //Let's get those students whose marks are less than 500 25 | System.out.println("Getting Students whose marks are less than 500 using Predicate"); 26 | System.out.println("======================================================"); 27 | students.stream().filter(i->i.getMarks()<500).forEach(System.out::println); 28 | System.out.println("-------------------------------------------------------"); 29 | 30 | // Second use of Consumer 31 | // Let's print the details of student 32 | System.out.println("Getting all students details using Consumer"); 33 | System.out.println("============================================="); 34 | students.forEach(i->System.out.println(i)); 35 | System.out.println("------------------------------------------------"); 36 | 37 | // Third use of Supplier: 38 | //get the student object with all details: 39 | System.out.println("Getting Student object with all detail using Supplier"); 40 | System.out.println("======================================================="); 41 | Supplier stu = ()->new Student(23, "Anand", 590, "Noida"); 42 | System.out.println(stu.get()); 43 | System.out.println("-----------------------------------------------------"); 44 | 45 | 46 | //Fourth use of Function 47 | //get any number in String format and return the number in Integer format. 48 | 49 | //String s = "2"; 50 | 51 | System.out.println("Converting String to number using Function:"); 52 | System.out.println("=================================================="); 53 | 54 | Function f2 = s -> Integer.parseInt(s); 55 | System.out.println(f2.apply("2")); 56 | System.out.println("----------------------------------------------------"); 57 | 58 | 59 | 60 | 61 | 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /JA111 C2Evaluation/src/com/question_4/Laptop.java: -------------------------------------------------------------------------------- 1 | package com.question_4; 2 | 3 | public class Laptop { 4 | 5 | private String color; 6 | private String companyName; 7 | private String name; 8 | private String purpose; 9 | private CPU cpu; 10 | private GraphicCard graphicCard; 11 | 12 | public Laptop() { 13 | // TODO Auto-generated constructor stub 14 | } 15 | 16 | 17 | 18 | public Laptop(String color, String companyName, String name, String purpose, CPU cpu, GraphicCard graphicCard) { 19 | super(); 20 | this.color = color; 21 | this.companyName = companyName; 22 | this.name = name; 23 | this.purpose = purpose; 24 | this.cpu = cpu; 25 | this.graphicCard = graphicCard; 26 | } 27 | 28 | 29 | 30 | 31 | 32 | public String getColor() { 33 | return color; 34 | } 35 | 36 | 37 | 38 | 39 | public void setColor(String color) { 40 | this.color = color; 41 | } 42 | 43 | 44 | 45 | 46 | public String getCompanyName() { 47 | return companyName; 48 | } 49 | 50 | 51 | 52 | 53 | public void setCompanyName(String companyName) { 54 | this.companyName = companyName; 55 | } 56 | 57 | 58 | 59 | 60 | public String getName() { 61 | return name; 62 | } 63 | 64 | 65 | 66 | 67 | public void setName(String name) { 68 | this.name = name; 69 | } 70 | 71 | 72 | 73 | 74 | public String getPurpose() { 75 | return purpose; 76 | } 77 | 78 | 79 | 80 | 81 | public void setPurpose(String purpose) { 82 | this.purpose = purpose; 83 | } 84 | 85 | 86 | 87 | 88 | public CPU getCpu() { 89 | return cpu; 90 | } 91 | 92 | 93 | 94 | 95 | public void setCpu(CPU cpu) { 96 | this.cpu = cpu; 97 | } 98 | 99 | 100 | 101 | 102 | public GraphicCard getGraphicCard() { 103 | return graphicCard; 104 | } 105 | 106 | 107 | 108 | 109 | public void setGraphicCard(GraphicCard graphicCard) { 110 | this.graphicCard = graphicCard; 111 | } 112 | 113 | 114 | public void displayDetails() { 115 | 116 | System.out.println("Laptop Name => "+name); 117 | System.out.println("Company Name => "+companyName); 118 | System.out.println("Laptop Color => "+color); 119 | System.out.println("Laptop Purpose => "+purpose); 120 | System.out.println("Cpu's Manufacturer => "+cpu.getManufacturer()); 121 | System.out.println("Cpu's Processor => "+cpu.getProcessor()); 122 | System.out.println("Cpu's ClockSpeed => "+cpu.getClockSpeed()); 123 | System.out.println("Graphic Card's Manufacturer => "+graphicCard.getManufacturer()); 124 | System.out.println("Graphic Card's Series => "+graphicCard.getSeries()); 125 | System.out.println("Graphic Card's Capacity => "+graphicCard.getCapacity()); 126 | 127 | } 128 | } 129 | 130 | -------------------------------------------------------------------------------- /SB101_C2_EVALUATION/src/com/question_1/Main.java: -------------------------------------------------------------------------------- 1 | package com.question_1; 2 | 3 | import java.util.List; 4 | import java.util.Scanner; 5 | 6 | public class Main { 7 | 8 | public static void main(String[] args) { 9 | 10 | Scanner sc = new Scanner(System.in); 11 | while(true) { 12 | System.out.println("Enter Your Choice: " 13 | +"\n1. Add Book" 14 | +"\n2. Display all book details" 15 | +"\n3. Search Book by author" 16 | +"\n4. Search book by ISBN" 17 | +"\n5. Exit"); 18 | int choice = Integer.parseInt(sc.nextLine()); 19 | 20 | Library library = new Library(); 21 | 22 | switch(choice) { 23 | case 1: 24 | while(true) { 25 | System.out.println("Enter Book ISBN: "); 26 | int isbn = Integer.parseInt(sc.nextLine()); 27 | System.out.println("Enter Book Name: "); 28 | String book = sc.nextLine(); 29 | System.out.println("Enter Book Author: "); 30 | String author = sc.nextLine(); 31 | 32 | try { 33 | library.addBook(new Book(isbn, book, author)); 34 | } catch (BookException e) { 35 | System.out.println(e.getMessage()); 36 | } 37 | System.out.println("Do you want to add more Book: (Y/N)"); 38 | String res = sc.nextLine(); 39 | if(res.equalsIgnoreCase("N")) 40 | break; 41 | } 42 | break; 43 | case 2: 44 | try { 45 | List books = library.viewAllBooks(); 46 | for(Book b : books) { 47 | System.out.println("Book Name: "+b.getBookName()); 48 | System.out.println("Book ISBN: "+b.getIsbn()); 49 | System.out.println("Book Author: "+b.getAuthor()); 50 | System.out.println("----------------------------"); 51 | } 52 | } catch (BookException e) { 53 | System.out.println(e.getMessage()); 54 | } 55 | break; 56 | case 3: 57 | System.out.println("Enter Author Name: "); 58 | String author = sc.nextLine(); 59 | 60 | try { 61 | List books = library.viewBooksByAuthor(author); 62 | for(Book b : books) { 63 | System.out.println("Book Name: "+b.getBookName()); 64 | System.out.println("Book ISBN: "+b.getIsbn()); 65 | System.out.println("Book Author: "+b.getAuthor()); 66 | System.out.println("----------------------------"); 67 | } 68 | } catch (BookException e) { 69 | System.out.println(e.getMessage()); 70 | } 71 | break; 72 | case 4: 73 | System.out.println("Enter Book ISBN: "); 74 | int isbn = Integer.parseInt(sc.nextLine()); 75 | try { 76 | Book b = library.getBookByISBN(isbn); 77 | System.out.println("Book Name: "+b.getBookName()); 78 | System.out.println("Book ISBN: "+b.getIsbn()); 79 | System.out.println("Book Author: "+b.getAuthor()); 80 | } catch (BookException e) { 81 | System.out.println(e.getMessage()); 82 | } 83 | break; 84 | default: 85 | System.out.println("Thank you"); 86 | break; 87 | 88 | } 89 | System.out.println("Do you want to continue.....(Y/N)"); 90 | String ans = sc.nextLine(); 91 | if(ans.equalsIgnoreCase("N")) 92 | break; 93 | 94 | } 95 | 96 | } 97 | 98 | } 99 | -------------------------------------------------------------------------------- /JA111 C2Evaluation/bin/com/question_1/String.txt: -------------------------------------------------------------------------------- 1 | 2 | Question 1(a): Why is String Immutable in Java? 3 | 4 | Answer(a): for taking care about Security and synchronization in java, String is Immutable. String is always final in 5 | java therefor one can't change it or update it. The main reason behind is that String is stored in String 6 | context pool so so that, It can be shared. 7 | 8 | String support many underlying methods: 9 | -------------------------------------- 10 | 5 methods out of them 11 | --------------------- 12 | 13 | (1): toUpperCase(): To make a string in uppercase 14 | Exaple 15 | (2): trim(): To remove the extra spaces from beginning and last. 16 | (3): charAt(): It gives character at given index. 17 | (4): equals(): To compare if the content of given two string is true or false. 18 | (5): equalsIgnoreCase(): It ignores the case and return true if two strings are true, return false if false. 19 | 20 | 21 | Question 1(b): What is the difference between equals method and == operator in java? And what will be the output of the 22 | following code snippets and giving proper explanation. 23 | 24 | Answer(b): Difference between equals and == operator: 25 | ------------------------------------------ 26 | 27 | (1): == Operator compare two string with the address if the address of both the string is same then return 28 | true else false whereas equals() method compares two string with their content, if the content is same 29 | return true else false. 30 | 31 | Example 1: Code snippet 1 > 32 | 33 | String s1 = new String("abc"); 34 | String s2 = new String("abc"); 35 | System.out.println(s1.equals(s2)); 36 | 37 | Explanation: equals() compares with the content so in the above example both string have same content therefore 38 | answer is true. but if we compare using == then, It will give false because both created at difference 39 | memory address using new. 40 | 41 | Example 2: Code snippet 2 > 42 | 43 | StringBuilder sb1 = new StringBuilder("abc"); 44 | StringBuilder sb2 = new StringBuilder("abc"); 45 | System.out.println(sb1.equals(sb2)); 46 | 47 | Explanation: In the case of StringBuffer and StringBuilder they don't get data from string context pool compiler 48 | separate memory address using StringBuilder and StringBuffer therefore. Answer will be false. 49 | 50 | Example 3: Code snippet 3 > 51 | 52 | String s1 = new String("abc"); 53 | String s2 = new String("abc"); 54 | System.out.println(s1==s2); 55 | 56 | Expalantion: In this case, Answer will be false because, Both object will create differently inside heap memory. 57 | but having the same content wich is already there in String Context Pool Area. 58 | 59 | -------------------------------------------------------------------------------- /JA111 C2Evaluation/src/com/question_1/String.txt: -------------------------------------------------------------------------------- 1 | 2 | Question 1(a): Why is String Immutable in Java? 3 | 4 | Answer(a): for taking care about Security and synchronization in java, String is Immutable. String is always final in 5 | java therefor one can't change it or update it. The main reason behind is that String is stored in String 6 | context pool so so that, It can be shared. 7 | 8 | String support many underlying methods: 9 | -------------------------------------- 10 | 5 methods out of them 11 | --------------------- 12 | 13 | (1): toUpperCase(): To make a string in uppercase 14 | Exaple 15 | (2): trim(): To remove the extra spaces from beginning and last. 16 | (3): charAt(): It gives character at given index. 17 | (4): equals(): To compare if the content of given two string is true or false. 18 | (5): equalsIgnoreCase(): It ignores the case and return true if two strings are true, return false if false. 19 | 20 | 21 | Question 1(b): What is the difference between equals method and == operator in java? And what will be the output of the 22 | following code snippets and giving proper explanation. 23 | 24 | Answer(b): Difference between equals and == operator: 25 | ------------------------------------------ 26 | 27 | (1): == Operator compare two string with the address if the address of both the string is same then return 28 | true else false whereas equals() method compares two string with their content, if the content is same 29 | return true else false. 30 | 31 | Example 1: Code snippet 1 > 32 | 33 | String s1 = new String("abc"); 34 | String s2 = new String("abc"); 35 | System.out.println(s1.equals(s2)); 36 | 37 | Explanation: equals() compares with the content so in the above example both string have same content therefore 38 | answer is true. but if we compare using == then, It will give false because both created at difference 39 | memory address using new. 40 | 41 | Example 2: Code snippet 2 > 42 | 43 | StringBuilder sb1 = new StringBuilder("abc"); 44 | StringBuilder sb2 = new StringBuilder("abc"); 45 | System.out.println(sb1.equals(sb2)); 46 | 47 | Explanation: In the case of StringBuffer and StringBuilder they don't get data from string context pool compiler 48 | separate memory address using StringBuilder and StringBuffer therefore. Answer will be false. 49 | 50 | Example 3: Code snippet 3 > 51 | 52 | String s1 = new String("abc"); 53 | String s2 = new String("abc"); 54 | System.out.println(s1==s2); 55 | 56 | Expalantion: In this case, Answer will be false because, Both object will create differently inside heap memory. 57 | but having the same content wich is already there in String Context Pool Area. 58 | 59 | -------------------------------------------------------------------------------- /JA111 C3Evaluation/bin/com/question_2/EarlyBinding_LateBinding.txt: -------------------------------------------------------------------------------- 1 | Question: Briefly explain the difference between Early and Late Binding with examples. 2 | 3 | Answer: 4 | Early Binding: 5 | -------------- 6 | This type of binding can be achieved at compile time. This is also called static binding and 7 | method overloading. 8 | static methods calls and overloaded methods calls take place at compile time. 9 | 10 | Example: 11 | ------- 12 | 13 | public class Cycle { // parent class 14 | 15 | public static void run() { 16 | System.out.println("Cycle is running."); 17 | } 18 | 19 | } 20 | 21 | public class Heroculas extends Cycle{ // child class 22 | 23 | public static void run() { 24 | System.out.println("Heroculas is running."); 25 | } 26 | } 27 | 28 | public class Test { 29 | 30 | public static void main(String[] args) { 31 | Cycle cycle = new Cycle(); 32 | Cycle heroculas = new Heroculas(); 33 | cycle.run(); 34 | heroculas.run(); 35 | } 36 | } 37 | 38 | // output 39 | //Cycle is running. 40 | //Cycle is running. 41 | 42 | Expalanation: In the above example: The Cycle class and the Heroculas class where Heroculas child class 43 | extends the Cycle both have one static method run(). so when we are calling run() method from parent class 44 | reference then only parent class method is being called. 45 | why is this happening: because run() is a static method and static method can't be overridden. Therefore 46 | binding of static method happends at compile time. 47 | 48 | Late Binding: 49 | ------------ 50 | This type of binding takes place at run time. And this is also called as method overriding and dynamic 51 | binding. 52 | static methods don't participate in this type of binding. 53 | 54 | Example: 55 | ------- 56 | public class Cycle { // parent class 57 | 58 | public void run() { 59 | System.out.println("Cycle is running."); 60 | } 61 | 62 | } 63 | 64 | public class Heroculas extends Cycle{ // child class 65 | 66 | public void run() { 67 | System.out.println("Heroculas is running."); 68 | } 69 | } 70 | 71 | public class Test { 72 | 73 | public static void main(String[] args) { 74 | Cycle cycle = new Cycle(); 75 | Cycle heroculas = new Heroculas(); 76 | cycle.run(); 77 | heroculas.run(); 78 | } 79 | } 80 | 81 | // output 82 | //Cycle is running. 83 | //Heroculas is running. 84 | 85 | Explanation: In the above example: The Cycle class and the Heroculas class where Heroculas child class 86 | extends the Cycle class both have one non-static method run(). so when we are calling run() method from 87 | parent class reference then child class overridden method is being called. 88 | Why is this happening: run() is a non-static method overridden in the child class. So, At run time It is 89 | being called. 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /JA111 C3Evaluation/src/com/question_2/EarlyBinding_LateBinding.txt: -------------------------------------------------------------------------------- 1 | Question: Briefly explain the difference between Early and Late Binding with examples. 2 | 3 | Answer: 4 | Early Binding: 5 | -------------- 6 | This type of binding can be achieved at compile time. This is also called static binding and 7 | method overloading. 8 | static methods calls and overloaded methods calls take place at compile time. 9 | 10 | Example: 11 | ------- 12 | 13 | public class Cycle { // parent class 14 | 15 | public static void run() { 16 | System.out.println("Cycle is running."); 17 | } 18 | 19 | } 20 | 21 | public class Heroculas extends Cycle{ // child class 22 | 23 | public static void run() { 24 | System.out.println("Heroculas is running."); 25 | } 26 | } 27 | 28 | public class Test { 29 | 30 | public static void main(String[] args) { 31 | Cycle cycle = new Cycle(); 32 | Cycle heroculas = new Heroculas(); 33 | cycle.run(); 34 | heroculas.run(); 35 | } 36 | } 37 | 38 | // output 39 | //Cycle is running. 40 | //Cycle is running. 41 | 42 | Expalanation: In the above example: The Cycle class and the Heroculas class where Heroculas child class 43 | extends the Cycle both have one static method run(). so when we are calling run() method from parent class 44 | reference then only parent class method is being called. 45 | why is this happening: because run() is a static method and static method can't be overridden. Therefore 46 | binding of static method happends at compile time. 47 | 48 | Late Binding: 49 | ------------ 50 | This type of binding takes place at run time. And this is also called as method overriding and dynamic 51 | binding. 52 | static methods don't participate in this type of binding. 53 | 54 | Example: 55 | ------- 56 | public class Cycle { // parent class 57 | 58 | public void run() { 59 | System.out.println("Cycle is running."); 60 | } 61 | 62 | } 63 | 64 | public class Heroculas extends Cycle{ // child class 65 | 66 | public void run() { 67 | System.out.println("Heroculas is running."); 68 | } 69 | } 70 | 71 | public class Test { 72 | 73 | public static void main(String[] args) { 74 | Cycle cycle = new Cycle(); 75 | Cycle heroculas = new Heroculas(); 76 | cycle.run(); 77 | heroculas.run(); 78 | } 79 | } 80 | 81 | // output 82 | //Cycle is running. 83 | //Heroculas is running. 84 | 85 | Explanation: In the above example: The Cycle class and the Heroculas class where Heroculas child class 86 | extends the Cycle class both have one non-static method run(). so when we are calling run() method from 87 | parent class reference then child class overridden method is being called. 88 | Why is this happening: run() is a non-static method overridden in the child class. So, At run time It is 89 | being called. 90 | 91 | 92 | 93 | --------------------------------------------------------------------------------