├── .metadata ├── .lock ├── .plugins │ ├── org.eclipse.core.resources │ │ └── .root │ │ │ └── .indexes │ │ │ └── properties.version │ ├── org.eclipse.core.runtime │ │ └── .settings │ │ │ └── org.eclipse.core.resources.prefs │ └── org.eclipse.m2e.logback.configuration │ │ └── logback.1.8.3.20180227-2137.xml ├── version.ini └── .log ├── Leet-Code ├── .gitignore ├── Single Number.PNG ├── .settings │ └── org.eclipse.core.resources.prefs ├── .classpath ├── src │ ├── Week_02 │ │ ├── ListNode.java │ │ ├── ContiguousArray.java │ │ ├── MinStack.java │ │ ├── DiameterofBinaryTree.java │ │ ├── MiddleOfLInkedList.java │ │ ├── LastStoneWeight.java │ │ └── BackSpaceStringComapre.java │ ├── Week_04 │ │ ├── PrintMissingElement.java │ │ ├── JumpGame.java │ │ ├── BitwiseANDofnoRange.java │ │ ├── FrogJumpOne.java │ │ ├── MaximalSquare.java │ │ ├── BinaryMaximumPath.java │ │ ├── SubArraySumEqualsK.java │ │ ├── LongestCommonSubSequence.java │ │ └── LRUCache.java │ ├── Week_01 │ │ ├── SingleNumber.java │ │ ├── Maximum_SubArray.java │ │ ├── HappYNumber.java │ │ ├── GroupAnagram.java │ │ ├── MoveZeros.java │ │ └── BestTImeBuyAndSell.java │ └── Week_03 │ │ ├── ValidParenThesisString.java │ │ ├── ProdOfArrayExceptSelf.java │ │ ├── MinimumPathSum.java │ │ ├── SearchinRotatedSortedArray.java │ │ ├── NumberofIslands.java │ │ └── BSTfromPreorderTraversal.java └── .project ├── HackerEarth ├── .gitignore ├── .classpath ├── .project └── src │ └── com │ └── lti │ ├── day01 │ ├── StringZoo.java │ ├── GoingToOffice.java │ └── VowelRecognition.java │ └── day02 │ ├── ArithmeticProgression.java │ ├── DistributeChocolate.java │ ├── MaximumBorders.java │ ├── VowelConsonant.java │ └── MinimumSteps.java ├── hackerRank ├── .gitignore ├── .classpath ├── src │ └── com │ │ ├── week2 │ │ ├── MinPageTurn.java │ │ ├── DivisibleSumPairs.java │ │ ├── JavaDateAndTime.java │ │ ├── BillPayment.java │ │ ├── StaticBlock.java │ │ ├── DayPrinting.java │ │ ├── Breakingrecords.java │ │ ├── MaxElectronicShop.java │ │ ├── MigratoryBirds.java │ │ ├── BirthdayChocolate.java │ │ ├── Solution.java │ │ └── BetweenSets.java │ │ ├── week1 │ │ ├── EndOfFile.java │ │ ├── DataType.java │ │ ├── StringFormatting.java │ │ ├── NumberLineJumpa.java │ │ ├── SumOfArray.java │ │ ├── HelloWorld.java │ │ ├── CompareTriplets.java │ │ ├── ArraySum.java │ │ └── GradesROund.java │ │ └── week3 │ │ ├── StringToken.java │ │ ├── ExceptionHandling.java │ │ ├── JavaCurrencyFormatter.java │ │ ├── ExceptionHandling2.java │ │ ├── StringIntro.java │ │ └── IsAnagram.java └── .project ├── JAVA W3-Resource Practice ├── .gitignore ├── src │ ├── module-info.java │ └── basics │ │ ├── Hello.java │ │ └── Numberoperator.java ├── .classpath └── .project ├── README.md ├── UserMangementApp ├── .gitignore ├── .settings │ ├── org.eclipse.wst.jsdt.ui.superType.name │ ├── org.eclipse.wst.validation.prefs │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── .jsdtscope │ ├── org.eclipse.wst.common.component │ └── org.eclipse.jdt.core.prefs ├── 3. LTI Training │ └── maven-workspace │ │ └── UserMangementApp │ │ └── target │ │ └── m2e-wtp │ │ └── web-resources │ │ └── .gitignore ├── src │ └── main │ │ ├── webapp │ │ ├── image │ │ │ ├── ceo.jpg │ │ │ ├── lti.jpg │ │ │ ├── lti.png │ │ │ ├── Be-agile-237x300.png │ │ │ ├── extra-mile-237x300.png │ │ │ ├── keep-learning-237x300.png │ │ │ ├── solve-for-society-237x300_new-237x300.png │ │ │ └── push-frontiers-of-innovation-237x300_robo.jpg │ │ ├── Error.jsp │ │ ├── WEB-INF │ │ │ └── web.xml │ │ ├── login.html │ │ ├── register.html │ │ ├── user-list.jsp │ │ ├── Update.jsp │ │ ├── index.html │ │ └── main.css │ │ ├── resources │ │ └── ojdbc6-2.0.jar │ │ └── java │ │ └── com │ │ └── lti │ │ ├── dao │ │ ├── UserInfoDao.java │ │ └── UserInfoDaoImpl.java │ │ ├── connection │ │ └── ConnectionFactory.java │ │ ├── controller │ │ ├── DeleteServlet.java │ │ ├── EditServlet.java │ │ ├── UserListServlet.java │ │ ├── UpdateServlet.java │ │ └── RegisterServlet.java │ │ └── model │ │ └── UserInfo.java ├── .project ├── pom.xml └── .classpath ├── .gitattributes ├── Online Reservation System Project ├── Install.bat └── Reservation │ ├── Start.java │ ├── LOGO.JPG │ ├── LOGO2.jpg │ ├── logo.bmp │ ├── logo1.bmp │ ├── LOGO11.jpg │ ├── Login.class │ ├── Main.class │ ├── Railway.mdb │ ├── Start.class │ ├── logo13.bmp │ ├── logo23.bmp │ ├── Connect.class │ ├── Enquiry.class │ ├── Welcome.class │ ├── Passenger.class │ ├── indian-rail.jpg │ ├── Cancellation.class │ ├── Reservation.class │ ├── Indian-Railway-network.jpg │ ├── Railway.ldb │ ├── Connect.java │ ├── Welcome.java │ ├── Login.java │ ├── Main.java │ ├── Enquiry.java │ ├── Cancellation.java │ ├── Passenger.java │ └── Reservation.java ├── Leet-Code-Arrays ├── bin │ ├── Prime.class │ ├── MoveZeros.class │ ├── Consecutive1.class │ ├── HeightChecker.class │ ├── RemoveElement.class │ ├── DuplicateZeros.class │ ├── ThirdMaxNumber.class │ ├── ArraySortbyParity.class │ ├── MergeSortedArray.class │ ├── ValidMountainArray.class │ ├── NumberwithEvenNumber.class │ ├── SquareofSortedArray.class │ ├── CheckifNandItsDoubleExist.class │ ├── DeleteDuplicateinSortedArray.class │ ├── Repeated_Deletion_Algorithm.class │ ├── ReplaceValuebyMaxfromRight.class │ └── RemoveDuplicateFromSortedArray.class ├── .classpath ├── src │ ├── Prime.java │ ├── RemoveDuplicateFromSortedArray.java │ ├── MergeSortedArray.java │ ├── SquareofSortedArray.java │ ├── MoveZeros.java │ ├── ArraySortbyParity.java │ ├── Consecutive1.java │ ├── ReplaceValuebyMaxfromRight.java │ ├── CheckifNandItsDoubleExist.java │ ├── ValidMountainArray.java │ ├── NumberwithEvenNumber.java │ ├── RemoveElement.java │ ├── Repeated_Deletion_Algorithm.java │ ├── ThirdMaxNumber.java │ ├── DuplicateZeros.java │ ├── HeightChecker.java │ └── DeleteDuplicateinSortedArray.java └── .project ├── Demo2 ├── bin │ └── com │ │ └── lti │ │ └── model │ │ ├── Login.class │ │ ├── User.class │ │ └── Persons.class ├── src │ └── com │ │ └── lti │ │ └── model │ │ ├── Login.java │ │ ├── User.java │ │ └── Persons.java ├── .classpath ├── .project └── .settings │ └── org.eclipse.jdt.core.prefs └── LICENSE /.metadata/.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Leet-Code/.gitignore: -------------------------------------------------------------------------------- 1 | bin -------------------------------------------------------------------------------- /HackerEarth/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/ 2 | -------------------------------------------------------------------------------- /hackerRank/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/ 2 | -------------------------------------------------------------------------------- /JAVA W3-Resource Practice/.gitignore: -------------------------------------------------------------------------------- 1 | bin -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Java-Online-Coding 2 | 3 | -------------------------------------------------------------------------------- /UserMangementApp/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /UserMangementApp/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.version: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /Leet-Code/Single Number.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Leet-Code/Single Number.PNG -------------------------------------------------------------------------------- /Online Reservation System Project/Install.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | md c:\Reservation 3 | xcopy Reservation c:\Reservation 4 | -------------------------------------------------------------------------------- /UserMangementApp/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /UserMangementApp/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /UserMangementApp/3. LTI Training/maven-workspace/UserMangementApp/target/m2e-wtp/web-resources/.gitignore: -------------------------------------------------------------------------------- 1 | /META-INF/ 2 | -------------------------------------------------------------------------------- /Leet-Code-Arrays/bin/Prime.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Leet-Code-Arrays/bin/Prime.class -------------------------------------------------------------------------------- /.metadata/version.ini: -------------------------------------------------------------------------------- 1 | #Fri Nov 06 18:46:13 IST 2020 2 | org.eclipse.core.runtime=2 3 | org.eclipse.platform=4.7.0.v20170612-0950 4 | -------------------------------------------------------------------------------- /Demo2/bin/com/lti/model/Login.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Demo2/bin/com/lti/model/Login.class -------------------------------------------------------------------------------- /Demo2/bin/com/lti/model/User.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Demo2/bin/com/lti/model/User.class -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | version=1 3 | -------------------------------------------------------------------------------- /Demo2/bin/com/lti/model/Persons.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Demo2/bin/com/lti/model/Persons.class -------------------------------------------------------------------------------- /Leet-Code-Arrays/bin/MoveZeros.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Leet-Code-Arrays/bin/MoveZeros.class -------------------------------------------------------------------------------- /JAVA W3-Resource Practice/src/module-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | /** 5 | * @author lenovo 6 | * 7 | */ 8 | module w3_Practice { 9 | } -------------------------------------------------------------------------------- /Leet-Code-Arrays/bin/Consecutive1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Leet-Code-Arrays/bin/Consecutive1.class -------------------------------------------------------------------------------- /Leet-Code-Arrays/bin/HeightChecker.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Leet-Code-Arrays/bin/HeightChecker.class -------------------------------------------------------------------------------- /Leet-Code-Arrays/bin/RemoveElement.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Leet-Code-Arrays/bin/RemoveElement.class -------------------------------------------------------------------------------- /Leet-Code-Arrays/bin/DuplicateZeros.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Leet-Code-Arrays/bin/DuplicateZeros.class -------------------------------------------------------------------------------- /Leet-Code-Arrays/bin/ThirdMaxNumber.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Leet-Code-Arrays/bin/ThirdMaxNumber.class -------------------------------------------------------------------------------- /Leet-Code-Arrays/bin/ArraySortbyParity.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Leet-Code-Arrays/bin/ArraySortbyParity.class -------------------------------------------------------------------------------- /Leet-Code-Arrays/bin/MergeSortedArray.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Leet-Code-Arrays/bin/MergeSortedArray.class -------------------------------------------------------------------------------- /Leet-Code-Arrays/bin/ValidMountainArray.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Leet-Code-Arrays/bin/ValidMountainArray.class -------------------------------------------------------------------------------- /Online Reservation System Project/Reservation/Start.java: -------------------------------------------------------------------------------- 1 | class Start 2 | { 3 | public static void main(String args[]) 4 | { 5 | new Welcome(); 6 | } 7 | } -------------------------------------------------------------------------------- /Leet-Code-Arrays/bin/NumberwithEvenNumber.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Leet-Code-Arrays/bin/NumberwithEvenNumber.class -------------------------------------------------------------------------------- /Leet-Code-Arrays/bin/SquareofSortedArray.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Leet-Code-Arrays/bin/SquareofSortedArray.class -------------------------------------------------------------------------------- /UserMangementApp/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /UserMangementApp/src/main/webapp/image/ceo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/UserMangementApp/src/main/webapp/image/ceo.jpg -------------------------------------------------------------------------------- /UserMangementApp/src/main/webapp/image/lti.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/UserMangementApp/src/main/webapp/image/lti.jpg -------------------------------------------------------------------------------- /UserMangementApp/src/main/webapp/image/lti.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/UserMangementApp/src/main/webapp/image/lti.png -------------------------------------------------------------------------------- /UserMangementApp/src/main/resources/ojdbc6-2.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/UserMangementApp/src/main/resources/ojdbc6-2.0.jar -------------------------------------------------------------------------------- /Leet-Code-Arrays/bin/CheckifNandItsDoubleExist.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Leet-Code-Arrays/bin/CheckifNandItsDoubleExist.class -------------------------------------------------------------------------------- /Leet-Code-Arrays/bin/DeleteDuplicateinSortedArray.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Leet-Code-Arrays/bin/DeleteDuplicateinSortedArray.class -------------------------------------------------------------------------------- /Leet-Code-Arrays/bin/Repeated_Deletion_Algorithm.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Leet-Code-Arrays/bin/Repeated_Deletion_Algorithm.class -------------------------------------------------------------------------------- /Leet-Code-Arrays/bin/ReplaceValuebyMaxfromRight.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Leet-Code-Arrays/bin/ReplaceValuebyMaxfromRight.class -------------------------------------------------------------------------------- /Online Reservation System Project/Reservation/LOGO.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Online Reservation System Project/Reservation/LOGO.JPG -------------------------------------------------------------------------------- /Online Reservation System Project/Reservation/LOGO2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Online Reservation System Project/Reservation/LOGO2.jpg -------------------------------------------------------------------------------- /Online Reservation System Project/Reservation/logo.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Online Reservation System Project/Reservation/logo.bmp -------------------------------------------------------------------------------- /Online Reservation System Project/Reservation/logo1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Online Reservation System Project/Reservation/logo1.bmp -------------------------------------------------------------------------------- /Leet-Code-Arrays/bin/RemoveDuplicateFromSortedArray.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Leet-Code-Arrays/bin/RemoveDuplicateFromSortedArray.class -------------------------------------------------------------------------------- /Online Reservation System Project/Reservation/LOGO11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Online Reservation System Project/Reservation/LOGO11.jpg -------------------------------------------------------------------------------- /Online Reservation System Project/Reservation/Login.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Online Reservation System Project/Reservation/Login.class -------------------------------------------------------------------------------- /Online Reservation System Project/Reservation/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Online Reservation System Project/Reservation/Main.class -------------------------------------------------------------------------------- /Online Reservation System Project/Reservation/Railway.mdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Online Reservation System Project/Reservation/Railway.mdb -------------------------------------------------------------------------------- /Online Reservation System Project/Reservation/Start.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Online Reservation System Project/Reservation/Start.class -------------------------------------------------------------------------------- /Online Reservation System Project/Reservation/logo13.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Online Reservation System Project/Reservation/logo13.bmp -------------------------------------------------------------------------------- /Online Reservation System Project/Reservation/logo23.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Online Reservation System Project/Reservation/logo23.bmp -------------------------------------------------------------------------------- /Online Reservation System Project/Reservation/Connect.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Online Reservation System Project/Reservation/Connect.class -------------------------------------------------------------------------------- /Online Reservation System Project/Reservation/Enquiry.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Online Reservation System Project/Reservation/Enquiry.class -------------------------------------------------------------------------------- /Online Reservation System Project/Reservation/Welcome.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Online Reservation System Project/Reservation/Welcome.class -------------------------------------------------------------------------------- /UserMangementApp/src/main/webapp/image/Be-agile-237x300.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/UserMangementApp/src/main/webapp/image/Be-agile-237x300.png -------------------------------------------------------------------------------- /Leet-Code/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/Week_03/MinimumPathSum.java=UTF-8 3 | encoding//src/Week_04/LRUCache.java=UTF-8 4 | -------------------------------------------------------------------------------- /Online Reservation System Project/Reservation/Passenger.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Online Reservation System Project/Reservation/Passenger.class -------------------------------------------------------------------------------- /Online Reservation System Project/Reservation/indian-rail.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Online Reservation System Project/Reservation/indian-rail.jpg -------------------------------------------------------------------------------- /UserMangementApp/src/main/webapp/image/extra-mile-237x300.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/UserMangementApp/src/main/webapp/image/extra-mile-237x300.png -------------------------------------------------------------------------------- /Online Reservation System Project/Reservation/Cancellation.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Online Reservation System Project/Reservation/Cancellation.class -------------------------------------------------------------------------------- /Online Reservation System Project/Reservation/Reservation.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Online Reservation System Project/Reservation/Reservation.class -------------------------------------------------------------------------------- /UserMangementApp/src/main/webapp/image/keep-learning-237x300.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/UserMangementApp/src/main/webapp/image/keep-learning-237x300.png -------------------------------------------------------------------------------- /Demo2/src/com/lti/model/Login.java: -------------------------------------------------------------------------------- 1 | package com.lti.model; 2 | 3 | public class Login { 4 | public static void main(String[] args) { 5 | System.out.println("THis is login "); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Online Reservation System Project/Reservation/Indian-Railway-network.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/Online Reservation System Project/Reservation/Indian-Railway-network.jpg -------------------------------------------------------------------------------- /UserMangementApp/src/main/webapp/image/solve-for-society-237x300_new-237x300.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/UserMangementApp/src/main/webapp/image/solve-for-society-237x300_new-237x300.png -------------------------------------------------------------------------------- /UserMangementApp/src/main/webapp/image/push-frontiers-of-innovation-237x300_robo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashleshk/Java-Online-Coding/main/UserMangementApp/src/main/webapp/image/push-frontiers-of-innovation-237x300_robo.jpg -------------------------------------------------------------------------------- /Online Reservation System Project/Reservation/Railway.ldb: -------------------------------------------------------------------------------- 1 | SUBHASH admin SUBHASH admin SUBHASH admin -------------------------------------------------------------------------------- /HackerEarth/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Leet-Code/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /hackerRank/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Leet-Code-Arrays/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Leet-Code/src/Week_02/ListNode.java: -------------------------------------------------------------------------------- 1 | package Week_02; 2 | 3 | public class ListNode { 4 | 5 | int val; 6 | ListNode next; 7 | ListNode() {} 8 | ListNode(int val) { this.val = val; } 9 | ListNode(int val, ListNode next) { this.val = val; this.next = next; } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /Demo2/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /hackerRank/src/com/week2/MinPageTurn.java: -------------------------------------------------------------------------------- 1 | package com.week2; 2 | 3 | import java.util.Scanner; 4 | 5 | public class MinPageTurn { 6 | public static void main(String[] args) { 7 | Scanner sc= new Scanner(System.in); 8 | int n = sc.nextInt(); 9 | int p = sc.nextInt(); 10 | 11 | System.out.println(Math.min(n/2-p/2, p/2)); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /UserMangementApp/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /JAVA W3-Resource Practice/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Leet-Code-Arrays/src/Prime.java: -------------------------------------------------------------------------------- 1 | public class Prime 2 | { 3 | public static void main(String[] args) 4 | { 5 | int ct=0,n=0,i=1,j=1; 6 | while(n<10) 7 | { 8 | j=1; 9 | ct=0; 10 | while(j<=i) 11 | { 12 | if(i%j==0) 13 | ct++; 14 | j++; 15 | } 16 | if(ct==2) 17 | { 18 | System.out.printf("%d ",i); 19 | n++; 20 | } 21 | i++; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /hackerRank/src/com/week1/EndOfFile.java: -------------------------------------------------------------------------------- 1 | package com.week1; 2 | 3 | import java.util.Scanner; 4 | 5 | public class EndOfFile { 6 | public static void main(String[] args) { 7 | Scanner in=new Scanner(System.in); 8 | String a; 9 | int i=1; 10 | while(in.hasNext()) 11 | { 12 | a=in.nextLine(); 13 | System.out.println(i+" "+a); 14 | i++; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Demo2/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Demo2 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 | -------------------------------------------------------------------------------- /Online Reservation System Project/Reservation/Connect.java: -------------------------------------------------------------------------------- 1 | import java.sql.*; 2 | public class Connect 3 | { 4 | public Connection con; 5 | public Connect() 6 | { 7 | try 8 | { 9 | Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); 10 | con=DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=Railway.mdb;DriverID=22"); 11 | } 12 | catch(Exception e1) 13 | { 14 | System.out.println("Connection failed:"+e1); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /Leet-Code/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | LeetCode 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 | -------------------------------------------------------------------------------- /HackerEarth/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | HackerEarth 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 | -------------------------------------------------------------------------------- /hackerRank/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | hackerRank 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 | -------------------------------------------------------------------------------- /UserMangementApp/src/main/webapp/Error.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" isErrorPage="true" %> 3 | 5 | 6 | 7 | Error 8 | 9 | 10 |
11 |

Error

12 |

<%=exception.getMessage() %>

13 |
14 | 15 | -------------------------------------------------------------------------------- /JAVA W3-Resource Practice/src/basics/Hello.java: -------------------------------------------------------------------------------- 1 | package basics; 2 | 3 | public class Hello { 4 | public static void main(String[] args) { 5 | System.out.println("Hello"); 6 | System.out.println("Ashlesh Khajbgae"); 7 | System.out.println(24+26); 8 | System.out.println(50/3); 9 | System.out.println(-5 + 8 * 6); 10 | System.out.println((55+9) % 9); 11 | System.out.println( 20 + -3*5 / 8); 12 | System.out.println(5 + 15 / 3 * 2 - 8 % 3); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Leet-Code-Arrays/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | LEETCODE-Arrays 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 | -------------------------------------------------------------------------------- /JAVA W3-Resource Practice/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | w3_Practice 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 | -------------------------------------------------------------------------------- /Leet-Code/src/Week_04/PrintMissingElement.java: -------------------------------------------------------------------------------- 1 | package Week_04; 2 | 3 | import java.util.Arrays; 4 | 5 | public class PrintMissingElement { 6 | 7 | public static int printMissingElement(int[] A) { 8 | Arrays.sort(A); 9 | int val=1; 10 | for(int i:A) 11 | { if(val==i) 12 | val++; 13 | } 14 | return val; 15 | } 16 | 17 | public static void main(String[] args) { 18 | int ar[] = {1,2,4,5}; 19 | int res= printMissingElement(ar); 20 | System.out.println(res); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Leet-Code-Arrays/src/RemoveDuplicateFromSortedArray.java: -------------------------------------------------------------------------------- 1 | 2 | public class RemoveDuplicateFromSortedArray { 3 | public int removeDuplicates(int[] nums) { 4 | if (nums== null) { 5 | return 0; 6 | } 7 | 8 | int j = 0; 9 | for (int i = j + 1; i < nums.length; i++) { 10 | if (nums[i] != nums[j]) { 11 | j++; 12 | nums[j] = nums[i]; 13 | } 14 | } 15 | return j+1; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Demo2/src/com/lti/model/User.java: -------------------------------------------------------------------------------- 1 | package com.lti.model; 2 | 3 | public class User { 4 | public void method(){ 5 | System.out.println("xc"); 6 | } 7 | 8 | public void method2(){ 9 | System.out.println("method 2"); 10 | } 11 | public void method3(){ 12 | System.out.println("method 3"); 13 | } 14 | 15 | public void method4(){ 16 | System.out.println("method 4"); 17 | } 18 | public static void main(String[] args) { 19 | 20 | int x =1; 21 | int y=101; 22 | System.out.println("ashlesh khajbage"); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /UserMangementApp/src/main/java/com/lti/dao/UserInfoDao.java: -------------------------------------------------------------------------------- 1 | package com.lti.dao; 2 | 3 | import java.util.Set; 4 | 5 | import com.lti.model.UserInfo; 6 | 7 | public interface UserInfoDao { 8 | public int registerUser(UserInfo userInfo); 9 | 10 | public boolean loginUser(String userName,String userPassword); 11 | 12 | public int updateUser(UserInfo userInfo); 13 | 14 | public int deleteUser(int userId); 15 | 16 | public UserInfo findUserById(int userId); 17 | 18 | public Set viewAllUsers(); 19 | } 20 | -------------------------------------------------------------------------------- /Leet-Code/src/Week_04/JumpGame.java: -------------------------------------------------------------------------------- 1 | package Week_04; 2 | 3 | public class JumpGame { 4 | public static boolean canJump(int[] nums) { 5 | 6 | int lastKnownPosition=nums.length-1; 7 | for(int i=nums.length-2;i>=0;i--) 8 | { 9 | if(i+nums[i]>=lastKnownPosition) 10 | lastKnownPosition=i; 11 | 12 | } 13 | return lastKnownPosition==0; 14 | } 15 | public static void main(String[] args) { 16 | int[] nums = {2,3,1,1,4}; 17 | System.out.println(canJump(nums)); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /hackerRank/src/com/week1/DataType.java: -------------------------------------------------------------------------------- 1 | package com.week1; 2 | 3 | import java.util.Scanner; 4 | 5 | public class DataType { 6 | static int solveMeFirst(int a, int b) { 7 | // Hint: Type return a+b; below 8 | return a+b; 9 | } 10 | 11 | public static void main(String[] args) { 12 | Scanner in = new Scanner(System.in); 13 | int a; 14 | a = in.nextInt(); 15 | int b; 16 | b = in.nextInt(); 17 | int sum; 18 | sum = solveMeFirst(a, b); 19 | System.out.println(sum); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /hackerRank/src/com/week1/StringFormatting.java: -------------------------------------------------------------------------------- 1 | package com.week1; 2 | 3 | import java.util.Scanner; 4 | 5 | public class StringFormatting { 6 | public static void main(String[] args) { 7 | Scanner sc=new Scanner(System.in); 8 | System.out.println("================================"); 9 | for(int i=0;i<3;i++) 10 | { 11 | String s1=sc.next(); 12 | int x=sc.nextInt(); 13 | System.out.printf("%-15s%03d%n", s1, x); 14 | } 15 | System.out.println("================================"); 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /HackerEarth/src/com/lti/day01/StringZoo.java: -------------------------------------------------------------------------------- 1 | package com.lti.day01; 2 | 3 | import java.util.Scanner; 4 | 5 | public class StringZoo { 6 | public static void main(String[] args) { 7 | Scanner sc = new Scanner(System.in); 8 | String str= sc.next(); 9 | int z=0,o=0; 10 | for(int i=0;i 2 | 3 | UserMangementApp 4 | 5 | index.html 6 | 7 | 8 | java.lang.Exception 9 | /Error.jsp 10 | 11 | -------------------------------------------------------------------------------- /HackerEarth/src/com/lti/day02/ArithmeticProgression.java: -------------------------------------------------------------------------------- 1 | package com.lti.day02; 2 | 3 | import java.util.Scanner; 4 | 5 | public class ArithmeticProgression { 6 | public static void main(String args[] ) throws Exception { 7 | 8 | Scanner s = new Scanner(System.in); 9 | int t = s.nextInt(); 10 | while(t-->0) 11 | { 12 | int a =s.nextInt(); 13 | int b =s.nextInt(); 14 | int c =s.nextInt(); 15 | int res =((Math.abs((c-b)-(b-a)))+1)/2; 16 | System.out.println(res); 17 | } 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /hackerRank/src/com/week2/DivisibleSumPairs.java: -------------------------------------------------------------------------------- 1 | package com.week2; 2 | 3 | public class DivisibleSumPairs { 4 | static int divisibleSumPairs(int n, int k, int[] ar) { 5 | int count=0; 6 | for(int i=0;i0) 10 | { 11 | long c=sc.nextLong(); 12 | long n=sc.nextLong(); 13 | long k=c/n; 14 | long min=(n*(n+1)/2); 15 | if(c0) 11 | { 12 | int r=s.nextInt(); 13 | int c=s.nextInt(); 14 | char[][] mat=new char[r][c]; 15 | for(int i=0;i nums2[j]) { 11 | for (int j2 = m - 1; j2 >= i; j2--) { 12 | nums1[j2+1] = nums1[j2]; 13 | } 14 | m++; 15 | nums1[i] = nums2[j]; 16 | j++; 17 | } 18 | i++; 19 | } 20 | 21 | while (j < n) { 22 | nums1[i] = nums2[j]; 23 | i++; 24 | j++; 25 | } 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /hackerRank/src/com/week3/StringToken.java: -------------------------------------------------------------------------------- 1 | package com.week3; 2 | 3 | import java.util.Scanner; 4 | 5 | public class StringToken { 6 | public static void main(String[] args) { 7 | Scanner scan = new Scanner(System.in); 8 | scan.useDelimiter("\\Z"); 9 | String s = scan.next().trim(); 10 | if (s.length() > 0) { 11 | String[] tokens = s.split("[!,?._'@\\s]+"); 12 | System.out.println(tokens.length); 13 | for(String token : tokens) { 14 | System.out.println(token); 15 | } 16 | } else { 17 | System.out.println(0); 18 | } 19 | scan.close(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /UserMangementApp/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Leet-Code/src/Week_04/BitwiseANDofnoRange.java: -------------------------------------------------------------------------------- 1 | package Week_04; 2 | /*Bitwise AND of Numbers Range 3 | 4 | Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive. 5 | 6 | Example 1: 7 | 8 | Input: [5,7] 9 | Output: 4 10 | Example 2: 11 | 12 | Input: [0,1] 13 | Output: 0 14 | * */ 15 | public class BitwiseANDofnoRange { 16 | public static int rangeBitwiseAnd(int m, int n) { 17 | int i=0; 18 | while(m!=n) 19 | { 20 | m>>=1; 21 | n>>=1; 22 | i++; 23 | } 24 | return m<0) 10 | { int count=0; 11 | int n=sc.nextInt(); 12 | String str=sc.next(); 13 | char[] c = str.toCharArray(); 14 | for(int i=0;i 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /hackerRank/src/com/week2/DayPrinting.java: -------------------------------------------------------------------------------- 1 | package com.week2; 2 | 3 | import java.util.Scanner; 4 | 5 | public class DayPrinting { 6 | 7 | static String dayOfProgrammer(int year) { 8 | if( year == 1918 ) return "26.09.1918"; 9 | if( isLeap( year ) ) return "12.09." + Integer.toString( year ); 10 | else return "13.09." + Integer.toString( year ); 11 | 12 | } 13 | 14 | static boolean isLeap( int year ) { 15 | 16 | if( year % 4 != 0 ) return false; 17 | if( year > 1918 && year % 100 == 0 && year % 400 != 0 ) return false; 18 | return true; 19 | 20 | } 21 | 22 | public static void main(String[] args) { 23 | Scanner sc= new Scanner(System.in) ; 24 | int year=sc.nextInt(); 25 | dayOfProgrammer(year); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /HackerEarth/src/com/lti/day01/GoingToOffice.java: -------------------------------------------------------------------------------- 1 | package com.lti.day01; 2 | 3 | import java.util.Scanner; 4 | 5 | public class GoingToOffice { 6 | public static void main(String args[] ) throws Exception { 7 | Scanner sc=new Scanner(System.in); 8 | long d = sc.nextInt(); 9 | long oc = sc.nextInt(); 10 | long of = sc.nextInt(); 11 | long od = sc.nextInt(); 12 | 13 | long cs = sc.nextInt(); 14 | long cb = sc.nextInt(); 15 | long cm = sc.nextInt(); 16 | long cd = sc.nextInt(); 17 | 18 | long online = oc+(d-of)*od; 19 | long classic = cb+(d/cs)*cm + cd*d; 20 | if(online<=classic) 21 | System.out.println("Online Taxi"); 22 | else 23 | System.out.println("Classic Taxi"); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /UserMangementApp/.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.methodParameters=do not generate 4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 5 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 6 | org.eclipse.jdt.core.compiler.compliance=1.8 7 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 8 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 9 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 10 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 12 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 13 | org.eclipse.jdt.core.compiler.source=1.8 14 | -------------------------------------------------------------------------------- /Leet-Code-Arrays/src/SquareofSortedArray.java: -------------------------------------------------------------------------------- 1 | import java.util.Arrays; 2 | 3 | /*Squares of a Sorted Array 4 | 5 | Given an array of integers A sorted in non-decreasing order, return an array of the squares of each number, also in sorted non-decreasing order. 6 | 7 | 8 | 9 | Example 1: 10 | 11 | Input: [-4,-1,0,3,10] 12 | Output: [0,1,9,16,100] 13 | Example 2: 14 | 15 | Input: [-7,-3,2,3,11] 16 | Output: [4,9,9,49,121] 17 | 18 | 19 | Note: 20 | 21 | 1 <= A.length <= 10000 22 | -10000 <= A[i] <= 10000 23 | A is sorted in non-decreasing order. 24 | 25 | * */ 26 | public class SquareofSortedArray { 27 | public int[] sortedSquares(int[] A) { 28 | for(int i=0;iscores[i]) 15 | { 16 | min=scores[i];rmin++; 17 | } 18 | } 19 | int[] res ={rmax,rmin}; 20 | return res; 21 | } 22 | public static void main(String[] args) { 23 | int a[] = {3, 4, 21, 36 ,10 ,28 ,35 ,5, 24 ,42}; 24 | int[] res = breakingRecords(a); 25 | for(int i:res) 26 | System.out.print(i+" "); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /hackerRank/src/com/week2/MaxElectronicShop.java: -------------------------------------------------------------------------------- 1 | package com.week2; 2 | 3 | import java.util.Arrays; 4 | 5 | public class MaxElectronicShop { 6 | static int getMoneySpent(int[] keyboards, int[] drives, int b) { 7 | Arrays.sort(keyboards); 8 | Arrays.sort(drives); 9 | int max=-1; 10 | for(int i=keyboards.length-1;i>=0;i--) 11 | { 12 | for(int j=drives.length-1;j>=0;j--) 13 | { 14 | if(b>=(drives[j]+keyboards[i]) && max<(drives[j]+keyboards[i])) 15 | max=drives[j]+keyboards[i]; 16 | } 17 | } 18 | return max; 19 | } 20 | public static void main(String[] args) { 21 | int[] keyboards= {3 ,1}; 22 | int[] drives= {5, 2, 8}; 23 | int b =10 ; 24 | getMoneySpent(keyboards, drives, b); 25 | } 26 | 27 | } 28 | 29 | 30 | -------------------------------------------------------------------------------- /hackerRank/src/com/week1/HelloWorld.java: -------------------------------------------------------------------------------- 1 | package com.week1; 2 | 3 | import java.util.Scanner; 4 | 5 | public class HelloWorld { 6 | public static void main(String[] args) { 7 | // Create a Scanner object to read input from stdin. 8 | Scanner scan = new Scanner(System.in); 9 | 10 | // Read a full line of input from stdin and save it to our variable, inputString. 11 | String inputString = scan.nextLine(); 12 | 13 | // Close the scanner object, because we've finished reading 14 | // all of the input from stdin needed for this challenge. 15 | scan.close(); 16 | 17 | // Print a string literal saying "Hello, World." to stdout. 18 | System.out.println("Hello, World."); 19 | System.out.println(inputString); 20 | // TODO: Write a line of code here that prints the contents of inputString to stdout. 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /JAVA W3-Resource Practice/src/basics/Numberoperator.java: -------------------------------------------------------------------------------- 1 | package basics; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Numberoperator { 6 | public static void main(String[] args) { 7 | Scanner in = new Scanner(System.in); 8 | 9 | System.out.print("Input first number: "); 10 | int num1 = in.nextInt(); 11 | 12 | System.out.print("Input second number: "); 13 | int num2 = in.nextInt(); 14 | 15 | 16 | System.out.println(num1 + " + " + num2 + " = " + 17 | (num1 + num2)); 18 | 19 | System.out.println(num1 + " - " + num2 + " = " + 20 | (num1 - num2)); 21 | 22 | System.out.println(num1 + " x " + num2 + " = " + 23 | (num1 * num2)); 24 | 25 | System.out.println(num1 + " / " + num2 + " = " + 26 | (num1 / num2)); 27 | 28 | System.out.println(num1 + " mod " + num2 + " = " + 29 | (num1 % num2)); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /hackerRank/src/com/week2/MigratoryBirds.java: -------------------------------------------------------------------------------- 1 | package com.week2; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.Scanner; 6 | 7 | public class MigratoryBirds { 8 | static int migratoryBirds(int n,List arr) { 9 | 10 | int ary[] = new int[n]; 11 | for(int i : arr ) 12 | ary[i]++; 13 | int max = 0,maxpos=0; 14 | for(int i = 0 ; i < n ; i++) 15 | { 16 | if(ary[i] > max) 17 | { 18 | max = ary[i]; 19 | maxpos = i; 20 | } 21 | } 22 | return maxpos; 23 | } 24 | public static void main(String[] args) { 25 | List ar =new ArrayList(); 26 | Scanner sc = new Scanner(System.in); 27 | int n = sc.nextInt(); 28 | for(int i = 0 ;i=m) 10 | return (k-m)/2+(k-m)%2; 11 | if(m%n==0) 12 | return (1+step(k,m/n,n)); 13 | else 14 | { 15 | x=(m/n+1)*n; 16 | return ((x-m)/2+(x-m)%2+step(k,x,n)); 17 | } 18 | } 19 | public static void main(String args[] ) throws Exception { 20 | 21 | Scanner s = new Scanner(System.in); 22 | int t = s.nextInt(); 23 | while(t-->0) 24 | { 25 | int k=s.nextInt(); 26 | int m=s.nextInt(); 27 | int n=s.nextInt(); 28 | System.out.println(step(k,m,n)); 29 | System.out.println(-1); 30 | } 31 | 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /hackerRank/src/com/week2/BirthdayChocolate.java: -------------------------------------------------------------------------------- 1 | package com.week2; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.Scanner; 6 | 7 | public class BirthdayChocolate { 8 | static int birthday(List s, int d, int m) { 9 | int sum=0,ways=0; 10 | for(int i=0;i ar =new ArrayList(); 25 | Scanner sc = new Scanner(System.in); 26 | int n = sc.nextInt(); 27 | for(int i = 0 ;i compareTriplets(List a, List b) { 8 | List res = new ArrayList(); 9 | int ac=0,bc=0; 10 | 11 | for (int i = 0; i < 3; i++) { 12 | if(a.get(i)>b.get(i)) 13 | { 14 | ac++; 15 | } 16 | else if(a.get(i)n-cnt-1;i--) 26 | nums[i]=0; 27 | 28 | } 29 | public static void main(String[] args) { 30 | int ar[] = {0,1,0,3,12}; 31 | moveZeroes(ar); 32 | for(int i=0;i max) { 24 | max = count; 25 | } 26 | count = 0; 27 | } 28 | } 29 | if (count > max) { 30 | max = count; 31 | } 32 | return max; 33 | } 34 | public static void main(String[] args) { 35 | int[] nums= {1,1,0,1,1,1}; 36 | System.out.println(findMaxConsecutiveOnes(nums)); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Leet-Code-Arrays/src/ReplaceValuebyMaxfromRight.java: -------------------------------------------------------------------------------- 1 | /*Replace Elements with Greatest Element on Right Side 2 | Given an array arr, replace every element in that array with the greatest element among the elements to its right, and replace the last element with -1. 3 | 4 | After doing so, return the array. 5 | 6 | 7 | 8 | Example 1: 9 | 10 | Input: arr = [17,18,5,4,6,1] 11 | Output: [18,6,6,6,1,-1] 12 | 13 | 14 | Constraints: 15 | 16 | 1 <= arr.length <= 10^4 17 | 1 <= arr[i] <= 10^5 18 | * */ 19 | public class ReplaceValuebyMaxfromRight { 20 | public static int[] replaceElements(int[] arr) { 21 | 22 | for(int i=0;ii;j--) 26 | { 27 | if(maxsofar= 3 8 | There exists some i with 0 < i < A.length - 1 such that: 9 | A[0] < A[1] < ... A[i-1] < A[i] 10 | A[i] > A[i+1] > ... > A[A.length - 1] 11 | 12 | Example 1: 13 | 14 | Input: [2,1] 15 | Output: false 16 | Example 2: 17 | 18 | Input: [3,5,5] 19 | Output: false 20 | Example 3: 21 | 22 | Input: [0,3,2,1] 23 | Output: true 24 | 25 | * */ 26 | public class ValidMountainArray { 27 | public static boolean validMountainArray(int[] A) { 28 | if(A.length<3) return false; 29 | boolean asc=false, dsc=false; 30 | for(int i=1;iA[i-1]) asc=true; 33 | if(!asc && A[i]<=A[i-1]) return false; 34 | if(asc && A[i] < A[i-1]) dsc =true; 35 | if(dsc && A[i]>=A[i-1]) return false; 36 | } 37 | return asc && dsc; 38 | } 39 | public static void main(String[] args) { 40 | int[] A= {0,3,5,5}; 41 | System.out.println(validMountainArray(A)); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Online Reservation System Project/Reservation/Welcome.java: -------------------------------------------------------------------------------- 1 | import java.awt.*; 2 | import javax.swing.*; 3 | class Welcome implements Runnable 4 | { 5 | JFrame f; 6 | JLabel l1,l2,l3; 7 | Thread t; 8 | Login l; 9 | ImageIcon img; 10 | Welcome() 11 | { 12 | img=new ImageIcon("indian-rail.jpg"); 13 | t=new Thread(this); 14 | f=new JFrame("Welcome"); 15 | f.getContentPane().setLayout(null); 16 | f.getContentPane().setBackground(Color.yellow); 17 | l1=new JLabel("OnLine Reservation"); 18 | l1.setBounds(250,300,900,50); 19 | l1.setFont(new Font("Courier new",Font.BOLD,60)); 20 | l1.setForeground(Color.red); 21 | l2=new JLabel(" _By Dushmanta Pradhan"); 22 | l2.setFont(new Font("Courier new",Font.BOLD,35)); 23 | l2.setBounds(350,380,800,40); 24 | l2.setForeground(Color.red); 25 | l3=new JLabel(img); 26 | l3.setBounds(0,0,1300,1000); 27 | f.getContentPane().add(l1); 28 | f.getContentPane().add(l2); 29 | f.getContentPane().add(l3); 30 | f.setSize(1300,1000); 31 | f.setVisible(true); 32 | t.start(); 33 | } 34 | public void run() 35 | { 36 | int x=1; 37 | while(x<=5) 38 | { 39 | try 40 | { 41 | Thread.sleep(1000); 42 | } 43 | catch(Exception e) 44 | {} 45 | x++; 46 | } 47 | f.setVisible(false); 48 | l=new Login(); 49 | } 50 | } 51 | 52 | -------------------------------------------------------------------------------- /UserMangementApp/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | UserMangementApp 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.wst.common.project.facet.core.builder 15 | 16 | 17 | 18 | 19 | org.eclipse.wst.validation.validationbuilder 20 | 21 | 22 | 23 | 24 | org.eclipse.m2e.core.maven2Builder 25 | 26 | 27 | 28 | 29 | 30 | org.eclipse.jem.workbench.JavaEMFNature 31 | org.eclipse.wst.common.modulecore.ModuleCoreNature 32 | org.eclipse.jdt.core.javanature 33 | org.eclipse.m2e.core.maven2Nature 34 | org.eclipse.wst.common.project.facet.core.nature 35 | org.eclipse.wst.jsdt.core.jsNature 36 | 37 | 38 | -------------------------------------------------------------------------------- /Leet-Code/src/Week_03/ValidParenThesisString.java: -------------------------------------------------------------------------------- 1 | package Week_03; 2 | 3 | import java.util.Stack; 4 | 5 | public class ValidParenThesisString { 6 | public static boolean checkValidString(String s) { 7 | Stack stk1 = new Stack<>(); 8 | Stack stk2 = new Stack<>(); 9 | for(int i=0;i stk2.pop()) 33 | return false; 34 | } 35 | return stk1.isEmpty(); 36 | } 37 | 38 | public static void main(String[] args) { 39 | String str = "(*)"; 40 | System.out.println(checkValidString(str)); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Leet-Code/src/Week_04/MaximalSquare.java: -------------------------------------------------------------------------------- 1 | package Week_04; 2 | /*Maximal Square 3 | 4 | Solution 5 | Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area. 6 | 7 | Example: 8 | 9 | Input: 10 | 11 | 1 0 1 0 0 12 | 1 0 1 1 1 13 | 1 1 1 1 1 14 | 1 0 0 1 0 15 | 16 | Output: 4 17 | * */ 18 | public class MaximalSquare { 19 | public static int maximalSquare(char[][] matrix) { 20 | if(matrix==null || matrix.length==0) 21 | return 0; 22 | int m = matrix.length; 23 | int n = matrix[0].length; 24 | int[][] dp = new int[m][n]; 25 | int max=-1; 26 | for(int i=0;i 0) 38 | { 39 | digits++; 40 | number /= 10; 41 | } 42 | if(digits % 2 == 0) result++; 43 | } 44 | return result; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Leet-Code-Arrays/src/RemoveElement.java: -------------------------------------------------------------------------------- 1 | /*Remove Element 2 | 3 | Given an array nums and a value val, remove all instances of that value in-place and return the new length. 4 | 5 | Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory. 6 | 7 | The order of elements can be changed. It doesn't matter what you leave beyond the new length. 8 | 9 | Example 1: 10 | 11 | Given nums = [3,2,2,3], val = 3, 12 | 13 | Your function should return length = 2, with the first two elements of nums being 2. 14 | 15 | It doesn't matter what you leave beyond the returned length. 16 | Example 2: 17 | 18 | Given nums = [0,1,2,2,3,0,4,2], val = 2, 19 | 20 | Your function should return length = 5, with the first five elements of nums containing 0, 1, 3, 0, and 4. 21 | 22 | Note that the order of those five elements can be arbitrary. 23 | 24 | It doesn't matter what values are set beyond the returned length. 25 | * */ 26 | public class RemoveElement { 27 | public int removeElement(int[] nums, int val) { 28 | int idx=0; 29 | int len = nums.length; 30 | for(int i=0;i map = new HashMap(); 23 | map.put(0, -1); 24 | int maxLength = 0; 25 | for(int index = 0; index < nums.length; index++) { 26 | total = total + (nums[index] == 0 ? -1 : 1); 27 | if(map.containsKey(total)) { 28 | maxLength = Math.max(maxLength, index - map.get(total)); 29 | } else { 30 | map.put(total, index); 31 | } 32 | } 33 | return maxLength; 34 | } 35 | public static void main(String[] args) { 36 | int arr[]= {0,1}; 37 | System.out.println(findMaxLength(arr)); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /hackerRank/src/com/week1/GradesROund.java: -------------------------------------------------------------------------------- 1 | package com.week1; 2 | 3 | import java.util.*; 4 | 5 | public class GradesROund { 6 | 7 | public static List gradingStudents(List grades) { 8 | // Write your code here 9 | 10 | List ans = new ArrayList(); 11 | for(int marks:grades){ 12 | if(marks < 38 || marks % 5 <= 2){ 13 | ans.add(marks); 14 | }else if(marks % 5 > 2){ 15 | int add = 5 -(marks % 5); 16 | ans.add(marks + add); 17 | } 18 | } 19 | return ans; 20 | } 21 | public static void main(String[] args) { 22 | List ar = new ArrayList(); 23 | ar.add(73) ; 24 | ar.add(67) ; 25 | ar.add(38); 26 | ar.add(33); 27 | List res=gradingStudents(ar); 28 | System.out.println(res); 29 | 30 | Scanner scan = new Scanner(System.in); 31 | int x=scan.nextInt(); 32 | double y = scan.nextDouble(); 33 | scan.nextLine(); 34 | String s = scan.nextLine(); 35 | 36 | 37 | // Write your code here. 38 | 39 | System.out.println("String: " + s); 40 | System.out.println("Double: " + y); 41 | System.out.println("Int: " + s); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /hackerRank/src/com/week2/Solution.java: -------------------------------------------------------------------------------- 1 | package com.week2; 2 | 3 | import java.util.*; 4 | import java.security.*; 5 | public class Solution { 6 | public static void main(String[] args) { 7 | 8 | DoNotTerminate.forbidExit(); 9 | 10 | try { 11 | Scanner in = new Scanner(System.in); 12 | int n = in .nextInt(); 13 | in.close(); 14 | //String s=???; Complete this line below 15 | String s = Integer.toString(n); 16 | //Write your code here 17 | 18 | 19 | if (n == Integer.parseInt(s)) { 20 | System.out.println("Good job"); 21 | } else { 22 | System.out.println("Wrong answer."); 23 | } 24 | } catch (DoNotTerminate.ExitTrappedException e) { 25 | System.out.println("Unsuccessful Termination!!"); 26 | } 27 | } 28 | } 29 | 30 | //The following class will prevent you from terminating the code using exit(0)! 31 | class DoNotTerminate { 32 | 33 | public static class ExitTrappedException extends SecurityException { 34 | 35 | private static final long serialVersionUID = 1; 36 | } 37 | 38 | public static void forbidExit() { 39 | final SecurityManager securityManager = new SecurityManager() { 40 | @Override 41 | public void checkPermission(Permission permission) { 42 | if (permission.getName().contains("exitVM")) { 43 | throw new ExitTrappedException(); 44 | } 45 | } 46 | }; 47 | System.setSecurityManager(securityManager); 48 | } 49 | } 50 | 51 | -------------------------------------------------------------------------------- /Leet-Code/src/Week_03/ProdOfArrayExceptSelf.java: -------------------------------------------------------------------------------- 1 | package Week_03; 2 | /*Product of Array Except Self 3 | 4 | Given an array nums of n integers where n > 1, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i]. 5 | 6 | Example: 7 | 8 | Input: [1,2,3,4] 9 | Output: [24,12,8,6] 10 | Constraint: It's guaranteed that the product of the elements of any prefix or suffix of the array (including the whole array) fits in a 32 bit integer. 11 | 12 | Note: Please solve it without division and in O(n). 13 | 14 | Follow up: 15 | Could you solve it with constant space complexity? (The output array does not count as extra space for the purpose of space complexity analysis.) 16 | * */ 17 | public class ProdOfArrayExceptSelf { 18 | public static int[] productExceptSelf(int[] nums) { 19 | int l = nums.length; 20 | int[] rst = new int[l]; 21 | rst[0] = 1; 22 | for (int i = 1; i < l; i++) { 23 | rst[i] = rst[i-1] * nums[i-1]; 24 | } 25 | int right = 1; 26 | for (int i = l-1; i >= 0; i--) { 27 | rst[i] *= right; 28 | right = right * nums[i]; 29 | } 30 | return rst; 31 | 32 | } 33 | public static void main(String[] args) { 34 | int arr[] = {1,2,3,4}; 35 | arr = productExceptSelf(arr); 36 | for(int i=0;ial=new ArrayList(); 10 | public MinStack() 11 | { 12 | 13 | } 14 | public void push(int x) { 15 | if(al.size()!=0) 16 | { 17 | al.add(0,x); 18 | return; 19 | } 20 | else{ 21 | al.add(x); 22 | return; 23 | } 24 | } 25 | public void pop() 26 | { 27 | min=Integer.MAX_VALUE; 28 | if(al.size()==0) 29 | { 30 | return; 31 | } 32 | else{ 33 | al.remove(0); 34 | } 35 | } 36 | 37 | public int top() 38 | { 39 | if(al.size()==0) 40 | { 41 | return -1; 42 | } 43 | return al.get(0); 44 | } 45 | public int getMin() 46 | { 47 | for(int i:al) 48 | { 49 | if(i set = new HashSet<>(); 26 | set.add(n); 27 | while(n != 1){ 28 | int sum = 0; 29 | while(n > 0){ 30 | int digit = n % 10; 31 | n /= 10; 32 | sum += (digit * digit); 33 | } 34 | n = sum; 35 | if(set.contains(n)){ 36 | return false; 37 | } 38 | set.add(n); 39 | } 40 | return true; 41 | } 42 | public static void main(String[] args) { 43 | System.out.println(isHappy(19)); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Leet-Code-Arrays/src/ThirdMaxNumber.java: -------------------------------------------------------------------------------- 1 | /*Third Maximum Number 2 | 3 | Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time complexity must be in O(n). 4 | 5 | Example 1: 6 | Input: [3, 2, 1] 7 | 8 | Output: 1 9 | 10 | Explanation: The third maximum is 1. 11 | Example 2: 12 | Input: [1, 2] 13 | 14 | Output: 2 15 | 16 | Explanation: The third maximum does not exist, so the maximum (2) is returned instead. 17 | Example 3: 18 | Input: [2, 2, 3, 1] 19 | 20 | Output: 1 21 | 22 | Explanation: Note that the third maximum here means the third maximum distinct number. 23 | Both numbers with value 2 are both considered as second maximum.*/ 24 | public class ThirdMaxNumber { 25 | public int thirdMax(int[] nums) { 26 | Integer max1=null; 27 | Integer max2=null; 28 | Integer max3=null; 29 | for(Integer i:nums) 30 | { 31 | if(i.equals(max1) || i.equals(max2) || i.equals(max3)) 32 | continue; 33 | 34 | if(max1==null|| i>max1){ 35 | max3=max2; 36 | max2=max1; 37 | max1=i; 38 | }else if(max2==null|| i>max2){ 39 | max3=max2; 40 | max2=i; 41 | }else if(max3==null|| i>max3){ 42 | max3=i; 43 | } 44 | 45 | } 46 | 47 | return (max3==null)?max1:max3; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /hackerRank/src/com/week2/BetweenSets.java: -------------------------------------------------------------------------------- 1 | package com.week2; 2 | 3 | import java.util.Scanner; 4 | 5 | public class BetweenSets { 6 | public static void main(String[] args) { 7 | Scanner in = new Scanner(System.in); 8 | int n = in.nextInt(); 9 | int m = in.nextInt(); 10 | int[] a = new int[n]; 11 | for(int a_i=0; a_i < n; a_i++){ 12 | a[a_i] = in.nextInt(); 13 | } 14 | int[] b = new int[m]; 15 | for(int b_i=0; b_i < m; b_i++){ 16 | b[b_i] = in.nextInt(); 17 | } 18 | 19 | int f = lcm(a); 20 | int l = gcd(b); 21 | int count = 0; 22 | for(int i = f, j =2; i<=l; i=f*j,j++){ 23 | if(l%i==0){ count++;} 24 | } 25 | System.out.println(count); 26 | } 27 | 28 | 29 | private static int gcd(int a, int b) { 30 | while (b > 0) { 31 | int temp = b; 32 | b = a % b; // % is remainder 33 | a = temp; 34 | } 35 | return a; 36 | } 37 | 38 | private static int gcd(int[] input) { 39 | int result = input[0]; 40 | for (int i = 1; i < input.length; i++) { 41 | result = gcd(result, input[i]); 42 | } 43 | return result; 44 | } 45 | 46 | private static int lcm(int a, int b) { 47 | return a * (b / gcd(a, b)); 48 | } 49 | 50 | private static int lcm(int[] input) { 51 | int result = input[0]; 52 | for (int i = 1; i < input.length; i++) { 53 | result = lcm(result, input[i]); 54 | } 55 | return result; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Leet-Code/src/Week_02/DiameterofBinaryTree.java: -------------------------------------------------------------------------------- 1 | package Week_02; 2 | /* 3 | * Diameter of Binary Tree 4 | 5 | Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of the longest path between any two nodes in a tree. This path may or may not pass through the root. 6 | 7 | Example: 8 | Given a binary tree 9 | 1 10 | / \ 11 | 2 3 12 | / \ 13 | 4 5 14 | Return 3, which is the length of the path [4,2,1,3] or [5,2,1,3]. 15 | 16 | Note: The length of path between two nodes is represented by the number of edges between them. 17 | * */ 18 | class TreeNode{ 19 | int val; 20 | TreeNode left; 21 | TreeNode right; 22 | TreeNode() {} 23 | TreeNode(int val) { this.val = val; } 24 | TreeNode(int val, TreeNode left, TreeNode right) { 25 | this.val = val; 26 | this.left = left; 27 | this.right = right; 28 | } 29 | } 30 | public class DiameterofBinaryTree { 31 | int res=0; 32 | public int diameterOfBinaryTree(TreeNode root) { 33 | diameter(root); 34 | return res; 35 | } 36 | public int diameter(TreeNode root){ 37 | if(root!=null){ 38 | int left=diameter(root.left); 39 | int right=diameter(root.right); 40 | res=Math.max(res, left+right); 41 | return 1+Math.max(left,right); 42 | } 43 | return 0; 44 | } 45 | public static void main(String[] args) { 46 | 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /UserMangementApp/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | com.lti 5 | UserMangementApp 6 | 0.0.1-SNAPSHOT 7 | 8 | 1.8 9 | 1.8 10 | 11 | war 12 | 13 | 14 | javax.servlet 15 | javax.servlet-api 16 | 3.1.0 17 | provided 18 | 19 | 20 | javax.servlet.jsp 21 | javax.servlet.jsp-api 22 | 2.3.1 23 | provided 24 | 25 | 26 | 27 | taglibs 28 | standard 29 | 1.1.2 30 | 31 | 32 | 33 | 34 | javax.servlet 35 | jstl 36 | 1.1.2 37 | 38 | 39 | com.oracle.database.jdbc 40 | ojdbc6 41 | 11.2.0.4 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Leet-Code/src/Week_02/MiddleOfLInkedList.java: -------------------------------------------------------------------------------- 1 | package Week_02; 2 | /*Middle of the Linked List 3 | 4 | Given a non-empty, singly linked list with head node head, return a middle node of linked list. 5 | 6 | If there are two middle nodes, return the second middle node. 7 | 8 | 9 | Example 1: 10 | 11 | Input: [1,2,3,4,5] 12 | Output: Node 3 from this list (Serialization: [3,4,5]) 13 | The returned node has value 3. (The judge's serialization of this node is [3,4,5]). 14 | Note that we returned a ListNode object ans, such that: 15 | ans.val = 3, ans.next.val = 4, ans.next.next.val = 5, and ans.next.next.next = NULL. 16 | Example 2: 17 | 18 | Input: [1,2,3,4,5,6] 19 | Output: Node 4 from this list (Serialization: [4,5,6]) 20 | Since the list has two middle nodes with values 3 and 4, we return the second one. 21 | 22 | 23 | Note: 24 | 25 | The number of nodes in the given list will be between 1 and 100. 26 | * */ 27 | 28 | public class MiddleOfLInkedList { 29 | public ListNode middleNode(ListNode head) { 30 | int count=getSize(head)/2; 31 | ListNode temp = head; 32 | while(count--!=0) 33 | { 34 | temp=temp.next; 35 | } 36 | return temp; 37 | } 38 | public int getSize(ListNode head) 39 | { 40 | ListNode temp = head; 41 | int size=0; 42 | while(temp!=null) 43 | { 44 | size++; 45 | temp=temp.next; 46 | } 47 | return size; 48 | } 49 | public static void main(String[] args) { 50 | 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /hackerRank/src/com/week3/StringIntro.java: -------------------------------------------------------------------------------- 1 | package com.week3; 2 | 3 | import java.util.Scanner; 4 | 5 | public class StringIntro { 6 | public static String getSmallestAndLargest(String s, int k) { 7 | 8 | String smallest = s.substring(0,k); 9 | String largest = ""; 10 | for(int i=0;i0) 15 | largest = s.substring(i,i+k); 16 | } 17 | return smallest + "\n"+largest; 18 | } 19 | 20 | public static void main(String[] args) { 21 | 22 | Scanner sc=new Scanner(System.in); 23 | /* String A=sc.next(); 24 | String B=sc.next(); 25 | 26 | System.out.println(A.length()+B.length()); 27 | System.out.println(A.compareTo(B)>0 ? "Yes":"No"); 28 | System.out.println(A.substring(0,1).toUpperCase()+A.substring(1,A.length())+" "+B.substring(0,1).toUpperCase()+B.substring(1,B.length())); 29 | */ 30 | String S = sc.next(); 31 | int start = sc.nextInt(); 32 | int end = sc.nextInt(); 33 | System.out.println(S.substring(start,end)); 34 | 35 | // Scanner sc=new Scanner(System.in); 36 | String A=sc.next(); 37 | String B=""; 38 | for(int i=A.length()-1;i>=0;i--) 39 | { 40 | B=B+A.charAt(i); 41 | } 42 | System.out.println(A.equalsIgnoreCase(B)?"Yes" :"No"); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Leet-Code/src/Week_01/GroupAnagram.java: -------------------------------------------------------------------------------- 1 | package Week_01; 2 | 3 | import java.util.*; 4 | 5 | /*Group Anagrams 6 | 7 | Given an array of strings, group anagrams together. 8 | 9 | Example: 10 | 11 | Input: ["eat", "tea", "tan", "ate", "nat", "bat"], 12 | Output: 13 | [ 14 | ["ate","eat","tea"], 15 | ["nat","tan"], 16 | ["bat"] 17 | ] 18 | Note: 19 | 20 | All inputs will be in lowercase. 21 | The order of your output does not matter. 22 | * */ 23 | public class GroupAnagram { 24 | public static List> groupAnagrams(String[] strs) { 25 | Map> map =new HashMap<>(); 26 | int n =strs.length; 27 | for(int i=0;i list =new ArrayList<>(); 38 | list.add(s); 39 | map.put(s2,list); 40 | } 41 | 42 | } 43 | List> res= new ArrayList<>(); 44 | for(String s : map.keySet()) 45 | { 46 | List list = map.get(s); 47 | res.add(list); 48 | } 49 | return res; 50 | } 51 | public static void main(String[] args) { 52 | String str[] = {"eat", "tea", "tan", "ate", "nat", "bat"}; 53 | List> res= groupAnagrams(str); 54 | System.out.println(res); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Leet-Code/src/Week_03/MinimumPathSum.java: -------------------------------------------------------------------------------- 1 | package Week_03; 2 | /*Minimum Path Sum 3 | 4 | Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path. 5 | 6 | Note: You can only move either down or right at any point in time. 7 | 8 | Example: 9 | 10 | Input: 11 | [ 12 | [1,3,1], 13 | [1,5,1], 14 | [4,2,1] 15 | ] 16 | Output: 7 17 | Explanation: Because the path 1→3→1→1→1 minimizes the sum. 18 | * */ 19 | public class MinimumPathSum { 20 | public static int minPathSum(int[][] grid) { 21 | int[][] dp = new int[grid.length][grid[0].length]; 22 | for(int i=0;i"); 41 | out.println("var res=confirm('deadbeef');"); 42 | out.println(""); 43 | return false; 44 | } 45 | 46 | 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /UserMangementApp/src/main/java/com/lti/controller/EditServlet.java: -------------------------------------------------------------------------------- 1 | package com.lti.controller; 2 | 3 | import java.io.IOException; 4 | import java.sql.SQLException; 5 | 6 | import javax.servlet.RequestDispatcher; 7 | import javax.servlet.ServletException; 8 | import javax.servlet.annotation.WebServlet; 9 | import javax.servlet.http.HttpServlet; 10 | import javax.servlet.http.HttpServletRequest; 11 | import javax.servlet.http.HttpServletResponse; 12 | 13 | import com.lti.dao.UserInfoDao; 14 | import com.lti.dao.UserInfoDaoImpl; 15 | 16 | import com.lti.model.UserInfo; 17 | 18 | 19 | 20 | 21 | /** 22 | * Servlet implementation class EditServlet 23 | */ 24 | @WebServlet("/edit") 25 | public class EditServlet extends HttpServlet { 26 | private static final long serialVersionUID = 1L; 27 | private UserInfoDao userDAO; 28 | 29 | public void init() { 30 | userDAO = new UserInfoDaoImpl(); 31 | } 32 | 33 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 34 | 35 | doGet(request, response); 36 | } 37 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 38 | int id = Integer.parseInt(request.getParameter("userId")); 39 | UserInfo existingUser = userDAO.findUserById(id); 40 | System.out.println(id + " "+existingUser.getUserName()+" "+existingUser.getUserEmail()); 41 | RequestDispatcher dispatcher = request.getRequestDispatcher("Update.jsp"); 42 | request.setAttribute("user", existingUser); 43 | dispatcher.forward(request, response); 44 | } 45 | 46 | 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /Leet-Code/src/Week_04/BinaryMaximumPath.java: -------------------------------------------------------------------------------- 1 | package Week_04; 2 | /* Binary Tree Maximum Path Sum 3 | 4 | Given a non-empty binary tree, find the maximum path sum. 5 | 6 | For this problem, a path is defined as any sequence of nodes from some starting node to any node in the tree along the parent-child connections. The path must contain at least one node and does not need to go through the root. 7 | 8 | Example 1: 9 | 10 | Input: [1,2,3] 11 | 12 | 1 13 | / \ 14 | 2 3 15 | 16 | Output: 6 17 | Example 2: 18 | 19 | Input: [-10,9,20,null,null,15,7] 20 | 21 | -10 22 | / \ 23 | 9 20 24 | / \ 25 | 15 7 26 | 27 | Output: 42 28 | * */ 29 | class TreeNode { 30 | int val; 31 | TreeNode left; 32 | TreeNode right; 33 | TreeNode() {} 34 | TreeNode(int val) { this.val = val; } 35 | TreeNode(int val, TreeNode left, TreeNode right) { 36 | this.val = val; 37 | this.left = left; 38 | this.right = right; 39 | } 40 | } 41 | public class BinaryMaximumPath { 42 | int max_sum; 43 | public int maxPathSum(TreeNode root) { 44 | max_sum =Integer.MIN_VALUE; 45 | max_gain(root); 46 | return max_sum; 47 | } 48 | 49 | int max_gain(TreeNode root){ 50 | if(root==null) 51 | { 52 | return 0; 53 | } 54 | int leftGain = Math.max(max_gain(root.left),0); 55 | int rightGain= Math.max(max_gain(root.right),0); 56 | int sum= root.val + leftGain+ rightGain; 57 | max_sum=Math.max(max_sum,sum); 58 | return root.val+Math.max(leftGain,rightGain); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /UserMangementApp/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /Leet-Code-Arrays/src/DuplicateZeros.java: -------------------------------------------------------------------------------- 1 | /*Duplicate Zeros 2 | 3 | Given a fixed length array arr of integers, duplicate each occurrence of zero, shifting the remaining elements to the right. 4 | 5 | Note that elements beyond the length of the original array are not written. 6 | 7 | Do the above modifications to the input array in place, do not return anything from your function. 8 | 9 | 10 | 11 | Example 1: 12 | 13 | Input: [1,0,2,3,0,4,5,0] 14 | Output: null 15 | Explanation: After calling your function, the input array is modified to: [1,0,0,2,3,0,0,4] 16 | Example 2: 17 | 18 | Input: [1,2,3] 19 | Output: null 20 | Explanation: After calling your function, the input array is modified to: [1,2,3] 21 | 22 | 23 | Note: 24 | 25 | 1 <= arr.length <= 10000 26 | 0 <= arr[i] <= 9 27 | * */ 28 | public class DuplicateZeros { 29 | public void duplicateZeros(int[] arr) { 30 | 31 | int count = 0; 32 | int i = 0; 33 | for( ; i < arr.length; i++) { 34 | if (arr[i] == 0) 35 | count += 2; 36 | else 37 | count += 1; 38 | 39 | if (count >= arr.length) 40 | break; 41 | } 42 | int start = arr.length-1; 43 | if (count > arr.length) { 44 | arr[arr.length-1] = arr[i--]; 45 | start -= 1; 46 | } 47 | for(int j = start; j >= 0;) { 48 | if (arr[i] == 0) { 49 | arr[j--] = 0; 50 | arr[j--] = 0; 51 | } 52 | else 53 | arr[j--] = arr[i]; 54 | 55 | i--; 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Leet-Code/src/Week_04/SubArraySumEqualsK.java: -------------------------------------------------------------------------------- 1 | package Week_04; 2 | 3 | import java.util.*; 4 | 5 | /* Subarray Sum Equals K 6 | 7 | Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k. 8 | 9 | Example 1: 10 | 11 | Input:nums = [1,1,1], k = 2 12 | Output: 2 13 | 14 | 15 | Constraints: 16 | 17 | The length of the array is in range [1, 20,000]. 18 | The range of numbers in the array is [-1000, 1000] and the range of the integer k is [-1e7, 1e7]. 19 | Hide Hint #1 20 | Will Brute force work here? Try to optimize it. 21 | Hide Hint #2 22 | Can we optimize it by using some extra space? 23 | Hide Hint #3 24 | What about storing sum frequencies in a hash table? Will it be useful? 25 | Hide Hint #4 26 | sum(i,j)=sum(0,j)-sum(0,i), where sum(i,j) represents the sum of all the elements from index i to j-1. Can we use this property to optimize it. 27 | * */ 28 | public class SubArraySumEqualsK { 29 | public static int subarraySum(int[] nums, int k) { 30 | int curr_sum=0; 31 | int cnt=0; 32 | Map map = new HashMap<>(); 33 | map.put(0,1); 34 | for(int i=0;in-1-cnt;i--) 29 | { 30 | nums[i]=0; 31 | } 32 | 33 | } 34 | public static void main(String[] args) { 35 | Scanner s = new Scanner(System.in); 36 | System.out.print("Enter no. of elements you want in array:"); 37 | int n = s.nextInt(); 38 | int a[] = new int[n]; 39 | System.out.println("Enter all the elements:"); 40 | for(int i = 0; i < n; i++) 41 | { 42 | a[i] = s.nextInt(); 43 | 44 | } 45 | System.out.println("Original Array : "); 46 | for(int i = 0; i < n; i++) 47 | { 48 | System.out.print(a[i]+ " "); 49 | 50 | } 51 | moveZeroes(a); 52 | System.out.println("new Array : "); 53 | for(int i = 0; i < n; i++) 54 | { 55 | System.out.print(a[i]+ " "); 56 | 57 | } 58 | 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Leet-Code/src/Week_03/SearchinRotatedSortedArray.java: -------------------------------------------------------------------------------- 1 | package Week_03; 2 | 3 | public class SearchinRotatedSortedArray { 4 | public int search(int[] nums, int target) { 5 | if(nums==null || nums.length ==0) 6 | return -1; 7 | if(nums.length==1) 8 | { 9 | return nums[0]==target ?0:-1; 10 | } 11 | int n=nums.length; 12 | if(nums[0]= nums[0] && target <= nums[idx-1]){ 17 | return binarySearch(nums,0,idx-1,target); 18 | } 19 | else if(target >= nums[idx] && target <= nums[n-1]){ 20 | return binarySearch(nums,idx,n-1,target); 21 | } 22 | else 23 | return -1; 24 | } 25 | int pivotIndex(int[] nums, int si, int ei) 26 | { 27 | int mid=(si +(ei-si)/2); 28 | if(midnums[mid+1]) 29 | { 30 | return mid+1; 31 | } 32 | else if(nums[si]>nums[mid]) 33 | { 34 | return pivotIndex(nums,si,mid-1); 35 | } 36 | else 37 | { 38 | return pivotIndex(nums,mid+1,ei); 39 | } 40 | } 41 | 42 | int binarySearch(int[] nums, int si, int ei , int target){ 43 | if(si>ei) return -1; 44 | int mid=(si +(ei-si)/2); 45 | if(nums[mid]==target){ 46 | return mid; 47 | } 48 | else if(nums[mid]>target) 49 | { 50 | return binarySearch(nums,si,mid-1,target); 51 | } 52 | else 53 | { 54 | return binarySearch(nums,mid+1,ei,target); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /UserMangementApp/src/main/java/com/lti/controller/UserListServlet.java: -------------------------------------------------------------------------------- 1 | package com.lti.controller; 2 | 3 | import java.io.IOException; 4 | 5 | import java.sql.SQLException; 6 | 7 | import java.util.Set; 8 | 9 | import javax.servlet.RequestDispatcher; 10 | import javax.servlet.ServletException; 11 | import javax.servlet.annotation.WebServlet; 12 | import javax.servlet.http.HttpServlet; 13 | import javax.servlet.http.HttpServletRequest; 14 | import javax.servlet.http.HttpServletResponse; 15 | 16 | import com.lti.dao.UserInfoDao; 17 | import com.lti.dao.UserInfoDaoImpl; 18 | import com.lti.model.UserInfo; 19 | 20 | 21 | /** 22 | * Servlet implementation class UserListServlet 23 | */ 24 | @WebServlet("/UserList") 25 | public class UserListServlet extends HttpServlet { 26 | private static final long serialVersionUID = 1L; 27 | 28 | 29 | 30 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 31 | 32 | doGet(request, response); 33 | } 34 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 35 | try { 36 | listUser(request, response); 37 | } catch (SQLException e) { 38 | // TODO Auto-generated catch block 39 | e.printStackTrace(); 40 | } 41 | 42 | 43 | } 44 | private void listUser(HttpServletRequest request, HttpServletResponse response) 45 | throws SQLException, IOException, ServletException { 46 | UserInfoDao userdao = new UserInfoDaoImpl(); 47 | Set listUser = userdao.viewAllUsers(); 48 | request.setAttribute("listUser", listUser); 49 | RequestDispatcher dispatcher = request.getRequestDispatcher("user-list.jsp"); 50 | dispatcher.forward(request, response); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /UserMangementApp/src/main/java/com/lti/controller/UpdateServlet.java: -------------------------------------------------------------------------------- 1 | package com.lti.controller; 2 | 3 | import java.io.IOException; 4 | import javax.servlet.ServletException; 5 | import javax.servlet.annotation.WebServlet; 6 | import javax.servlet.http.HttpServlet; 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | 10 | import com.lti.dao.UserInfoDao; 11 | import com.lti.dao.UserInfoDaoImpl; 12 | import com.lti.model.UserInfo; 13 | 14 | 15 | /** 16 | * Servlet implementation class UpdateServlet 17 | */ 18 | @WebServlet("/update") 19 | public class UpdateServlet extends HttpServlet { 20 | private static final long serialVersionUID = 1L; 21 | private UserInfoDao userDAO; 22 | 23 | public void init() { 24 | userDAO = new UserInfoDaoImpl(); 25 | } 26 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 27 | 28 | doGet(request, response); 29 | } 30 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 31 | int id = Integer.parseInt(request.getParameter("id")); 32 | 33 | String userName= request.getParameter("uname"); 34 | String userPassword= request.getParameter("psw"); 35 | String userEmail= request.getParameter("email"); 36 | String userCity= request.getParameter("city"); 37 | String userMobile= request.getParameter("mobile"); 38 | 39 | UserInfo book = new UserInfo(id,userName, userPassword, userEmail,userCity,userMobile); 40 | userDAO.updateUser(book); 41 | System.out.println(book.getUserId()+" "+book.getUserName()+" "+book.getUserEmail()+" "+book.getUserCity()); 42 | response.sendRedirect("UserList"); 43 | 44 | } 45 | 46 | 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /Leet-Code-Arrays/src/HeightChecker.java: -------------------------------------------------------------------------------- 1 | /*Height Checker 2 | Students are asked to stand in non-decreasing order of heights for an annual photo. 3 | 4 | Return the minimum number of students that must move in order for all students to be standing in non-decreasing order of height. 5 | 6 | Notice that when a group of students is selected they can reorder in any possible way between themselves and the non selected students remain on their seats. 7 | 8 | 9 | 10 | Example 1: 11 | 12 | Input: heights = [1,1,4,2,1,3] 13 | Output: 3 14 | Explanation: 15 | Current array : [1,1,4,2,1,3] 16 | Target array : [1,1,1,2,3,4] 17 | On index 2 (0-based) we have 4 vs 1 so we have to move this student. 18 | On index 4 (0-based) we have 1 vs 3 so we have to move this student. 19 | On index 5 (0-based) we have 3 vs 4 so we have to move this student. 20 | Example 2: 21 | 22 | Input: heights = [5,1,2,3,4] 23 | Output: 5 24 | Example 3: 25 | 26 | Input: heights = [1,2,3,4,5] 27 | Output: 0 28 | 29 | 30 | Constraints: 31 | 32 | 1 <= heights.length <= 100 33 | 1 <= heights[i] <= 100 34 | * */ 35 | public class HeightChecker { 36 | public int heightChecker(int[] heights) { 37 | int[] freq = new int[101]; 38 | for (int i = 0; i < heights.length; i++) { 39 | freq[heights[i]]++; 40 | } 41 | 42 | int idx = 0; // traverses on height 43 | int moves = 0; 44 | 45 | for (int i = 1; i < freq.length; i++) { 46 | 47 | if (freq[i] != 0) { 48 | int e = idx + freq[i]; 49 | while (idx < e) { 50 | if (heights[idx] != i) 51 | moves++; 52 | idx++; 53 | } 54 | } 55 | 56 | } 57 | return moves; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Leet-Code/src/Week_02/LastStoneWeight.java: -------------------------------------------------------------------------------- 1 | package Week_02; 2 | 3 | import java.util.Arrays; 4 | 5 | /* Last Stone Weight 6 | 7 | We have a collection of stones, each stone has a positive integer weight. 8 | 9 | Each turn, we choose the two heaviest stones and smash them together. Suppose the stones have weights x and y with x <= y. The result of this smash is: 10 | 11 | If x == y, both stones are totally destroyed; 12 | If x != y, the stone of weight x is totally destroyed, and the stone of weight y has new weight y-x. 13 | At the end, there is at most 1 stone left. Return the weight of this stone (or 0 if there are no stones left.) 14 | 15 | 16 | 17 | Example 1: 18 | 19 | Input: [2,7,4,1,8,1] 20 | Output: 1 21 | Explanation: 22 | We combine 7 and 8 to get 1 so the array converts to [2,4,1,1,1] then, 23 | we combine 2 and 4 to get 2 so the array converts to [2,1,1,1] then, 24 | we combine 2 and 1 to get 1 so the array converts to [1,1,1] then, 25 | we combine 1 and 1 to get 0 so the array converts to [1] then that's the value of last stone. 26 | 27 | 28 | Note: 29 | 30 | 1 <= stones.length <= 30 31 | 1 <= stones[i] <= 1000 32 | * */ 33 | public class LastStoneWeight { 34 | public static int lastStoneWeight(int[] stones) { 35 | Arrays.sort(stones); 36 | for(int i=stones.length-1;i>=1;i--) 37 | { 38 | if(stones[i]==stones[i-1]) 39 | i--; 40 | else if(stones[i]!=stones[i-1]) 41 | stones[i-1]=stones[i]-stones[i-1]; 42 | Arrays.sort(stones); 43 | if(i<1) 44 | {return 0;} 45 | } 46 | return stones[0]; 47 | } 48 | public static void main(String[] args) { 49 | int arr[]= {2,7,4,1,8,1}; 50 | int res=lastStoneWeight(arr); 51 | System.out.println(res); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /UserMangementApp/src/main/java/com/lti/controller/RegisterServlet.java: -------------------------------------------------------------------------------- 1 | package com.lti.controller; 2 | 3 | import java.io.IOException; 4 | import java.io.PrintWriter; 5 | import java.util.Set; 6 | 7 | import javax.servlet.ServletException; 8 | import javax.servlet.annotation.WebServlet; 9 | import javax.servlet.http.HttpServlet; 10 | import javax.servlet.http.HttpServletRequest; 11 | import javax.servlet.http.HttpServletResponse; 12 | 13 | import com.lti.dao.UserInfoDao; 14 | import com.lti.dao.UserInfoDaoImpl; 15 | import com.lti.model.UserInfo; 16 | 17 | /** 18 | * Servlet implementation class RegisterServlet 19 | */ 20 | @WebServlet("/register") 21 | public class RegisterServlet extends HttpServlet { 22 | private static final long serialVersionUID = 1L; 23 | 24 | 25 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 26 | doPost(req,resp); 27 | } 28 | 29 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 30 | 31 | response.setContentType("text/html"); 32 | PrintWriter out = response.getWriter(); 33 | 34 | String userName= request.getParameter("uname"); 35 | String userPassword= request.getParameter("psw"); 36 | String userEmail= request.getParameter("email"); 37 | String userCity= request.getParameter("city"); 38 | String userMobile= request.getParameter("mobile"); 39 | 40 | UserInfo userInfo = new UserInfo(userName,userPassword,userEmail,userCity,userMobile); 41 | UserInfoDao userdao = new UserInfoDaoImpl(); 42 | 43 | int res=userdao.registerUser(userInfo); 44 | if(res>0) { 45 | out.println("User registered Successfully..."); 46 | } 47 | else 48 | { 49 | out.println("Registration Failed..!!!!"); 50 | } 51 | 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /Leet-Code/src/Week_01/BestTImeBuyAndSell.java: -------------------------------------------------------------------------------- 1 | package Week_01; 2 | /* Best Time to Buy and Sell Stock II 3 | 4 | Solution 5 | Say you have an array prices for which the ith element is the price of a given stock on day i. 6 | 7 | Design an algorithm to find the maximum profit. You may complete as many transactions as you like (i.e., buy one and sell one share of the stock multiple times). 8 | 9 | Note: You may not engage in multiple transactions at the same time (i.e., you must sell the stock before you buy again). 10 | 11 | Example 1: 12 | 13 | Input: [7,1,5,3,6,4] 14 | Output: 7 15 | Explanation: Buy on day 2 (price = 1) and sell on day 3 (price = 5), profit = 5-1 = 4. 16 | Then buy on day 4 (price = 3) and sell on day 5 (price = 6), profit = 6-3 = 3. 17 | Example 2: 18 | 19 | Input: [1,2,3,4,5] 20 | Output: 4 21 | Explanation: Buy on day 1 (price = 1) and sell on day 5 (price = 5), profit = 5-1 = 4. 22 | Note that you cannot buy on day 1, buy on day 2 and sell them later, as you are 23 | engaging multiple transactions at the same time. You must sell before buying again. 24 | Example 3: 25 | 26 | Input: [7,6,4,3,1] 27 | Output: 0 28 | Explanation: In this case, no transaction is done, i.e. max profit = 0. 29 | 30 | 31 | Constraints: 32 | 33 | 1 <= prices.length <= 3 * 10 ^ 4 34 | 0 <= prices[i] <= 10 ^ 4 35 | */ 36 | public class BestTImeBuyAndSell { 37 | public static int maxProfit(int[] prices) { 38 | int profit=0; 39 | for(int i=0;iprices[i]) 42 | { 43 | profit+=prices[i+1]-prices[i]; 44 | } 45 | } 46 | return profit; 47 | } 48 | public static void main(String[] args) { 49 | int arr[] = {7,1,5,3,6,4}; 50 | System.out.println(maxProfit( arr)); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Leet-Code/src/Week_02/BackSpaceStringComapre.java: -------------------------------------------------------------------------------- 1 | package Week_02; 2 | 3 | import java.util.Stack; 4 | 5 | /*Backspace String Compare 6 | 7 | Given two strings S and T, return if they are equal when both are typed into empty text editors. # means a backspace character. 8 | 9 | Note that after backspacing an empty text, the text will continue empty. 10 | 11 | Example 1: 12 | 13 | Input: S = "ab#c", T = "ad#c" 14 | Output: true 15 | Explanation: Both S and T become "ac". 16 | Example 2: 17 | 18 | Input: S = "ab##", T = "c#d#" 19 | Output: true 20 | Explanation: Both S and T become "". 21 | Example 3: 22 | 23 | Input: S = "a##c", T = "#a#c" 24 | Output: true 25 | Explanation: Both S and T become "c". 26 | Example 4: 27 | 28 | Input: S = "a#c", T = "b" 29 | Output: false 30 | Explanation: S becomes "c" while T becomes "b". 31 | Note: 32 | 33 | 1 <= S.length <= 200 34 | 1 <= T.length <= 200 35 | S and T only contain lowercase letters and '#' characters. 36 | Follow up: 37 | 38 | Can you solve it in O(N) time and O(1) space? 39 | * */ 40 | public class BackSpaceStringComapre { 41 | public static boolean backspaceCompare(String S, String T) { 42 | return backspaceComparehelper(S).equals(backspaceComparehelper(T)); 43 | } 44 | 45 | static String backspaceComparehelper(String s){ 46 | Stack stk = new Stack<>(); 47 | for(int i=0;i 2 | 3 | 4 | %date [%thread] %-5level %logger{35} - %msg%n 5 | 6 | 7 | OFF 8 | 9 | 10 | 11 | 12 | ${org.eclipse.m2e.log.dir}/0.log 13 | 14 | ${org.eclipse.m2e.log.dir}/%i.log 15 | 1 16 | 10 17 | 18 | 19 | 100MB 20 | 21 | 22 | %date [%thread] %-5level %logger{35} - %msg%n 23 | 24 | 25 | 26 | 27 | 28 | WARN 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /UserMangementApp/src/main/java/com/lti/model/UserInfo.java: -------------------------------------------------------------------------------- 1 | package com.lti.model; 2 | 3 | public class UserInfo { 4 | private int userId; 5 | private String userName; 6 | private String userPassword; 7 | private String userEmail; 8 | private String userCity; 9 | private String userMobile; 10 | public UserInfo(String userName, String userPassword, String userEmail, String userCity, 11 | String userMobile) { 12 | this.userName = userName; 13 | this.userPassword = userPassword; 14 | this.userEmail = userEmail; 15 | this.userCity = userCity; 16 | this.userMobile = userMobile; 17 | } 18 | public UserInfo(int id,String userName, String userPassword, String userEmail, String userCity, 19 | String userMobile) { 20 | this.userId=id; 21 | this.userName = userName; 22 | this.userPassword = userPassword; 23 | this.userEmail = userEmail; 24 | this.userCity = userCity; 25 | this.userMobile = userMobile; 26 | } 27 | public UserInfo() { 28 | // TODO Auto-generated constructor stub 29 | } 30 | public int getUserId() { 31 | return userId; 32 | } 33 | public void setUserId(int userId) { 34 | this.userId = userId; 35 | } 36 | public String getUserName() { 37 | return userName; 38 | } 39 | public void setUserName(String userName) { 40 | this.userName = userName; 41 | } 42 | public String getUserPassword() { 43 | return userPassword; 44 | } 45 | public void setUserPassword(String userPassword) { 46 | this.userPassword = userPassword; 47 | } 48 | public String getUserEmail() { 49 | return userEmail; 50 | } 51 | public void setUserEmail(String userEmail) { 52 | this.userEmail = userEmail; 53 | } 54 | public String getUserCity() { 55 | return userCity; 56 | } 57 | public void setUserCity(String userCity) { 58 | this.userCity = userCity; 59 | } 60 | public String getUserMobile() { 61 | return userMobile; 62 | } 63 | public void setUserMobile(String userMobile) { 64 | this.userMobile = userMobile; 65 | } 66 | 67 | 68 | } 69 | -------------------------------------------------------------------------------- /Online Reservation System Project/Reservation/Login.java: -------------------------------------------------------------------------------- 1 | import java.awt.*; 2 | import java.awt.event.*; 3 | import javax.swing.*; 4 | class Login implements ActionListener 5 | { 6 | JFrame f; 7 | JLabel l1,l2; 8 | JTextField t1; 9 | JPasswordField t2; 10 | JButton b1,b2; 11 | Main M; 12 | Login() 13 | { 14 | f=new JFrame("Login"); 15 | f.getContentPane().setLayout(null); 16 | f.getContentPane().setBackground(Color.pink); 17 | l1=new JLabel("User Name"); 18 | l1.setForeground(Color.yellow); 19 | l1.setBounds(50,50,100,30); 20 | l2=new JLabel("Password"); 21 | l2.setForeground(Color.yellow); 22 | l2.setBounds(50,80,100,30); 23 | t1=new JTextField(10); 24 | t1.setForeground(Color.blue); 25 | t1.addActionListener(this); 26 | t1.setBounds(150,50,100,30); 27 | t2=new JPasswordField(10); 28 | t2.setForeground(Color.blue); 29 | t2.setEchoChar('*'); 30 | t2.addActionListener(this); 31 | t2.setBounds(150,80,100,30); 32 | b1=new JButton("Ok"); 33 | b1.setForeground(Color.blue); 34 | b1.addActionListener(this); 35 | b1.setBounds(50,120,100,30); 36 | b2=new JButton("Cancel"); 37 | b2.setForeground(Color.blue); 38 | b2.addActionListener(this); 39 | b2.setBounds(180,120,100,30); 40 | 41 | b1.setMnemonic('O'); 42 | b2.setMnemonic('C'); 43 | 44 | f.getContentPane().add(l1); 45 | f.getContentPane().add(l2); 46 | f.getContentPane().add(t1); 47 | f.getContentPane().add(t2); 48 | f.getContentPane().add(b1); 49 | f.getContentPane().add(b2); 50 | f.setBounds(300,300,300,200); 51 | f.setResizable(false); 52 | f.setVisible(true); 53 | } 54 | public void actionPerformed(ActionEvent e) 55 | { 56 | if(e.getSource()==b1) 57 | { 58 | if(t1.getText().length()==0||t2.getText().length()==0) 59 | { 60 | JOptionPane.showMessageDialog(null,"Fields are empty"); 61 | } 62 | else if(t1.getText().equals("dush") && t2.getText().equals("1234")) 63 | { 64 | f.setVisible(false); 65 | M=new Main(); 66 | } 67 | else 68 | { 69 | JOptionPane.showMessageDialog(null,"Invalid User Name or Password"); 70 | } 71 | } 72 | if(e.getSource()==b2) 73 | { 74 | f.setVisible(false); 75 | System.exit(0); 76 | } 77 | } 78 | } 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /Leet-Code/src/Week_03/NumberofIslands.java: -------------------------------------------------------------------------------- 1 | package Week_03; 2 | /*Number of Islands 3 | 4 | Given a 2d grid map of '1's (land) and '0's (water), count the number 5 | of islands. An island is surrounded by water and is formed by 6 | connecting adjacent lands horizontally or vertically. You may 7 | assume all four edges of the grid are all surrounded by water. 8 | 9 | Example 1: 10 | 11 | Input: 12 | 11110 13 | 11010 14 | 11000 15 | 00000 16 | 17 | Output: 1 18 | Example 2: 19 | 20 | Input: 21 | 11000 22 | 11000 23 | 00100 24 | 00011 25 | 26 | Output: 3 27 | * */ 28 | public class NumberofIslands { 29 | 30 | static int[] xarr={-1,0,0,1}; 31 | static int[] yarr ={0,-1,1,0}; 32 | static boolean isSafe(char[][] grid , int i , int j) 33 | { 34 | if(i>=0 && i=0 && j node.val. Also recall that a preorder traversal displays the value of the node first, then traverses node.left, then traverses node.right.) 7 | 8 | It's guaranteed that for the given test cases there is always possible to find a binary search tree with the given requirements. 9 | 10 | Example 1: 11 | 12 | Input: [8,5,1,7,10,12] 13 | Output: [8,5,10,1,7,null,12] 14 | 15 | Constraints: 16 | 1 <= preorder.length <= 100 17 | 1 <= preorder[i] <= 10^8 18 | The values of preorder are distinct. 19 | * */ 20 | class TreeNode { 21 | int val; 22 | TreeNode left; 23 | TreeNode right; 24 | TreeNode() {} 25 | TreeNode(int val) { this.val = val; } 26 | TreeNode(int val, TreeNode left, TreeNode right) { 27 | this.val = val; 28 | this.left = left; 29 | this.right = right; 30 | } 31 | } 32 | public class BSTfromPreorderTraversal { 33 | public TreeNode bstFromPreorder(int[] preorder) { 34 | if (preorder == null) { 35 | return null; 36 | } 37 | 38 | return formBST(preorder, 0, preorder.length - 1); 39 | } 40 | 41 | private TreeNode formBST(int[] nums, int low, int high) { 42 | if (low > high) { 43 | return null; 44 | } 45 | 46 | TreeNode node = new TreeNode(nums[low]); 47 | if (low == high) { 48 | return node; 49 | } 50 | 51 | int index = low + 1; 52 | while (index <= high && nums[index] < nums[low]) { 53 | index++; 54 | } 55 | 56 | node.left = formBST(nums, low + 1, index - 1); 57 | node.right = formBST(nums, index, high); 58 | 59 | return node; 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /Online Reservation System Project/Reservation/Main.java: -------------------------------------------------------------------------------- 1 | import java.awt.*; 2 | import java.awt.event.*; 3 | import javax.swing.*; 4 | class Main implements ActionListener 5 | { 6 | JFrame f; 7 | JButton b1,b2,b3,b4; 8 | Reservation r; 9 | Enquiry q; 10 | Cancellation c; 11 | JLabel imgL; 12 | ImageIcon img; 13 | Main() 14 | { 15 | img=new ImageIcon("Indian-Railway-Network.jpg"); 16 | imgL=new JLabel(img); 17 | imgL.setBounds(0,0,1300,1000); 18 | f=new JFrame("Main"); 19 | f.getContentPane().setLayout(null); 20 | f.getContentPane().setBackground(Color.green); 21 | b1=new JButton("Reservation Form"); 22 | b1.addActionListener(this); 23 | b1.setBounds(150,390,210,60); 24 | b2=new JButton("PNR-enquiry"); 25 | b2.addActionListener(this); 26 | b2.setBounds(150,490,210,60); 27 | b3=new JButton("Cancellation Form"); 28 | b3.addActionListener(this); 29 | b3.setBounds(580,390,210,60); 30 | b4=new JButton("Exit"); 31 | b4.addActionListener(this); 32 | b4.setBounds(580,490,210,60); 33 | 34 | b1.setBackground(new Color(100,200,0)); 35 | b1.setForeground(new Color(255,255,255)); 36 | b2.setBackground(new Color(100,200,0)); 37 | b2.setForeground(new Color(255,255,255)); 38 | b3.setBackground(new Color(100,200,0)); 39 | b3.setForeground(new Color(255,255,255)); 40 | b4.setBackground(new Color(100,200,0)); 41 | b4.setForeground(new Color(255,255,255)); 42 | 43 | b1.setMnemonic('R'); 44 | b2.setMnemonic('P'); 45 | b3.setMnemonic('C'); 46 | b4.setMnemonic('E'); 47 | 48 | f.getContentPane().add(b1); 49 | f.getContentPane().add(b2); 50 | f.getContentPane().add(b3); 51 | f.getContentPane().add(b4); 52 | f.getContentPane().add(imgL); 53 | f.setSize(1300,1000); 54 | f.setVisible(true); 55 | } 56 | public void actionPerformed(ActionEvent e) 57 | { 58 | if(e.getSource()==b1) 59 | { 60 | f.setVisible(false); 61 | r=new Reservation(); 62 | } 63 | if(e.getSource()==b2) 64 | { 65 | f.setVisible(false); 66 | q=new Enquiry(); 67 | } 68 | if(e.getSource()==b3) 69 | { 70 | f.setVisible(false); 71 | c=new Cancellation(); 72 | } 73 | if(e.getSource()==b4) 74 | { 75 | f.setVisible(false); 76 | System.exit(0); 77 | } 78 | } 79 | public static void main(String args[]) 80 | { 81 | new Main(); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /UserMangementApp/src/main/webapp/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | LTI - Larsen & Toubro Infotech 7 | 8 | 9 | 10 |
11 |

Welcome to LTI

12 |
13 |
14 | 21 |
22 |
23 |
24 |
25 |

Login to a world of opportunities!

26 | 27 |
28 |
29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 |
39 |
40 |
41 | 42 | Forget password? 43 |
44 |
45 |
46 | 47 |
48 | 49 |
50 | 51 | 52 | 53 | 56 | 57 | -------------------------------------------------------------------------------- /UserMangementApp/src/main/webapp/register.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | LTI - Larsen & Toubro Infotech 8 | 9 | 10 | 11 |
12 |

Welcome to LTI

13 |
14 |
15 | 22 |
23 |
24 |
25 |
26 |

Register to explore amazing career opportunities

27 | 28 |
29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 |
48 |
49 |
50 |
51 |
52 | 53 | 54 | 57 | 58 | -------------------------------------------------------------------------------- /Leet-Code-Arrays/src/DeleteDuplicateinSortedArray.java: -------------------------------------------------------------------------------- 1 | /*Given a sorted array, remove the duplicates such that each element appears only once. 2 | 3 | Input: array = [1, 1, 2] 4 | Output: [1, 2] 5 | Input: array = [0, 0, 1, 1, 1, 2, 2, 3, 3, 4] 6 | Output: [0, 1, 2, 3, 4] 7 | * */ 8 | public class DeleteDuplicateinSortedArray { 9 | public int removeDuplicates(int[] nums) { 10 | 11 | // The initial length is simply the capacity. 12 | int length = nums.length; 13 | 14 | // Assume the last element is always unique. 15 | // Then for each element, delete it iff it is 16 | // the same as the one after it. Use our deletion 17 | // algorithm for deleting from any index. 18 | for (int i = length - 2; i >= 0; i--) { 19 | if (nums[i] == nums[i + 1]) { 20 | // Delete the element at index i, using our standard 21 | // deletion algorithm we learned. 22 | for (int j = i + 1; j < length; j++) { 23 | nums[j - 1] = nums[j]; 24 | } 25 | // Reduce the length by 1. 26 | length--; 27 | } 28 | } 29 | // Return the new length. 30 | return length; 31 | } 32 | public int[] copyWithRemovedDuplicates(int[] nums) { 33 | 34 | // Check for edge cases. 35 | if (nums == null || nums.length == 0) { 36 | return nums; 37 | } 38 | 39 | // Count how many unique elements are in the Array. 40 | int uniqueNumbers = 0; 41 | for (int i = 0; i < nums.length; i++) { 42 | // An element should be counted as unique if it's the first 43 | // element in the Array, or is different to the one before it. 44 | if (i == 0 || nums[i] != nums[i - 1]) { 45 | uniqueNumbers++; 46 | } 47 | } 48 | 49 | // Create a result Array. 50 | int[] result = new int[uniqueNumbers]; 51 | 52 | // Write the unique elements into the result Array. 53 | int positionInResult = 0; 54 | for (int i = 0; i < nums.length; i++) { 55 | // Same condition as in the previous loop. Except this time, we can write 56 | // each unique number into the result Array instead of just counting them. 57 | if (i == 0 || nums[i] != nums[i - 1]) { 58 | result[positionInResult] = nums[i]; 59 | positionInResult++; 60 | } 61 | } 62 | return result; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /hackerRank/src/com/week3/IsAnagram.java: -------------------------------------------------------------------------------- 1 | package com.week3; 2 | 3 | import java.util.Arrays; 4 | import java.util.HashMap; 5 | import java.util.Map; 6 | import java.util.Scanner; 7 | 8 | public class IsAnagram { 9 | static boolean isAnagram(String a, String b) { 10 | 11 | // test for invalid input 12 | if( a == null || b == null || a.equals("") || b.equals("") ) 13 | throw new IllegalArgumentException(); 14 | 15 | // initial quick test for non-anagrams 16 | if ( a.length() != b.length() ) 17 | return false; 18 | 19 | a = a.toLowerCase(); 20 | b = b.toLowerCase(); 21 | 22 | // populate a map with letters and frequencies of String b 23 | Map map = new HashMap<>(); 24 | 25 | for (int k = 0; k < b.length(); k++){ 26 | char letter = b.charAt(k); 27 | 28 | if( ! map.containsKey(letter)){ 29 | map.put( letter, 1 ); 30 | } else { 31 | Integer frequency = map.get( letter ); 32 | map.put( letter, ++frequency ); 33 | } 34 | } 35 | 36 | // test each letter in String a against data in the map 37 | // return if letter is absent in the map or its frequency is 0 38 | // otherwise decrease the frequency by 1 39 | 40 | for (int k = 0; k < a.length(); k++){ 41 | char letter = a.charAt(k); 42 | 43 | if( ! map.containsKey( letter ) ) 44 | return false; 45 | 46 | Integer frequency = map.get( letter ); 47 | 48 | if( frequency == 0 ) 49 | return false; 50 | else 51 | map.put( letter, --frequency); 52 | } 53 | // if the code got that far it is an anagram 54 | return true; 55 | } 56 | static boolean isAnagram2(String a, String b) { 57 | char aa[] = a.toLowerCase().toCharArray(); 58 | char bb[] = b.toLowerCase().toCharArray(); 59 | if(a.length() != b.length()){ 60 | return false; 61 | }else{ 62 | java.util.Arrays.sort(aa); 63 | java.util.Arrays.sort(bb); 64 | return java.util.Arrays.equals(aa, bb); 65 | } 66 | } 67 | public static void main(String[] args) { 68 | 69 | Scanner scan = new Scanner(System.in); 70 | String a = scan.next(); 71 | String b = scan.next(); 72 | scan.close(); 73 | boolean ret = isAnagram(a, b); 74 | System.out.println( (ret) ? "Anagrams" : "Not Anagrams" ); 75 | 76 | boolean ret2 = isAnagram2(a, b); 77 | System.out.println( (ret2) ? "Anagrams" : "Not Anagrams" ); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /UserMangementApp/src/main/webapp/user-list.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 4 | 5 | 6 | 7 | 8 | 9 | LTI - Larsen & Toubro Infotech 10 | 11 | 12 | 13 | 14 | 15 |
16 |

Welcome to LTI

17 |
18 |
19 | 26 |
27 |
28 | 29 |
30 |
31 |
32 |

List Of Users!

33 |
34 |
35 | Add New User 36 |
37 |
38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 64 | 65 | 66 | 67 | 68 | 69 |
IDNamepasswordEmailCityMobileActions
Edit 62 |    Delete
70 |
71 |
72 |
73 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /Leet-Code/src/Week_04/LongestCommonSubSequence.java: -------------------------------------------------------------------------------- 1 | package Week_04; 2 | /*Longest Common Subsequence 3 | 4 | Solution 5 | Given two strings text1 and text2, return the length of their longest common subsequence. 6 | 7 | A subsequence of a string is a new string generated from the original string with some characters(can be none) deleted without changing the relative order of the remaining characters. (eg, "ace" is a subsequence of "abcde" while "aec" is not). A common subsequence of two strings is a subsequence that is common to both strings. 8 | 9 | 10 | 11 | If there is no common subsequence, return 0. 12 | 13 | 14 | 15 | Example 1: 16 | 17 | Input: text1 = "abcde", text2 = "ace" 18 | Output: 3 19 | Explanation: The longest common subsequence is "ace" and its length is 3. 20 | Example 2: 21 | 22 | Input: text1 = "abc", text2 = "abc" 23 | Output: 3 24 | Explanation: The longest common subsequence is "abc" and its length is 3. 25 | Example 3: 26 | 27 | Input: text1 = "abc", text2 = "def" 28 | Output: 0 29 | Explanation: There is no such common subsequence, so the result is 0. 30 | 31 | 32 | Constraints: 33 | 34 | 1 <= text1.length <= 1000 35 | 1 <= text2.length <= 1000 36 | The input strings consist of lowercase English characters only. 37 | * */ 38 | public class LongestCommonSubSequence { 39 | public static int longestCommonSubsequence(String text1, String text2) { 40 | 41 | int[][] dp = new int[text1.length()+1][text2.length()+1]; 42 | for(int i = 0; i 3 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 4 | 5 | 6 | 7 | 8 | 9 | LTI - Larsen & Toubro Infotech 10 | 11 | 12 | 13 | 14 | 15 |
16 |

Welcome to LTI

17 |
18 |
19 | 26 |
27 |
28 | 29 |
30 |
31 |
32 |

Update/Edit User Page!

33 |
34 |
35 | 36 |
37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 |
59 | 60 |
61 |
62 |
63 |
64 | 67 | 68 | -------------------------------------------------------------------------------- /UserMangementApp/src/main/webapp/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | LTI - Larsen & Toubro 7 | 8 | 9 | 10 |
11 |

Welcome to LTI

12 |
13 | 14 |
15 | 22 |
23 | 24 |
25 |
26 |

27 | LTI (NSE: LTI) is a global technology consulting and digital solutions company 28 | helping more than 420 clients succeed in a converging world. With operations 29 | in 32 countries, we go the extra mile for our clients and accelerate their digital 30 | transformation with LTI’s Mosaic platform enabling their mobile, social, analytics, 31 | IoT and cloud journeys. 32 |

33 |

34 | Founded 20 years ago as the information technology arm of the Larsen & Toubro group, 35 | our unique heritage gives us unrivaled real-world expertise to solve the most complex 36 | challenges of enterprises across all industries. 37 |

38 |

39 | Each day, our team of more than 30,000 LTItes enable our clients to improve the effectiveness 40 | of their business and technology operations and deliver value to their customers, employees 41 | and shareholders. 42 |

43 |
44 |
45 |

Our Belief

46 |
47 | 48 |

Go the Extra Mile

49 |
50 |
51 | 52 |

Be Agile

53 |
54 |
55 | 56 |

Push Frontiers of Innovation

57 |
58 |
59 | 60 |

Keep Learning

61 |
62 |
63 | 64 |

Solve For Society

65 |
66 |
67 |
68 | 69 | 72 | 73 | -------------------------------------------------------------------------------- /Leet-Code/src/Week_04/LRUCache.java: -------------------------------------------------------------------------------- 1 | package Week_04; 2 | /* 3 | * LRU Cache 4 | 5 | Solution 6 | Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and put. 7 | 8 | get(key) - Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1. 9 | put(key, value) - Set or insert the value if the key is not already present. When the cache reached its capacity, it should invalidate the least recently used item before inserting a new item. 10 | 11 | The cache is initialized with a positive capacity. 12 | 13 | Follow up: 14 | Could you do both operations in O(1) time complexity? 15 | 16 | //Example: 17 | // 18 | //LRUCache cache = new LRUCache( 2 /* capacity ) 19 | // 20 | ////cache.put(1, 1); 21 | ////cache.put(2, 2); 22 | ////cache.get(1); // returns 1 23 | ////cache.put(3, 3); // evicts key 2 24 | ////cache.get(2); // returns -1 (not found) 25 | ////cache.put(4, 4); // evicts key 1 26 | ////cache.get(1); // returns -1 (not found) 27 | ////cache.get(3); // returns 3 28 | ////cache.get(4); // returns 4 29 | //*/ 30 | 31 | import java.util.*; 32 | 33 | class LRUCache { 34 | private int capacity; 35 | private int size; 36 | private Map keyToPrev = new HashMap<>(); 37 | private Node dummyHead = new Node(0, 0); 38 | private Node tail = dummyHead; 39 | 40 | public LRUCache(int capacity) { 41 | this.capacity = capacity; 42 | } 43 | 44 | public int get(int key) { 45 | if (!keyToPrev.containsKey(key)) { 46 | return -1; 47 | } 48 | moveToTail(key); 49 | return tail.value; 50 | } 51 | 52 | public void put(int key, int value) { 53 | if (keyToPrev.containsKey(key)) { 54 | moveToTail(key); 55 | tail.value = value; 56 | } else { 57 | Node curr = new Node(key, value); 58 | keyToPrev.put(key, tail); 59 | tail.next = curr; 60 | tail = curr; 61 | if (size < capacity) { 62 | size++; 63 | } else { 64 | Node first = dummyHead.next; 65 | Node second = first.next; 66 | dummyHead.next = second; 67 | keyToPrev.remove(first.key); 68 | keyToPrev.put(second.key, dummyHead); 69 | } 70 | } 71 | } 72 | 73 | private void moveToTail(int key) { 74 | 75 | Node prev = keyToPrev.get(key); 76 | Node curr = prev.next; 77 | // conor case 78 | if (tail == curr) { 79 | return; 80 | } 81 | 82 | prev.next = curr.next; 83 | tail.next = curr; 84 | curr.next = null; 85 | 86 | keyToPrev.put(prev.next.key, prev); 87 | keyToPrev.put(key, tail); 88 | 89 | tail = curr; 90 | } 91 | 92 | private static class Node { 93 | public int key; 94 | public int value; 95 | public Node next; 96 | public Node(int key, int value) { 97 | this.key = key; 98 | this.value = value; 99 | } 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /UserMangementApp/src/main/webapp/main.css: -------------------------------------------------------------------------------- 1 | *{ 2 | box-sizing: border-box; /*it will be a box and content will be asjusted*/ 3 | font-family: 'Muli', 'Baloo Da 2', 'Montserrat', 'sans-serif'; 4 | 5 | } 6 | body{ 7 | font-family: Arail; 8 | padding: 10px; 9 | background: #f1f1f1; 10 | } 11 | .header { 12 | padding: 10px; 13 | text-align: center; 14 | background: white; 15 | width: 80%; 16 | margin: auto; /*used to horizontally center the element within its container*/ 17 | /*The element will then take up the specified width and the remaining space will be split 18 | equally between the left and right margins.*/ 19 | } 20 | .topnav{ 21 | overflow: hidden; /*Controls what happens to content that is too big to fit in an area*/ 22 | background-color: darkblue; 23 | width: 80%; 24 | margin: auto; 25 | } 26 | .topnav ul{ 27 | list-style-type: none; 28 | } 29 | 30 | .topnav a{ 31 | float: left; 32 | color: #f2f2f2; 33 | text-align: center; 34 | padding: 14px; 35 | text-decoration: none; /*it will remove hyperlink(underline)*/ 36 | letter-spacing: 1px; 37 | height: 70px; 38 | } 39 | 40 | /* .row:after{ 41 | content: ""; 42 | display: table; 43 | clear: both; 44 | } */ 45 | .main{ 46 | width: 80%; 47 | margin: auto; 48 | } 49 | /*add a card effect for articles*/ 50 | .card{ 51 | background-color: white; 52 | padding: 20px; 53 | margin-top: 20px; 54 | overflow: hidden; 55 | } 56 | .cc{ 57 | float: left; 58 | padding: 5px; 59 | } 60 | img{ 61 | width: auto; 62 | max-width: 205px; 63 | height: auto; 64 | } 65 | 66 | .footer{ 67 | padding: 20px; 68 | text-align: center; 69 | background: #ddd; 70 | margin-top: 20px; 71 | width: 80%; 72 | margin: auto; 73 | } 74 | /*************************************************************/ 75 | /* Full-width inputs */ 76 | input[type=text], input[type=password], input[type=email], input[type=tel] { 77 | width: 100%; 78 | padding: 12px 20px; 79 | margin: 8px 0; 80 | display: inline-block; 81 | border: 1px solid #ccc; 82 | box-sizing: border-box; 83 | } 84 | 85 | /* Add padding to containers */ 86 | .container { 87 | padding: 16px; 88 | width: 350px; 89 | margin: auto; 90 | } 91 | /* Set a style for all buttons */ 92 | button { 93 | background-color: darkblue; 94 | color: white; 95 | padding: 14px 20px; 96 | margin: 8px 0; 97 | border: none; 98 | cursor: pointer; 99 | width: 100%; 100 | } 101 | .clickme { 102 | background-color: #EEEEEE; 103 | padding: 8px 20px; 104 | text-decoration:none; 105 | font-weight:bold; 106 | border-radius:5px; 107 | cursor:pointer; 108 | } 109 | .danger { 110 | background-color: #FF0000; 111 | color: #FFFFFF; 112 | } 113 | 114 | .danger:hover { 115 | background-color:#EB003B; 116 | color: #FFFFFF; 117 | } 118 | .success { 119 | background-color:#00EB89; 120 | color: #FFFFFF; 121 | } 122 | 123 | .success:hover { 124 | background-color:#00D77E; 125 | color: #FFFFFF; 126 | } 127 | .warning { 128 | background-color:#FFA500; 129 | color: #FFFFFF; 130 | } 131 | 132 | .warning:hover { 133 | background-color:#EB9800; 134 | color: #FFFFFF; 135 | } 136 | .info { 137 | background-color: #00D4FF; 138 | color: #FFFFFF; 139 | } 140 | 141 | .info:hover { 142 | background-color: #00C4EB; 143 | color: #FFFFFF; 144 | } 145 | /* Add a hover effect for buttons */ 146 | button:hover { 147 | opacity: 0.8; 148 | } 149 | 150 | /******************************************************/ 151 | .cancelbtn { 152 | width: auto; 153 | padding: 10px 18px; 154 | background-color: #f44336; 155 | } 156 | /* The "Forgot password" text */ 157 | span.psw { 158 | float: right; 159 | padding-top: 16px; 160 | } 161 | 162 | /*******************************************************/ 163 | /** table Style *********/ 164 | #customers { 165 | font-family: Arial, Helvetica, sans-serif; 166 | border-collapse: collapse; 167 | width: 100%; 168 | } 169 | 170 | #customers td, #customers th { 171 | border: 1px solid #ddd; 172 | padding: 8px; 173 | } 174 | 175 | #customers tr:nth-child(even){background-color: #f2f2f2;} 176 | 177 | #customers tr:hover {background-color: #ddd;} 178 | 179 | #customers th { 180 | padding-top: 12px; 181 | padding-bottom: 12px; 182 | text-align: left; 183 | background-color: #4CAF50; 184 | color: white; 185 | } -------------------------------------------------------------------------------- /UserMangementApp/src/main/java/com/lti/dao/UserInfoDaoImpl.java: -------------------------------------------------------------------------------- 1 | package com.lti.dao; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | import java.sql.ResultSet; 6 | import java.sql.SQLException; 7 | import java.util.HashSet; 8 | import java.util.Set; 9 | 10 | import com.lti.connection.ConnectionFactory; 11 | import com.lti.model.UserInfo; 12 | 13 | public class UserInfoDaoImpl implements UserInfoDao { 14 | 15 | /* 16 | * 1. Connection object: to connect to the table. 2. Statement 17 | * object->PreparedStatement: to execute queries 18 | */ 19 | Connection con = null; 20 | PreparedStatement stmt = null; 21 | 22 | @Override 23 | public int registerUser(UserInfo userInfo) { 24 | con = ConnectionFactory.getConnection(); 25 | String sql = "insert into user881 values(seq_user881.nextval,?,?,?,?,?)"; 26 | try { 27 | stmt = con.prepareStatement(sql); 28 | stmt.setString(1, userInfo.getUserName()); 29 | stmt.setString(2, userInfo.getUserPassword()); 30 | stmt.setString(3, userInfo.getUserEmail()); 31 | stmt.setString(4, userInfo.getUserCity()); 32 | stmt.setString(5, userInfo.getUserMobile()); 33 | 34 | } catch (SQLException e) { 35 | // TODO Auto-generated catch block 36 | e.printStackTrace(); 37 | } 38 | int res = 0; 39 | try { 40 | res = stmt.executeUpdate(); 41 | } catch (SQLException e) { 42 | // TODO Auto-generated catch block 43 | e.printStackTrace(); 44 | } // dml operations 45 | return res; 46 | } 47 | 48 | @Override 49 | public boolean loginUser(String userName, String userPassword) { 50 | // TODO Auto-generated method stub 51 | return false; 52 | } 53 | 54 | @Override 55 | public int updateUser(UserInfo userInfo) { 56 | con = ConnectionFactory.getConnection(); 57 | String sql = "update user881 set username=?,userpassword=?,useremail=?,usercity=?, mobile=? where userId=?"; 58 | try { 59 | stmt = con.prepareStatement(sql); 60 | stmt.setString(1, userInfo.getUserName()); 61 | stmt.setString(2, userInfo.getUserPassword()); 62 | stmt.setString(3, userInfo.getUserEmail()); 63 | stmt.setString(4, userInfo.getUserCity()); 64 | stmt.setString(5, userInfo.getUserMobile()); 65 | stmt.setInt(6, userInfo.getUserId()); 66 | 67 | int res = stmt.executeUpdate(); 68 | return res; 69 | } catch (SQLException e) { 70 | // TODO Auto-generated catch block 71 | e.printStackTrace(); 72 | } 73 | return 0; 74 | } 75 | 76 | @Override 77 | public int deleteUser(int userId) { 78 | con = ConnectionFactory.getConnection(); 79 | String sql = "delete user881 where userId=?"; 80 | try { 81 | stmt = con.prepareStatement(sql); 82 | stmt.setInt(1, userId); 83 | int res = stmt.executeUpdate(); 84 | return res; 85 | } catch (SQLException e) { 86 | // TODO Auto-generated catch block 87 | e.printStackTrace(); 88 | } 89 | return 0; 90 | } 91 | 92 | @Override 93 | public UserInfo findUserById(int userId) { 94 | con = ConnectionFactory.getConnection(); 95 | String sql = "select * from user881 where userid=?"; 96 | try { 97 | stmt = con.prepareStatement(sql); 98 | stmt.setInt(1, userId); 99 | ResultSet rs = stmt.executeQuery(); 100 | if (rs.next()) { 101 | UserInfo userInfo = new UserInfo(); 102 | // setting userInfo object values from result set 103 | userInfo.setUserId(rs.getInt(1)); 104 | userInfo.setUserName(rs.getString(2)); 105 | userInfo.setUserPassword(rs.getString(3)); 106 | userInfo.setUserEmail(rs.getString(4)); 107 | userInfo.setUserCity(rs.getString(5)); 108 | userInfo.setUserMobile(rs.getString(6)); 109 | return userInfo; 110 | } 111 | } catch (SQLException e) { 112 | e.printStackTrace(); 113 | } 114 | 115 | return null; 116 | } 117 | 118 | @Override 119 | public Set viewAllUsers() { 120 | Set users = new HashSet<>(); 121 | con = ConnectionFactory.getConnection(); 122 | String sql = "select * from user881"; 123 | try { 124 | stmt = con.prepareStatement(sql); 125 | ResultSet rs = stmt.executeQuery(); 126 | while (rs.next()) { 127 | UserInfo userInfo = new UserInfo(); 128 | // setting userInfo object values from result set 129 | userInfo.setUserId(rs.getInt(1)); 130 | userInfo.setUserName(rs.getString(2)); 131 | userInfo.setUserPassword(rs.getString(3)); 132 | userInfo.setUserEmail(rs.getString(4)); 133 | userInfo.setUserCity(rs.getString(5)); 134 | userInfo.setUserMobile(rs.getString(6)); 135 | users.add(userInfo); 136 | } 137 | 138 | } catch (SQLException e) { 139 | e.printStackTrace(); 140 | } 141 | return users; 142 | } 143 | 144 | } 145 | -------------------------------------------------------------------------------- /Online Reservation System Project/Reservation/Cancellation.java: -------------------------------------------------------------------------------- 1 | import java.awt.*; 2 | import java.awt.event.*; 3 | import javax.swing.*; 4 | import java.sql.*; 5 | class Cancellation extends Connect implements ActionListener,ItemListener 6 | { 7 | JFrame f; 8 | JLabel l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11; 9 | JTextField t1,t2,t3,t4,t5,t6,t7; 10 | JButton b1,b2; 11 | Choice h; 12 | List li; 13 | PreparedStatement ps; 14 | ResultSet rs; 15 | Statement st; 16 | Cancellation() 17 | { 18 | f=new JFrame("Cancellation"); 19 | f.getContentPane().setLayout(null); 20 | f.getContentPane().setBackground(Color.green); 21 | l1=new JLabel("PNR No"); 22 | l1.setBounds(130,50,50,30); 23 | l2=new JLabel("Train No"); 24 | l2.setBounds(50,90,100,30); 25 | l3=new JLabel("Train Name"); 26 | l3.setBounds(50,120,100,30); 27 | l4=new JLabel("Class"); 28 | l4.setBounds(50,150,100,30); 29 | l5=new JLabel("Date of Journey"); 30 | l5.setBounds(50,180,100,30); 31 | l6=new JLabel("From"); 32 | l6.setBounds(50,210,100,30); 33 | l7=new JLabel("To"); 34 | l7.setBounds(250,210,50,30); 35 | l8=new JLabel("Boarding at"); 36 | l8.setBounds(50,240,100,30); 37 | l9=new JLabel("Name of Passenger"); 38 | l9.setBounds(90,290,120,30); 39 | l10=new JLabel("Age"); 40 | l10.setBounds(240,290,30,30); 41 | l11=new JLabel("Gender"); 42 | l11.setBounds(290,290,100,30); 43 | b1=new JButton("Ok"); 44 | b1.setBackground(Color.yellow); 45 | b1.addActionListener(this); 46 | b1.setBounds(50,480,100,30); 47 | b2=new JButton("Back"); 48 | b2.setBackground(Color.yellow); 49 | b2.addActionListener(this); 50 | b2.setBounds(200,480,100,30); 51 | 52 | b1.setMnemonic('O'); 53 | b2.setMnemonic('B'); 54 | 55 | h=new Choice(); 56 | h.setBounds(230,50,140,30); 57 | h.addItemListener(this); 58 | t1=new JTextField(10); 59 | t1.addActionListener(this); 60 | t1.setBounds(150,90,100,30); 61 | t2=new JTextField(10); 62 | t2.addActionListener(this); 63 | t2.setBounds(150,120,100,30); 64 | t3=new JTextField(10); 65 | t3.addActionListener(this); 66 | t3.setBounds(150,150,100,30); 67 | t4=new JTextField(10); 68 | t4.addActionListener(this); 69 | t4.setBounds(150,180,100,30); 70 | t5=new JTextField(10); 71 | t5.addActionListener(this); 72 | t5.setBounds(150,210,100,30); 73 | t6=new JTextField(10); 74 | t6.addActionListener(this); 75 | t6.setBounds(300,210,100,30); 76 | t7=new JTextField(10); 77 | t7.addActionListener(this); 78 | t7.setBounds(150,240,100,30); 79 | li=new List(5,true); 80 | li.setBounds(80,320,320,100); 81 | f.getContentPane().add(l1); 82 | f.getContentPane().add(l2); 83 | f.getContentPane().add(l3); 84 | f.getContentPane().add(l4); 85 | f.getContentPane().add(l5); 86 | f.getContentPane().add(l6); 87 | f.getContentPane().add(l7); 88 | f.getContentPane().add(l8); 89 | f.getContentPane().add(l9); 90 | f.getContentPane().add(l10); 91 | f.getContentPane().add(l11); 92 | f.getContentPane().add(b1); 93 | f.getContentPane().add(b2); 94 | f.getContentPane().add(h); 95 | f.getContentPane().add(t1); 96 | f.getContentPane().add(t2); 97 | f.getContentPane().add(t3); 98 | f.getContentPane().add(t4); 99 | f.getContentPane().add(t5); 100 | f.getContentPane().add(t6); 101 | f.getContentPane().add(t7); 102 | f.getContentPane().add(li); 103 | f.setSize(1300,1000); 104 | f.setVisible(true); 105 | start(); 106 | } 107 | public void start() 108 | { 109 | try 110 | { 111 | st=con.createStatement(); 112 | rs=st.executeQuery("select * from Reservation"); 113 | while(rs.next()) 114 | { 115 | h.add(rs.getString(1)); 116 | } 117 | } 118 | catch(Exception e) 119 | { 120 | System.out.println("Connection failed:"+e); 121 | } 122 | } 123 | public void itemStateChanged(ItemEvent e) 124 | { 125 | System.out.println((String)h.getSelectedItem()); 126 | try 127 | { 128 | li.removeAll(); 129 | ps=con.prepareStatement("select * from Reservation where PNR_No=?"); 130 | ps.setString(1,h.getSelectedItem()); 131 | rs=ps.executeQuery(); 132 | rs.next(); 133 | t1.setText(rs.getString(2)); 134 | t2.setText(rs.getString(3)); 135 | t3.setText(rs.getString(4)); 136 | t4.setText(rs.getString(5)); 137 | t5.setText(rs.getString(6)); 138 | t6.setText(rs.getString(7)); 139 | t7.setText(rs.getString(8)); 140 | ps=con.prepareStatement("select * from Passenger where PNR_No=?"); 141 | ps.setString(1,h.getSelectedItem()); 142 | rs=ps.executeQuery(); 143 | while(rs.next()) 144 | { 145 | li.add(rs.getString(2)+" "+rs.getString(3)+" "+rs.getString(4)); 146 | } 147 | } 148 | catch(Exception e1) 149 | { 150 | System.out.println("Connection failed"+e1); 151 | } 152 | } 153 | public void actionPerformed(ActionEvent e) 154 | { 155 | if(e.getSource()==b1) 156 | { 157 | try 158 | { 159 | ps=con.prepareStatement("delete from Reservation where PNR_No=?"); 160 | ps.setString(1,h.getSelectedItem()); 161 | ps.executeUpdate(); 162 | 163 | ps=con.prepareStatement("delete from Passenger where PNR_No=?"); 164 | ps.setString(1,h.getSelectedItem()); 165 | ps.executeUpdate(); 166 | 167 | JOptionPane.showMessageDialog(null,"Reservation Cancelled"); 168 | f.setVisible(false); 169 | } 170 | catch(Exception e1) 171 | { 172 | System.out.println("Connection failed:"+e1); 173 | } 174 | } 175 | if(e.getSource()==b2) 176 | { 177 | f.setVisible(false); 178 | new Main(); 179 | } 180 | } 181 | public static void main(String args[]) 182 | { 183 | new Cancellation(); 184 | } 185 | } 186 | 187 | -------------------------------------------------------------------------------- /Online Reservation System Project/Reservation/Passenger.java: -------------------------------------------------------------------------------- 1 | import java.awt.*; 2 | import java.awt.event.*; 3 | import java.sql.*; 4 | import javax.swing.*; 5 | class Passenger extends Connect implements ActionListener 6 | { 7 | JFrame f; 8 | JLabel l1,l2,l3,l4,l5,l6; 9 | JTextField t1,t2,t3; 10 | JButton b1,b2,b3; 11 | Checkbox c1,c2,c3,c4,c5; 12 | CheckboxGroup cbg; 13 | JTextArea ta; 14 | PreparedStatement ps; 15 | Statement st; 16 | ResultSet rs; 17 | int pno; 18 | JLabel imgL; 19 | ImageIcon img; 20 | Passenger(int p) 21 | { 22 | pno=p; 23 | img=new ImageIcon("LOGO2.jpg"); 24 | imgL=new JLabel(img); 25 | imgL.setBounds(0,400,400,200); 26 | f=new JFrame("Passenger"); 27 | f.getContentPane().setLayout(null); 28 | f.getContentPane().setBackground(Color.green); 29 | l1=new JLabel("PId"); 30 | l1.setBounds(50,50,100,30); 31 | t1=new JTextField(10); 32 | t1.setBounds(170,50,100,30); 33 | l2=new JLabel("Name of Passenger"); 34 | l2.setBounds(50,80,120,30); 35 | t2=new JTextField(10); 36 | t2.setBounds(170,80,100,30); 37 | l3=new JLabel("Age"); 38 | l3.setBounds(50,130,100,30); 39 | t3=new JTextField(10); 40 | t3.setBounds(150,130,50,30); 41 | l4=new JLabel("Gender"); 42 | l4.setBounds(250,130,50,30); 43 | ta=new JTextArea(5,10); 44 | ta.setBounds(150,170,130,70); 45 | l5=new JLabel("Address"); 46 | l5.setBounds(50,170,100,30); 47 | l6=new JLabel("Catagory"); 48 | l6.setBounds(50,240,100,30); 49 | b1=new JButton("More"); 50 | b1.setBackground(Color.yellow); 51 | b1.addActionListener(this); 52 | b1.setBounds(50,330,100,30); 53 | b2=new JButton("Save"); 54 | b2.setBackground(Color.yellow); 55 | b2.addActionListener(this); 56 | b2.setBounds(170,330,100,30); 57 | b3=new JButton("Back"); 58 | b3.setBackground(Color.yellow); 59 | b3.addActionListener(this); 60 | b3.setBounds(290,330,100,30); 61 | 62 | b1.setMnemonic('M'); 63 | b2.setMnemonic('S'); 64 | b3.setMnemonic('B'); 65 | 66 | cbg=new CheckboxGroup(); 67 | c1=new Checkbox("Male",cbg,true); 68 | c1.setBounds(300,130,100,30); 69 | c2=new Checkbox("Female",cbg,false); 70 | c2.setBounds(300,160,100,30); 71 | c3=new Checkbox("General"); 72 | c3.setBounds(150,240,100,30); 73 | c4=new Checkbox("Senior Citizen"); 74 | c4.setBounds(150,270,100,30); 75 | c5=new Checkbox("Ex-serviceman"); 76 | c5.setBounds(150,300,100,30); 77 | f.getContentPane().add(l1); 78 | f.getContentPane().add(l2); 79 | f.getContentPane().add(l3); 80 | f.getContentPane().add(l4); 81 | f.getContentPane().add(l5); 82 | f.getContentPane().add(l6); 83 | f.getContentPane().add(t1); 84 | f.getContentPane().add(t2); 85 | f.getContentPane().add(t3); 86 | f.getContentPane().add(ta); 87 | f.getContentPane().add(b1); 88 | f.getContentPane().add(b2); 89 | f.getContentPane().add(b3); 90 | f.getContentPane().add(c1); 91 | f.getContentPane().add(c2); 92 | f.getContentPane().add(c3); 93 | f.getContentPane().add(c4); 94 | f.getContentPane().add(c5); 95 | f.getContentPane().add(imgL); 96 | f.setSize(1300,1000); 97 | f.setVisible(true); 98 | } 99 | public void actionPerformed(ActionEvent e) 100 | { 101 | if(e.getSource()==b1) 102 | { 103 | try 104 | { 105 | //saving existing record 106 | String cat=""; 107 | ps=con.prepareStatement("insert into TempPassenger values(?,?,?,?,?,?,?)"); 108 | ps.setString(1,t1.getText()); 109 | ps.setString(2,t2.getText()); 110 | ps.setString(3,t3.getText()); 111 | ps.setString(4,cbg.getSelectedCheckbox().getLabel()); 112 | ps.setString(5,ta.getText()); 113 | if(c3.getState()) 114 | cat+=c3.getLabel()+","; 115 | if(c4.getState()) 116 | cat+=c4.getLabel()+","; 117 | if(c5.getState()) 118 | cat+=c5.getLabel()+","; 119 | ps.setString(6,cat); 120 | ps.setInt(7,pno); 121 | ps.executeUpdate(); 122 | ps.close(); 123 | 124 | //opening new form 125 | Passenger P=new Passenger(pno); 126 | st=con.createStatement(); 127 | rs=st.executeQuery("select * from PassengerID"); 128 | rs.next(); 129 | int x=rs.getInt(1); 130 | P.t1.setText(String.valueOf(x)); 131 | st.close(); 132 | //update passenger id 133 | ps=con.prepareStatement("update PassengerID set PID=? where PID=?"); 134 | ps.setInt(1,(x+1)); 135 | ps.setInt(2,x); 136 | ps.executeUpdate(); 137 | ps.close(); 138 | } 139 | catch(Exception e1) 140 | { 141 | System.out.println("Connection failed:"+e1); 142 | } 143 | } 144 | if(e.getSource()==b2) 145 | { 146 | 147 | try 148 | { 149 | String cat=""; 150 | ps=con.prepareStatement("insert into TempPassenger values(?,?,?,?,?,?,?)"); 151 | ps.setString(1,t1.getText()); 152 | ps.setString(2,t2.getText()); 153 | ps.setString(3,t3.getText()); 154 | ps.setString(4,cbg.getSelectedCheckbox().getLabel()); 155 | ps.setString(5,ta.getText()); 156 | if(c3.getState()) 157 | cat+=c3.getLabel()+","; 158 | if(c4.getState()) 159 | cat+=c4.getLabel()+","; 160 | if(c5.getState()) 161 | cat+=c5.getLabel()+","; 162 | ps.setString(6,cat); 163 | ps.setInt(7,pno); 164 | ps.executeUpdate(); 165 | ps.close(); 166 | 167 | st=con.createStatement(); 168 | rs=st.executeQuery("select * from TempPassenger"); 169 | while(rs.next()) 170 | { 171 | ps=con.prepareStatement("insert into Passenger values(?,?,?,?,?,?,?)"); 172 | ps.setString(1,rs.getString(1)); 173 | ps.setString(2,rs.getString(2)); 174 | ps.setString(3,rs.getString(3)); 175 | ps.setString(4,rs.getString(4)); 176 | ps.setString(5,rs.getString(5)); 177 | ps.setString(6,rs.getString(6)); 178 | ps.setString(7,rs.getString(7)); 179 | ps.executeUpdate(); 180 | ps.close(); 181 | } 182 | st=con.createStatement(); 183 | st.executeUpdate("delete from TempPassenger"); 184 | JOptionPane.showMessageDialog(null,"Record Saved"); 185 | b2.setEnabled(false); 186 | b1.setEnabled(false); 187 | st.close(); 188 | } 189 | catch(Exception e1) 190 | { 191 | System.out.println("Connection failed:"+e1); 192 | } 193 | } 194 | 195 | if(e.getSource()==b3) 196 | { 197 | f.setVisible(false); 198 | new Reservation(); 199 | } 200 | } 201 | public static void main(String args[]) 202 | { 203 | new Passenger(0); 204 | } 205 | } -------------------------------------------------------------------------------- /Online Reservation System Project/Reservation/Reservation.java: -------------------------------------------------------------------------------- 1 | import java.awt.*; 2 | import java.awt.event.*; 3 | import java.sql.*; 4 | import javax.swing.*; 5 | class Reservation extends Connect implements ActionListener,FocusListener 6 | { 7 | JFrame f; 8 | JLabel l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,l13; 9 | JTextField t1,t2,t3,t4,t5,t6,t7; 10 | Choice h; 11 | JTextArea ta; 12 | JButton b1,b2,b3; 13 | PreparedStatement ps; 14 | Statement st; 15 | ResultSet rs; 16 | int x; 17 | JLabel imgL; 18 | ImageIcon img; 19 | void disable() 20 | { 21 | t1.setEnabled(false); 22 | t2.setEnabled(false); 23 | t3.setEnabled(false); 24 | t4.setEnabled(false); 25 | t5.setEnabled(false); 26 | t6.setEnabled(false); 27 | t7.setEnabled(false); 28 | h.setEnabled(false); 29 | b2.setEnabled(false); 30 | } 31 | void enable() 32 | { 33 | t1.setEnabled(true); 34 | t2.setEnabled(true); 35 | t3.setEnabled(true); 36 | t4.setEnabled(true); 37 | t5.setEnabled(true); 38 | t6.setEnabled(true); 39 | t7.setEnabled(true); 40 | h.setEnabled(true); 41 | b2.setEnabled(true); 42 | } 43 | Reservation() 44 | { 45 | img=new ImageIcon("LOGO1.jpg"); 46 | imgL=new JLabel(img); 47 | imgL.setBounds(0,320,500,250); 48 | f=new JFrame("Reservation"); 49 | f.getContentPane().setLayout(null); 50 | f.getContentPane().setBackground(Color.green); 51 | l1=new JLabel("PNR No"); 52 | l1.setBounds(130,50,100,30); 53 | l2=new JLabel("Train No"); 54 | l2.setBounds(50,80,100,30); 55 | l3=new JLabel("Train Name"); 56 | l3.setBounds(50,110,100,30); 57 | l4=new JLabel("Class"); 58 | l4.setBounds(50,140,100,30); 59 | l5=new JLabel("Date of Journey"); 60 | l5.setBounds(50,170,100,30); 61 | l6=new JLabel("From"); 62 | l6.setBounds(50,200,100,30); 63 | l7=new JLabel("To"); 64 | l7.setBounds(250,200,50,30); 65 | l8=new JLabel("Boarding at"); 66 | l8.setBounds(50,230,100,30); 67 | t1=new JTextField(10); 68 | t1.setBounds(230,50,120,30); 69 | t2=new JTextField(10); 70 | t2.addFocusListener(this); 71 | t2.setBounds(150,80,100,30); 72 | t3=new JTextField(10); 73 | t3.setBounds(150,110,100,30); 74 | t4=new JTextField(10); 75 | t4.setBounds(150,170,100,30); 76 | t5=new JTextField(10); 77 | t5.setBounds(150,200,100,30); 78 | t6=new JTextField(10); 79 | t6.setBounds(300,200,100,30); 80 | t7=new JTextField(10); 81 | t7.setBounds(150,230,100,30); 82 | h=new Choice(); 83 | h.setBounds(150,140,100,30); 84 | h.add("AC"); 85 | h.add("SL"); 86 | b1=new JButton("Insert"); 87 | b1.setBackground(Color.yellow); 88 | b1.setBounds(50,270,100,30); 89 | b1.addActionListener(this); 90 | b2=new JButton("Next"); 91 | b2.setBackground(Color.yellow); 92 | b2.setBounds(160,270,100,30); 93 | b2.addActionListener(this); 94 | b3=new JButton("Main"); 95 | b3.setBackground(Color.yellow); 96 | b3.setBounds(270,270,100,30); 97 | b3.addActionListener(this); 98 | 99 | b1.setMnemonic('I'); 100 | b2.setMnemonic('N'); 101 | b3.setMnemonic('M'); 102 | 103 | f.getContentPane().add(l1); 104 | f.getContentPane().add(l2); 105 | f.getContentPane().add(l3); 106 | f.getContentPane().add(l4); 107 | f.getContentPane().add(l5); 108 | f.getContentPane().add(l6); 109 | f.getContentPane().add(l7); 110 | f.getContentPane().add(l8); 111 | f.getContentPane().add(t1); 112 | f.getContentPane().add(t2); 113 | f.getContentPane().add(t3); 114 | f.getContentPane().add(t4); 115 | f.getContentPane().add(t5); 116 | f.getContentPane().add(t6); 117 | f.getContentPane().add(t7); 118 | f.getContentPane().add(h); 119 | f.getContentPane().add(b1); 120 | f.getContentPane().add(b2); 121 | f.getContentPane().add(b3); 122 | f.getContentPane().add(imgL); 123 | f.setSize(1300,1000); 124 | f.setVisible(true); 125 | disable(); 126 | } 127 | public void focusLost(FocusEvent e) 128 | { 129 | if(t2.getText().length()!=0) 130 | { 131 | try 132 | { 133 | ps=con.prepareStatement("select Train_Name from Train where Train_No=?"); 134 | ps.setString(1,t2.getText()); 135 | rs=ps.executeQuery(); 136 | if(rs.next()) 137 | { 138 | t3.setText(rs.getString(1)); 139 | } 140 | } 141 | catch(Exception e1) 142 | { 143 | System.out.println("Connection failed:"+e1); 144 | } 145 | } 146 | } 147 | public void focusGained(FocusEvent e) 148 | {} 149 | public void actionPerformed(ActionEvent e) 150 | { 151 | if(e.getSource()==b1) 152 | { 153 | enable(); 154 | b1.setEnabled(false); 155 | try 156 | { 157 | st=con.createStatement(); 158 | rs=st.executeQuery("select * from PNR"); 159 | rs.next(); 160 | x=rs.getInt(1); 161 | t1.setText(String.valueOf(x)); 162 | 163 | } 164 | catch(Exception e1) 165 | { 166 | System.out.println("Connection failed:"+e1); 167 | } 168 | } 169 | if(e.getSource()==b2) 170 | { 171 | try 172 | { 173 | ps=con.prepareStatement("insert into Reservation values(?,?,?,?,?,?,?,?)"); 174 | ps.setString(1,t1.getText()); 175 | ps.setString(2,t2.getText()); 176 | ps.setString(3,t3.getText()); 177 | ps.setString(4,h.getSelectedItem()); 178 | ps.setString(5,t4.getText()); 179 | ps.setString(6,t5.getText()); 180 | ps.setString(7,t6.getText()); 181 | ps.setString(8,t7.getText()); 182 | ps.executeUpdate(); 183 | 184 | 185 | //update PNR no. 186 | ps=con.prepareStatement("update PNR set PNR_No=? where PNR_No=?"); 187 | ps.setInt(1,(x+1)); 188 | ps.setInt(2,x); 189 | ps.executeUpdate(); 190 | JOptionPane.showMessageDialog(null, "Record Saved"); 191 | 192 | b1.setEnabled(true); 193 | b2.setEnabled(false); 194 | f.setVisible(false); 195 | } 196 | catch(Exception e1) 197 | { 198 | System.out.println("Connection failed:"+e1); 199 | } 200 | try 201 | { 202 | st=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY); 203 | rs=st.executeQuery("select * from Reservation"); 204 | rs.last(); 205 | x=rs.getInt(1); 206 | Passenger P=new Passenger(x); 207 | st=con.createStatement(); 208 | rs=st.executeQuery("select * from PassengerID"); 209 | rs.next(); 210 | x=rs.getInt(1); 211 | P.t1.setText(String.valueOf(x)); 212 | ps=con.prepareStatement("update PassengerID set PID=? where PID=?"); 213 | ps.setInt(1,(x+1)); 214 | ps.setInt(2,x); 215 | ps.executeUpdate(); 216 | } 217 | catch(Exception e1) 218 | { 219 | System.out.println("Connection failed:"+e1); 220 | } 221 | } 222 | if(e.getSource()==b3) 223 | { 224 | f.setVisible(false); 225 | new Main(); 226 | } 227 | } 228 | public static void main(String args[]) 229 | { 230 | new Reservation(); 231 | } 232 | } -------------------------------------------------------------------------------- /.metadata/.log: -------------------------------------------------------------------------------- 1 | !SESSION 2020-06-11 11:11:36.352 ----------------------------------------------- 2 | eclipse.buildId=4.7.0.I20170612-0950 3 | java.version=11.0.6 4 | java.vendor=Amazon.com Inc. 5 | BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US 6 | Framework arguments: -product org.eclipse.epp.package.jee.product 7 | Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product 8 | 9 | !ENTRY org.eclipse.osgi 4 0 2020-06-11 11:15:36.706 10 | !MESSAGE Application error 11 | !STACK 1 12 | org.eclipse.e4.core.di.InjectionException: java.lang.NoClassDefFoundError: javax/annotation/PostConstruct 13 | at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:410) 14 | at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:318) 15 | at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162) 16 | at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createDefaultHeadlessContext(E4Application.java:491) 17 | at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createDefaultContext(E4Application.java:505) 18 | at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:204) 19 | at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:614) 20 | at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336) 21 | at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594) 22 | at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148) 23 | at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:151) 24 | at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) 25 | at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134) 26 | at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104) 27 | at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388) 28 | at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243) 29 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 30 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 31 | at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 32 | at java.base/java.lang.reflect.Method.invoke(Method.java:566) 33 | at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653) 34 | at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590) 35 | at org.eclipse.equinox.launcher.Main.run(Main.java:1499) 36 | Caused by: java.lang.NoClassDefFoundError: javax/annotation/PostConstruct 37 | at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:124) 38 | at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:399) 39 | ... 22 more 40 | Caused by: java.lang.ClassNotFoundException: javax.annotation.PostConstruct cannot be found by org.eclipse.e4.core.di_1.6.100.v20170421-1418 41 | at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:433) 42 | at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395) 43 | at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387) 44 | at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150) 45 | at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) 46 | ... 24 more 47 | 48 | !ENTRY org.eclipse.e4.ui.workbench 4 0 2020-06-11 11:15:36.830 49 | !MESSAGE FrameworkEvent ERROR 50 | !STACK 0 51 | java.lang.NoClassDefFoundError: javax/annotation/PreDestroy 52 | at org.eclipse.e4.core.internal.di.InjectorImpl.disposed(InjectorImpl.java:450) 53 | at org.eclipse.e4.core.internal.di.Requestor.disposed(Requestor.java:156) 54 | at org.eclipse.e4.core.internal.contexts.ContextObjectSupplier$ContextInjectionListener.update(ContextObjectSupplier.java:78) 55 | at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.update(TrackableComputationExt.java:111) 56 | at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.handleInvalid(TrackableComputationExt.java:74) 57 | at org.eclipse.e4.core.internal.contexts.EclipseContext.dispose(EclipseContext.java:178) 58 | at org.eclipse.e4.core.internal.contexts.osgi.EclipseContextOSGi.dispose(EclipseContextOSGi.java:99) 59 | at org.eclipse.e4.core.internal.contexts.osgi.EclipseContextOSGi.bundleChanged(EclipseContextOSGi.java:141) 60 | at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:908) 61 | at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) 62 | at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148) 63 | at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:213) 64 | at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:120) 65 | at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:112) 66 | at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:168) 67 | at org.eclipse.osgi.container.Module.publishEvent(Module.java:476) 68 | at org.eclipse.osgi.container.Module.doStop(Module.java:634) 69 | at org.eclipse.osgi.container.Module.stop(Module.java:498) 70 | at org.eclipse.osgi.container.SystemModule.stop(SystemModule.java:202) 71 | at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule$1.run(EquinoxBundle.java:165) 72 | at java.base/java.lang.Thread.run(Thread.java:834) 73 | Caused by: java.lang.ClassNotFoundException: javax.annotation.PreDestroy cannot be found by org.eclipse.e4.core.di_1.6.100.v20170421-1418 74 | at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:433) 75 | at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395) 76 | at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387) 77 | at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150) 78 | at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) 79 | ... 21 more 80 | !SESSION 2020-06-15 16:02:38.067 ----------------------------------------------- 81 | eclipse.buildId=4.7.0.I20170612-0950 82 | java.version=11.0.6 83 | java.vendor=Amazon.com Inc. 84 | BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US 85 | Framework arguments: -product org.eclipse.epp.package.jee.product 86 | Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product 87 | 88 | !ENTRY org.eclipse.osgi 4 0 2020-06-15 16:02:52.402 89 | !MESSAGE Application error 90 | !STACK 1 91 | org.eclipse.e4.core.di.InjectionException: java.lang.NoClassDefFoundError: javax/annotation/PostConstruct 92 | at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:410) 93 | at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:318) 94 | at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162) 95 | at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createDefaultHeadlessContext(E4Application.java:491) 96 | at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createDefaultContext(E4Application.java:505) 97 | at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:204) 98 | at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:614) 99 | at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336) 100 | at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594) 101 | at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148) 102 | at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:151) 103 | at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) 104 | at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134) 105 | at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104) 106 | at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388) 107 | at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243) 108 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 109 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 110 | at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 111 | at java.base/java.lang.reflect.Method.invoke(Method.java:566) 112 | at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653) 113 | at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590) 114 | at org.eclipse.equinox.launcher.Main.run(Main.java:1499) 115 | Caused by: java.lang.NoClassDefFoundError: javax/annotation/PostConstruct 116 | at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:124) 117 | at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:399) 118 | ... 22 more 119 | Caused by: java.lang.ClassNotFoundException: javax.annotation.PostConstruct cannot be found by org.eclipse.e4.core.di_1.6.100.v20170421-1418 120 | at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:433) 121 | at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395) 122 | at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387) 123 | at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150) 124 | at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) 125 | ... 24 more 126 | 127 | !ENTRY org.eclipse.e4.ui.workbench 4 0 2020-06-15 16:02:52.509 128 | !MESSAGE FrameworkEvent ERROR 129 | !STACK 0 130 | java.lang.NoClassDefFoundError: javax/annotation/PreDestroy 131 | at org.eclipse.e4.core.internal.di.InjectorImpl.disposed(InjectorImpl.java:450) 132 | at org.eclipse.e4.core.internal.di.Requestor.disposed(Requestor.java:156) 133 | at org.eclipse.e4.core.internal.contexts.ContextObjectSupplier$ContextInjectionListener.update(ContextObjectSupplier.java:78) 134 | at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.update(TrackableComputationExt.java:111) 135 | at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.handleInvalid(TrackableComputationExt.java:74) 136 | at org.eclipse.e4.core.internal.contexts.EclipseContext.dispose(EclipseContext.java:178) 137 | at org.eclipse.e4.core.internal.contexts.osgi.EclipseContextOSGi.dispose(EclipseContextOSGi.java:99) 138 | at org.eclipse.e4.core.internal.contexts.osgi.EclipseContextOSGi.bundleChanged(EclipseContextOSGi.java:141) 139 | at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:908) 140 | at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) 141 | at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148) 142 | at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:213) 143 | at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:120) 144 | at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:112) 145 | at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:168) 146 | at org.eclipse.osgi.container.Module.publishEvent(Module.java:476) 147 | at org.eclipse.osgi.container.Module.doStop(Module.java:634) 148 | at org.eclipse.osgi.container.Module.stop(Module.java:498) 149 | at org.eclipse.osgi.container.SystemModule.stop(SystemModule.java:202) 150 | at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule$1.run(EquinoxBundle.java:165) 151 | at java.base/java.lang.Thread.run(Thread.java:834) 152 | Caused by: java.lang.ClassNotFoundException: javax.annotation.PreDestroy cannot be found by org.eclipse.e4.core.di_1.6.100.v20170421-1418 153 | at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:433) 154 | at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395) 155 | at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387) 156 | at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150) 157 | at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) 158 | ... 21 more 159 | !SESSION 2020-11-06 18:45:59.391 ----------------------------------------------- 160 | eclipse.buildId=4.7.0.I20170612-0950 161 | java.version=11.0.6 162 | java.vendor=Amazon.com Inc. 163 | BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US 164 | Framework arguments: -product org.eclipse.epp.package.jee.product 165 | Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product 166 | 167 | !ENTRY org.eclipse.osgi 4 0 2020-11-06 18:46:14.300 168 | !MESSAGE Application error 169 | !STACK 1 170 | org.eclipse.e4.core.di.InjectionException: java.lang.NoClassDefFoundError: javax/annotation/PostConstruct 171 | at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:410) 172 | at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:318) 173 | at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162) 174 | at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createDefaultHeadlessContext(E4Application.java:491) 175 | at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createDefaultContext(E4Application.java:505) 176 | at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:204) 177 | at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:614) 178 | at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336) 179 | at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594) 180 | at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148) 181 | at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:151) 182 | at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) 183 | at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134) 184 | at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104) 185 | at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388) 186 | at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243) 187 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 188 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 189 | at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 190 | at java.base/java.lang.reflect.Method.invoke(Method.java:566) 191 | at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653) 192 | at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590) 193 | at org.eclipse.equinox.launcher.Main.run(Main.java:1499) 194 | Caused by: java.lang.NoClassDefFoundError: javax/annotation/PostConstruct 195 | at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:124) 196 | at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:399) 197 | ... 22 more 198 | Caused by: java.lang.ClassNotFoundException: javax.annotation.PostConstruct cannot be found by org.eclipse.e4.core.di_1.6.100.v20170421-1418 199 | at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:433) 200 | at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395) 201 | at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387) 202 | at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150) 203 | at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) 204 | ... 24 more 205 | 206 | !ENTRY org.eclipse.e4.ui.workbench 4 0 2020-11-06 18:46:14.358 207 | !MESSAGE FrameworkEvent ERROR 208 | !STACK 0 209 | java.lang.NoClassDefFoundError: javax/annotation/PreDestroy 210 | at org.eclipse.e4.core.internal.di.InjectorImpl.disposed(InjectorImpl.java:450) 211 | at org.eclipse.e4.core.internal.di.Requestor.disposed(Requestor.java:156) 212 | at org.eclipse.e4.core.internal.contexts.ContextObjectSupplier$ContextInjectionListener.update(ContextObjectSupplier.java:78) 213 | at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.update(TrackableComputationExt.java:111) 214 | at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.handleInvalid(TrackableComputationExt.java:74) 215 | at org.eclipse.e4.core.internal.contexts.EclipseContext.dispose(EclipseContext.java:178) 216 | at org.eclipse.e4.core.internal.contexts.osgi.EclipseContextOSGi.dispose(EclipseContextOSGi.java:99) 217 | at org.eclipse.e4.core.internal.contexts.osgi.EclipseContextOSGi.bundleChanged(EclipseContextOSGi.java:141) 218 | at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:908) 219 | at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) 220 | at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148) 221 | at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:213) 222 | at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:120) 223 | at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:112) 224 | at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:168) 225 | at org.eclipse.osgi.container.Module.publishEvent(Module.java:476) 226 | at org.eclipse.osgi.container.Module.doStop(Module.java:634) 227 | at org.eclipse.osgi.container.Module.stop(Module.java:498) 228 | at org.eclipse.osgi.container.SystemModule.stop(SystemModule.java:202) 229 | at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule$1.run(EquinoxBundle.java:165) 230 | at java.base/java.lang.Thread.run(Thread.java:834) 231 | Caused by: java.lang.ClassNotFoundException: javax.annotation.PreDestroy cannot be found by org.eclipse.e4.core.di_1.6.100.v20170421-1418 232 | at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:433) 233 | at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395) 234 | at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387) 235 | at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150) 236 | at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) 237 | ... 21 more 238 | --------------------------------------------------------------------------------