diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 00000000..cecbd8ec Binary files /dev/null and b/.DS_Store differ diff --git a/.breakpoints b/.breakpoints new file mode 100644 index 00000000..5cc232f0 --- /dev/null +++ b/.breakpoints @@ -0,0 +1,3 @@ +{ + "files": {} +} \ No newline at end of file diff --git a/.classpath b/.classpath new file mode 100644 index 00000000..75b806fd --- /dev/null +++ b/.classpath @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml new file mode 100644 index 00000000..df1d0727 --- /dev/null +++ b/.github/workflows/auto-merge.yml @@ -0,0 +1,31 @@ +name: Auto Merge PR +on: + pull_request: + types: + - labeled + - unlabeled + - synchronize + - opened + - edited + - ready_for_review + - reopened + - unlocked + pull_request_review: + types: + - submitted + check_suite: + types: + - completed + status: {} +jobs: + automerge: + runs-on: ubuntu-latest + steps: + - name: Merging PR + uses: "pascalgn/automerge-action@v0.14.3" + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + MERGE_METHOD: "squash" + MERGE_LABELS: "" + MERGE_COMMIT_MESSAGE: "pull-request-title" + MERGE_REQUIRED_APPROVALS: "0" diff --git a/.github/workflows/auto-pr.yml b/.github/workflows/auto-pr.yml new file mode 100644 index 00000000..cd2d7032 --- /dev/null +++ b/.github/workflows/auto-pr.yml @@ -0,0 +1,31 @@ +name: Merge PR +on: + pull_request: + types: + - labeled + - unlabeled + - synchronize + - opened + - edited + - ready_for_review + - reopened + - unlocked + pull_request_review: + types: + - submitted + check_suite: + types: + - completed + status: {} +jobs: + automerge: + runs-on: ubuntu-latest + steps: + - name: Merging PR + uses: "pascalgn/automerge-action@v0.14.3" + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + MERGE_LABELS: "!automerge" + MERGE_METHOD: "merge" + MERGE_COMMIT_MESSAGE: "pull-request-title" + MERGE_REQUIRED_APPROVALS: "0" diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..9902a215 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "UDP_VIDEO_CALLER"] + path = UDP_VIDEO_CALLER + url = https://github.com/Adidem23/UDP_VideoCaller.git diff --git a/.project b/.project new file mode 100644 index 00000000..a2380fe3 --- /dev/null +++ b/.project @@ -0,0 +1,34 @@ + + + myartifactid + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + + + 1679078569810 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + + diff --git a/.replit b/.replit new file mode 100644 index 00000000..b5052298 --- /dev/null +++ b/.replit @@ -0,0 +1,64 @@ +compile = "javac -classpath .:target/dependency/* -d . $(find . -type f -name '*.java')" +run = "java -classpath .:target/dependency/* Main" +entrypoint = "Main.java" +hidden = ["**/*.class"] + +[packager] +language = "java" + +[packager.features] +packageSearch = true + +[languages.java] +pattern = "**/*.java" + +[languages.java.languageServer] +start = "jdt-language-server" + +[unitTest] +language = "java" + +[nix] +channel = "stable-22_11" + +[debugger] +support = true + +[debugger.compile] +command = "javac -classpath .:/run_dir/junit-4.12.jar:target/dependency/* -g -d . $(find . -type f -name '*.java')" + +[debugger.interactive] +transport = "localhost:0" +connectTimeout = 60 +startCommand = "java-debug" + +[debugger.interactive.initializeMessage] +command = "initialize" +type = "request" + +[debugger.interactive.initializeMessage.arguments] +adapterID = "cppdbg" +clientID = "replit" +clientName = "replit.com" +columnsStartAt1 = true +linesStartAt1 = true +locale = "en-us" +pathFormat = "path" +supportsInvalidatedEvent = true +supportsProgressReporting = true +supportsRunInTerminalRequest = true +supportsVariablePaging = true +supportsVariableType = true + +[debugger.interactive.launchMessage] +command = "launch" +type = "request" + +[debugger.interactive.launchMessage.arguments] +classPaths = ["."] +mainClass = "Main" + +[deployment] +build = ["javac", "-classpath", ".:target/dependency/*", "-d", ".", "$(find . -type f -name '*.java')"] +run = ["java", "-classpath", ".:target/dependency/*", "Main"] +deploymentTarget = "cloudrun" \ No newline at end of file diff --git a/.settings/org.eclipse.jdt.apt.core.prefs b/.settings/org.eclipse.jdt.apt.core.prefs new file mode 100644 index 00000000..d4313d4b --- /dev/null +++ b/.settings/org.eclipse.jdt.apt.core.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.apt.aptEnabled=false diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..ac8e7500 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,9 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.processAnnotations=disabled +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 00000000..f897a7f1 --- /dev/null +++ b/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/2048/.gitignore b/2048/.gitignore new file mode 100644 index 00000000..814d83c0 --- /dev/null +++ b/2048/.gitignore @@ -0,0 +1,8 @@ +.DS_Store +Thumbs.db +db.json +*.log +node_modules/ +public/ +.deploy*/ +.history \ No newline at end of file diff --git a/2048/README.md b/2048/README.md new file mode 100644 index 00000000..b9265e24 --- /dev/null +++ b/2048/README.md @@ -0,0 +1,3 @@ +# 2048 project made using HTML CSS Javascript + + diff --git a/2048/css/keyframes.css b/2048/css/keyframes.css new file mode 100644 index 00000000..24d459f3 --- /dev/null +++ b/2048/css/keyframes.css @@ -0,0 +1,30 @@ +@keyframes moveup{ + 0%{ + transform: translateY(0); + opacity: 1; + } + 100%{ + transform: translateY(-150px); + opacity: 0; + } +} +@keyframes appear{ + 0%{ + transform: scale(0); + } + 100%{ + transform: scale(1); + } +} +@keyframes add{ + 0%{ + transform: scale(1); + box-shadow: 0 0 1px red; + } + 50%{ + transform: scale(1.2); + } + 100%{ + transform: scale(1); + } +} \ No newline at end of file diff --git a/2048/css/media.css b/2048/css/media.css new file mode 100644 index 00000000..4a9c685a --- /dev/null +++ b/2048/css/media.css @@ -0,0 +1,55 @@ +@media screen and (max-width:1250px){ + html,body{ + font-size: 15px; + } + .container{ + width: 280px; + } + h1.title{ + font-size: 31px; + } + .score-container, + .best-container{ + padding: 3px 10px; + } + .game-container{ + margin-top: 10px; + width: 280px; + height: 280px; + } + .grid-container, + .tile-container{ + width: 260px; + height: 260px; + } + .grid-row, + .tile{ + height: 22.75%; + } + .grid-cell, + .tile{ + width: 22.75%; + } + .grid-row{ + margin-bottom: 3%; + } + .grid-cell{ + margin-right: 3%; + } + .tile{ + font-size: 35px; + } + .tile[data-val="128"], + .tile[data-val="256"], + .tile[data-val="512"]{ + font-size: 25px; + } + .tile[data-val="1024"], + .tile[data-val="2048"]{ + font-size: 21px; + } + + .pop-container p{ + font-size: 30px; + } +} \ No newline at end of file diff --git a/2048/css/style.css b/2048/css/style.css new file mode 100644 index 00000000..2b0ff70a --- /dev/null +++ b/2048/css/style.css @@ -0,0 +1,329 @@ +@import "../font/clear-sans.css"; + +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +html, +body { + font-family: "Clear Sans", "Helvetica Neue", Arial, sans-serif; + color: #776e65; + font-size: 18px; + background: rgba(238, 228, 218, 0.5); + overflow: hidden; + height: 100%; +} + +a { + text-decoration: none; + color: inherit; + cursor: pointer; +} + +.container { + position: relative; + margin: 0 auto; + display: flex; + flex-direction: column; + width: 450px; + height: 100vh; + box-sizing: content-box; +} + +.heading { + margin: 20px 0; +} + +.heading { + display: flex; + align-items: center; + justify-content: space-between; + flex-wrap: wrap; +} + +h1.title { + font-size: 74px; + line-height: 66px; + font-weight: bold; +} + +.scores-container { + float: right; +} + +.score-container, +.best-container { + float: left; + padding: 3px 20px; + background: #bbada0; + border-radius: 3px; + font-size: 25px; + font-weight: bold; + color: white; + text-align: center; +} + +.score-container { + position: relative; + margin-right: 15px; + margin-bottom: 5px; +} + +.score-container .title, +.best-container .title { + font-size: 13px; + color: #eee4da; +} + +.score-addition { + position: absolute; + left: 0; + bottom: 0; + width: 100%; + color: rgba(119, 110, 101, 0.9); + z-index: 100; + opacity: 0; + font-size: 1rem; +} + +.score-addition.action { + animation: 2s moveup; +} + +.above-game { + font-size: 0.9rem; +} + +.restart-btn { + margin: 5px 0 0 5px; + float: right; + padding: 0 8px; + background: #8f7a66; + color: white; + height: 40px; + line-height: 40px; + border-radius: 3px; + font-weight: bold; +} + +h2.subtitle { + font-size: 1em; +} + +.game-container { + position: relative; + margin-top: 15px; + width: 450px; + height: 450px; + background: #bbada0; + border-radius: 6px; + touch-action: none; +} + +.grid-container, +.tile-container, +.pop-container { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + margin: auto; + width: 426px; + height: 426px; +} + + +.grid-row { + display: flex; + margin-bottom: 2%; +} + +.grid-row, +.tile { + height: 23.5%; +} + +.grid-cell, +.tile { + width: 23.5%; + border-radius: 3px; +} + +.grid-cell { + margin-right: 2%; + background: rgba(238, 228, 218, 0.35); +} + +.grid-cell:nth-of-type(4n) { + margin-right: 0; +} + +.tile { + position: absolute; + display: flex; + align-items: center; + justify-content: center; + font-size: 53px; + font-weight: bold; + background: #eee4da; + transition: all 0.15s ease; +} + +.tile.new-tile { + animation: 0.5s appear; +} + +.tile.addition { + animation: 0.3s add; +} + +.tile[data-val] { + color: #f9f6f2; +} + +.tile[data-val="2"], +.tile[data-val="4"] { + color: #776e65; +} + +.tile[data-val="128"], +.tile[data-val="256"], +.tile[data-val="512"] { + font-size: 45px; +} + +.tile[data-val="1024"], +.tile[data-val="2048"] { + font-size: 33px; +} + +.tile[data-val="4"] { + background: #ede0c8; +} + +.tile[data-val="8"] { + background: #f2b179; +} + +.tile[data-val="16"] { + background: #f59563; +} + +.tile[data-val="32"] { + background: #f67c5f; +} + +.tile[data-val="64"] { + background: #f65e3b; +} + +.tile[data-val="128"] { + background: #edcf72; +} + +.tile[data-val="256"] { + background: #edcc61; + box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0.31746), inset 0 0 0 1px rgba(255, 255, 255, 0.19048); +} + +.tile[data-val="512"] { + background: #edc850; + box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0.39683), inset 0 0 0 1px rgba(255, 255, 255, 0.2381); +} + +.tile[data-val="1024"] { + background: #edc53f; + box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0.47619), inset 0 0 0 1px rgba(255, 255, 255, 0.28571); +} + +.tile[data-val="2048"] { + background: #edc22e; + box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0.55556), inset 0 0 0 1px rgba(255, 255, 255, 0.33333); +} + +.pop-container { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + width: 100%; + height: 100%; + background: rgba(238, 228, 218, 0.8); + z-index: 100; + opacity: 0; + transition: all 1s ease; +} + +.winning-container p:nth-child(1){ + transform: rotate(90deg); +} + +.winning-container.action p:nth-child(1){ + transform-origin: center; + animation: winning 1.5s infinite; +} + +.failure-container.action p:nth-child(1){ + transform-origin: center; + animation: failure 5s infinite; +} + +@keyframes winning{ + 0%,25%,50%,75%,100%{ + transform: rotate(90deg) translateX(-5px); + } + 12.5%{ + transform: rotate(80deg); + } + 37.5%{ + transform: rotate(70deg); + } + 62.5%{ + transform: rotate(100deg); + } + 87.5%{ + transform: rotate(120deg); + } +} + +@keyframes failure{ + 0%,25%,50%,75%,100%{ + transform: rotate(90deg) scale(0.7,1) rotateX(40deg); + } + 12.5%{ + transform: rotate(90deg); + } + 37.5%{ + transform: rotate(90deg); + } + 62.5%{ + transform: rotate(90deg); + } + 87.5%{ + transform: rotate(90deg); + } +} + +.pop-container.action { + opacity: 1; +} + +.pop-container p { + font-size: 60px; + font-weight: bold; +} + +.footer { + flex: 1; + padding: 10px 0; + text-align: center; + display: flex; + justify-content: space-around; + align-items: flex-end; + font-size: 0.75rem; + color: #333; + opacity: 0.7; +} \ No newline at end of file diff --git a/2048/favicon.ico b/2048/favicon.ico new file mode 100644 index 00000000..22109e04 Binary files /dev/null and b/2048/favicon.ico differ diff --git a/2048/font/ClearSans-Bold-webfont.woff b/2048/font/ClearSans-Bold-webfont.woff new file mode 100644 index 00000000..184a945d Binary files /dev/null and b/2048/font/ClearSans-Bold-webfont.woff differ diff --git a/2048/font/ClearSans-Regular-webfont.woff b/2048/font/ClearSans-Regular-webfont.woff new file mode 100644 index 00000000..9d58858d Binary files /dev/null and b/2048/font/ClearSans-Regular-webfont.woff differ diff --git a/2048/font/clear-sans.css b/2048/font/clear-sans.css new file mode 100644 index 00000000..de2811db --- /dev/null +++ b/2048/font/clear-sans.css @@ -0,0 +1,30 @@ +@font-face { + font-family: "Clear Sans"; + src: url("ClearSans-Light-webfont.eot"); + src: url("ClearSans-Light-webfont.eot?#iefix") format("embedded-opentype"), + url("ClearSans-Light-webfont.svg#clear_sans_lightregular") format("svg"), + url("ClearSans-Light-webfont.woff") format("woff"); + font-weight: 200; + font-style: normal; +} + +@font-face { + font-family: "Clear Sans"; + src: url("ClearSans-Regular-webfont.eot"); + src: url("ClearSans-Regular-webfont.eot?#iefix") format("embedded-opentype"), + url("ClearSans-Regular-webfont.svg#clear_sansregular") format("svg"), + url("ClearSans-Regular-webfont.woff") format("woff"); + font-weight: normal; + font-style: normal; +} + +@font-face { + font-family: "Clear Sans"; + src: url("ClearSans-Bold-webfont.eot"); + src: url("ClearSans-Bold-webfont.eot?#iefix") format("embedded-opentype"), + url("ClearSans-Bold-webfont.svg#clear_sansbold") format("svg"), + url("ClearSans-Bold-webfont.woff") format("woff"); + font-weight: 700; + font-style: normal; +} + diff --git a/2048/index.html b/2048/index.html new file mode 100644 index 00000000..d8e6919f --- /dev/null +++ b/2048/index.html @@ -0,0 +1,99 @@ + + + + + + + + + + + + 2048 + + + +
+
+

+ 2048 +

+
+
+

SCORE

+

0

+
+ +4 +
+
+
+

BEST

+

66666

+
+
+
+
+ New Game +

+ Play 2048 Game Online +

+

+ Join the numbers and get to the 2048 tile! +

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+

:(

+

FIALURE

+
+
+

:)

+

WINNING

+
+
+ +
+ + + + + + + + + + \ No newline at end of file diff --git a/2048/js/config.js b/2048/js/config.js new file mode 100644 index 00000000..cdfe9910 --- /dev/null +++ b/2048/js/config.js @@ -0,0 +1,4 @@ +var config = { + bonus_point: 4, + max : 2048, +} \ No newline at end of file diff --git a/2048/js/data.js b/2048/js/data.js new file mode 100644 index 00000000..9239c6ae --- /dev/null +++ b/2048/js/data.js @@ -0,0 +1,37 @@ +var data = { + score: 0, + best: 0, + cell: [ + + ] +} +var indexs = [ + // left + [ + [0, 1, 2, 3], + [4, 5, 6, 7], + [8, 9, 10, 11], + [12, 13, 14, 15], + ], + // top + [ + [0, 4, 8, 12], + [1, 5, 9, 13], + [2, 6, 10, 14], + [3, 7, 11, 15], + ], + // right + [ + [3, 2, 1, 0], + [7, 6, 5, 4], + [11, 10, 9, 8], + [15, 14, 13, 12], + ], + // bottom + [ + [12, 8, 4, 0], + [13, 9, 5, 1], + [14, 10, 6, 2], + [15, 11, 7, 3], + ] +] \ No newline at end of file diff --git a/2048/js/event.js b/2048/js/event.js new file mode 100644 index 00000000..e1233497 --- /dev/null +++ b/2048/js/event.js @@ -0,0 +1,46 @@ +function event(game) { + + var down = false; + + var gameContainer = $('.game-container')[0]; + + on(window, 'keydown', function (e) { + if (down) return; + down = true; + var num = e.keyCode - 37; + if (num >= 0 && num <= 3) { + game.move(num); + } + }); + + on(window, 'keyup', function () { + down = false; + }); + + touchMoveDir(gameContainer, 15, function (dir) { + game.move(dir); + }); + + on($('.restart-btn')[0], 'click', function (e) { + e.preventDefault(); + game.restart(); + }); + + on(window, 'resize', function () { + game.view.resize(); + }); + + // 自动测试 + var autoTest = false; + + if (autoTest) { + (function () { + var timer = setInterval(function () { + var moveInfo = game.move(random(0, 3)); + if (!moveInfo) { + clearInterval(timer); + } + }, 20); + })(); + } +} \ No newline at end of file diff --git a/2048/js/game.js b/2048/js/game.js new file mode 100644 index 00000000..ed532029 --- /dev/null +++ b/2048/js/game.js @@ -0,0 +1,313 @@ +var Game = (function () { + + var cell = data.cell; + var over = false; + var move = false; + + var Game = function (view) { + + }; + Game.prototype = { + init: function (view) { + var _this = this; + this.view = view; + var history = this.getHistory(); + if (history) { + this.restoreHistory(history); + } else { + this.initCell(); + this.start(); + } + this.setBest(); + setTimeout(function () { + _this.view.setup(); + }); + }, + start: function () { + for (var i = 0; i < 2; i++) { + this.randomAddItem(); + } + }, + restart: function () { + var _this = this; + over = false; + this.initCell(); + this.view.restart(); + this.start(); + data.score = 0; + this.save(); + setTimeout(function () { + _this.view.setup(); + }); + }, + save: function () { + localStorage.bestScore = data.best; + localStorage.gameState = JSON.stringify({ + cell: data.cell, + socre: data.score, + }); + }, + winning(){ + over = true; + localStorage.gameState = ''; + this.view.winning(); + }, + checkWinning(){ + var isWinning = cell.find(function(el){ + return el.val === config.max + }); + if (isWinning){ + this.winning(); + } + }, + failure: function () { + over = true; + localStorage.gameState = ''; + this.view.failure(); + }, + checkfailure: function () { + var _this = this; + var same = false; + var called = function (arr, str) { + if (same) return; + same = arr.some(function (el) { + return _this.checkSame(el); + }); + }; + called(this.chunkX(), 'x'); + called(this.chunkY(), 'y'); + setTimeout(function () { + if (!same) { + _this.failure(); + } + }); + }, + checkSame: function (arr, index) { + same = arr.some(function (el, index, arr) { + if (index === arr.length - 1) return; + return el.val === arr[index + 1].val; + return true; + }); + return same; + }, + setBest: function () { + var best = getLocalStorage('bestScore'); + data.best = best || 0; + }, + getHistory: function () { + var gameState = getLocalStorage('gameState'); + if (gameState && gameState.socre && gameState.cell) { + return gameState; + } + }, + restoreHistory: function (history) { + data.cell = history.cell; + data.score = history.socre; + cell = data.cell; + this.view.restoreTile(); + }, + initCell: function () { + for (var i = 0; i < 16; i++) { + cell[i] = { + val: 0, + index: i, + }; + } + }, + addScore: function (score) { + data.score += score; + if (data.best < data.score) { + data.best = data.score; + this.view.updateBest(); + } + this.view.updateScore(score); + }, + chunkX: function () { + var new_cell = []; + for (var i = 0; i < cell.length; i += 4) { + new_cell.push(cell.slice(i, i + 4)); + } + return new_cell; + }, + chunkY: function () { + var arr = this.chunkX(); + var new_cell = [ + [], + [], + [], + [] + ]; + for (var i = 0; i < arr.length; i++) { + for (var j = 0; j < arr[i].length; j++) { + new_cell[j][i] = arr[i][j]; + } + } + return new_cell; + }, + arrayInnerReverse: function (arr) { + arr.forEach(function (el, index) { + arr[index] = el.reverse(); + }); + return arr; + }, + updatePos: function (old_index, index) { + cell[index].val = cell[old_index].val; + cell[old_index].val = 0; + move = true; + return old_index; + }, + updateVal: function (index, val) { + var _this = this; + cell[index].val = val; + setTimeout(function () { + _this.view.updateVal(index); + }, 0); + }, + updateItem: function (old_index, index) { + if (cell[old_index] === cell[index]) return; + var old_index = this.updatePos(old_index, index); + this.view.move(old_index, index); + }, + removeItem: function (index) { + cell[index].val = 0; + this.view.remove(index); + }, + getSum: function (obj, i, j) { + return obj[i].val + obj[j].val; + }, + move: function (dir) { + if (over) return; + var _this = this; + var _score = 0; + var _move = false; + var new_cell = []; + if (dir === 0 || dir === 2) { + new_cell = this.chunkX(); + } else if (dir === 1 || dir === 3) { + new_cell = this.chunkY(); + } + if (dir === 2 || dir === 3) { + new_cell = this.arrayInnerReverse(new_cell); + } + new_cell.forEach(function (arr, index) { + var moveInfo = _this.moving(arr, indexs[dir][index]); + _score += moveInfo.score; + }); + this.addScore(_score); + if (move) { + this.randomAddItem(); + _move = true; + move = false; + } + this.save(); + this.checkWinning(); + if (this.isFull()) { + this.checkfailure(); + } + return { + move: _move, + }; + }, + mergeMove: function (_cell, index, num1, num2, num3) { + var sum = this.getSum(_cell, num1, num2); + this.removeItem(_cell[num1].index); + this.updateItem(_cell[num2].index, index[num3]); + this.updateVal(index[num3], sum); + }, + normalMove: function (_cell, index) { + var _this = this; + _cell.forEach(function (el, i) { + _this.updateItem(_cell[i].index, index[i]); + }); + }, + moving: function (arr, index) { + var _this = this; + var _score = 0; + var _cell = arr.filter(function (el) { + return el.val !== 0; + }); + if (_cell.length === 0) { + return { + score: 0, + } + }; + var calls = [ + function () { + _this.normalMove(_cell, index); + }, + function () { + if (_cell[0].val === _cell[1].val) { + _this.mergeMove(_cell, index, 0, 1, 0); + _score += config.bonus_point; + } else { + _this.normalMove(_cell, index); + } + }, + function () { + if (_cell[0].val === _cell[1].val) { + _this.mergeMove(_cell, index, 0, 1, 0); + _this.updateItem(_cell[2].index, index[1]); + _score += config.bonus_point; + } else if (_cell[1].val === _cell[2].val) { + _this.updateItem(_cell[0].index, index[0]); + _this.mergeMove(_cell, index, 1, 2, 1); + _score += config.bonus_point; + } else { + _this.normalMove(_cell, index); + } + }, + function () { + if (_cell[0].val === _cell[1].val) { + _this.mergeMove(_cell, index, 0, 1, 0); + _score += config.bonus_point; + if (_cell[2].val === _cell[3].val) { + _this.mergeMove(_cell, index, 2, 3, 1); + _score += config.bonus_point; + } else { + _this.updateItem(_cell[2].index, index[1]); + _this.updateItem(_cell[3].index, index[2]); + } + } else if (_cell[1].val === _cell[2].val) { + _this.mergeMove(_cell, index, 1, 2, 1); + _this.updateItem(_cell[3].index, index[2]); + _score += config.bonus_point; + } else if (_cell[2].val === _cell[3].val) { + _this.mergeMove(_cell, index, 2, 3, 2); + _score += config.bonus_point; + } + } + ]; + calls[_cell.length - 1](); + return { + score: _score, + }; + }, + isFull: function () { + var full = cell.filter(function (el) { + return el.val === 0; + }); + return full.length === 0; + }, + randomAddItem: function () { + if (this.isFull()) return; + while (true) { + var index = random(0, data.cell.length - 1); + var exist = data.cell[index].val !== 0; + if (!exist) { + this.addItem(index, 2); + break; + } + } + }, + addItem: function (index, val) { + data.cell[index] = { + val: val, + index: index + }; + this.view.appear(index); + } + }; + + return Game; + +})(); \ No newline at end of file diff --git a/2048/js/main.js b/2048/js/main.js new file mode 100644 index 00000000..5f2d145d --- /dev/null +++ b/2048/js/main.js @@ -0,0 +1,6 @@ +on(window, 'load', function () { + var view = new View(); + var game = new Game(); + game.init(view); + event(game); +}); \ No newline at end of file diff --git a/2048/js/utils.js b/2048/js/utils.js new file mode 100644 index 00000000..188d5d2f --- /dev/null +++ b/2048/js/utils.js @@ -0,0 +1,64 @@ +var log = console.log.bind(console); +var random = function (start, end) { + start = start === void 0 ? 0 : start; + end = end === void 0 ? 1 : end; + end = end + 1; + var rand = Math.random() * (end - start) + start; + return Math.floor(rand); +}; +var $ = function (elem) { + return document.querySelectorAll(elem); +} +var on = function (elem, type, callback) { + elem.addEventListener(type, function (e) { + callback(e); + }); +} + +var indexToPos = function (index) { + return { + x: index % 4, + y: Math.floor(index / 4), + } +} + +var getLocalStorage = function (key) { + return localStorage[key] ? + JSON.parse(localStorage[key]) : null; +} + +var touchMoveDir = function (elem, min, callback) { + var touchPos = { + beforeX: 0, + beforeY: 0, + afterX: 0, + afterY: 0, + } + var move = false; + var dir; + on(elem, 'touchstart', function (e) { + touchPos.beforeX = e.touches[0].clientX; + touchPos.beforeY = e.touches[0].clientY; + }); + on(elem, 'touchmove', function (e) { + move = true; + touchPos.afterX = e.touches[0].clientX; + touchPos.afterY = e.touches[0].clientY; + }); + on(elem, 'touchend', function (e) { + if (!move) return; + var x = touchPos.beforeX - touchPos.afterX; + var y = touchPos.beforeY - touchPos.afterY; + log(x, y); + if (Math.abs(x) < min && Math.abs(y) < min) { + return; + } + if (Math.abs(x) > Math.abs(y)) { + dir = x > 0 ? 0 : 2; + } else { + dir = y > 0 ? 1 : 3; + } + move = false; + callback(dir); + }); +}; \ No newline at end of file diff --git a/2048/js/view.js b/2048/js/view.js new file mode 100644 index 00000000..8f1130bd --- /dev/null +++ b/2048/js/view.js @@ -0,0 +1,126 @@ +var View = (function () { + + var tileContainer = $('.tile-container')[0]; + var scoreContainer = $('.score-container')[0]; + var scoreDom = $('.score-container .score')[0]; + var scoreAddition = $('.score-addition')[0]; + var bestDom = $('.best-container .score')[0]; + var failureContainer = $('.failure-container')[0]; + var winningContainer = $('.winning-container')[0]; + + var View = function () { + + }; + + View.prototype = { + setup: function () { + failureContainer.classList.remove('action'); + winningContainer.classList.remove('action'); + this.updateScore(data.score); + this.updateBest(); + }, + restart: function () { + tileContainer.innerHTML = ""; + }, + resize: function () { + var _this = this; + data.cell.forEach(function (el, index) { + var tile = _this.getTile(index); + if (!tile) return; + var pos = _this.getPos(indexToPos(index)); + _this.setPos(tile, pos); + }); + }, + failure: function () { + failureContainer.classList.add('action'); + }, + winning: function () { + winningContainer.classList.add('action'); + }, + restoreTile: function () { + var _this = this; + data.cell.forEach(function (el, index) { + if (el.val !== 0) { + _this.appear(index); + } + }); + }, + addScoreAnimation: function (score) { + if (!score) return; + scoreAddition.innerHTML = '+' + score; + scoreAddition.classList.add('action'); + setTimeout(function () { + scoreAddition.classList.remove('action'); + }, 500); + }, + updateScore: function (score) { + scoreDom.innerHTML = data.score; + this.addScoreAnimation(score); + }, + updateBest: function () { + bestDom.innerHTML = data.best; + }, + setInfo: function (elem, pos, index) { + elem.style.left = pos.left + 'px'; + elem.style.top = pos.top + 'px'; + elem.setAttribute('data-index', index); + }, + getTile: function (index) { + return $(`.tile[data-index='${index}']`)[0]; + }, + getPos: function (pos) { + var gridCell = $(`.grid-row:nth-child(${pos.y+1}) .grid-cell:nth-child(${pos.x+1})`)[0]; + return { + left: gridCell.offsetLeft, + top: gridCell.offsetTop, + } + }, + setPos: function (elem, pos) { + elem.style.left = pos.left + 'px'; + elem.style.top = pos.top + 'px'; + }, + createTileHTML: function (obj) { + var tile = document.createElement('div'); + tile.className = obj.classNames; + tile.innerHTML = obj.val; + tile.setAttribute('data-index', obj.index); + tile.setAttribute('data-val', obj.val); + this.setPos(tile, obj.pos); + return tile; + }, + appear: function (index) { + var last = data.cell[index]; + var pos = this.getPos(indexToPos(index)); + var newTile = this.createTileHTML({ + val: last.val, + pos: pos, + index: index, + classNames: " tile new-tile", + }); + tileContainer.appendChild(newTile); + }, + remove: function (index) { + var tile = this.getTile(index); + tile.parentElement.removeChild(tile); + }, + move: function (old_index, index) { + var tile = this.getTile(old_index); + var pos = this.getPos(indexToPos(index)); + this.setInfo(tile, pos, index); + }, + updateVal: function (index) { + var tile = this.getTile(index); + var val = data.cell[index].val; + tile.setAttribute('data-val', val); + tile.innerHTML = val; + tile.classList.add('addition'); + setTimeout(function () { + tile.classList.remove('addition'); + tile.classList.remove('new-tile'); + }, 300); + }, + } + + return View; + +})(); \ No newline at end of file diff --git a/4sum.java b/4sum.java new file mode 100644 index 00000000..a1047d56 --- /dev/null +++ b/4sum.java @@ -0,0 +1,30 @@ +class Solution { + public List> fourSum(int[] nums, int target) { + Arrays.sort(nums); + Set> s = new HashSet<>(); + List> output = new ArrayList<>(); + for (int i = 0; i < nums.length; i++) { + for (int j = i + 1; j < nums.length; j++) { + int k = j + 1; + int l = nums.length - 1; + while (k < l) { + long sum = nums[i]; + sum += nums[j]; + sum += nums[k]; + sum += nums[l]; + if (sum == target) { + s.add(Arrays.asList(nums[i], nums[j], nums[k], nums[l])); + k++; + l--; + } else if (sum < target) { + k++; + } else { + l--; + } + } + } + } + output.addAll(s); + return output; + } +} diff --git a/AI Riddle Game/RiddleGame.java b/AI Riddle Game/RiddleGame.java new file mode 100644 index 00000000..0e03fe73 --- /dev/null +++ b/AI Riddle Game/RiddleGame.java @@ -0,0 +1,66 @@ +import java.util.Scanner; + +public class RiddleGame { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + int score = 0; + + // Define an array of riddles and their corresponding answers. + String[] riddles = { + "I speak without a mouth and hear without ears. I have no body, but I come alive with the wind. What am I?", + "The more you take, the more you leave behind. What am I?", + "I'm not alive, but I can grow; I don't have lungs, but I need air; I don't have a mouth, but water kills me. What am I?" + }; + + String[] answers = { + "An echo", + "Footsteps", + "A fire" + }; + + // Define hints for each riddle. + String[] hints = { + "Hint: This thing is known for its ability to reflect sound.", + "Hint: Think about what you leave behind when you walk.", + "Hint: It produces heat and light." + }; + + int numRiddles = riddles.length; + + while (true) { + int randomIndex = (int) (Math.random() * numRiddles); + String selectedRiddle = riddles[randomIndex]; + String correctAnswer = answers[randomIndex]; + String hint = hints[randomIndex]; + + // Display the riddle to the user. + System.out.println("Riddle: " + selectedRiddle); + + // Get user's answer. + String userAnswer = scanner.nextLine(); + + if (userAnswer.equalsIgnoreCase(correctAnswer)) { + System.out.println("Correct!"); + score++; + } else { + // If the answer is incorrect, offer a hint. + System.out.println("Wrong! Would you like a hint? (yes/no)"); + String giveHint = scanner.nextLine().toLowerCase(); + if (giveHint.equals("yes")) { + System.out.println(hint); + } + } + + // Allow the user to continue or exit. + System.out.println("Continue playing? (yes/no)"); + String playAgain = scanner.nextLine().toLowerCase(); + if (!playAgain.equals("yes")) { + break; + } + } + + // Display final score. + System.out.println("Your final score: " + score); + System.out.println("Thanks for playing!"); + } +} diff --git a/ASCII value b/ASCII value new file mode 100644 index 00000000..73c0778e --- /dev/null +++ b/ASCII value @@ -0,0 +1,14 @@ +public class PrintAsciiValueExample1 +{ +public static void main(String[] args) +{ +// character whose ASCII value to be found +char ch1 = 'a'; +char ch2 = 'b'; +// variable that stores the integer value of the character +int asciivalue1 = ch1; +int asciivalue2 = ch2; +System.out.println("The ASCII value of " + ch1 + " is: " + asciivalue1); +System.out.println("The ASCII value of " + ch2 + " is: " + asciivalue2); +} +} diff --git a/ATM interface/README.md b/ATM interface/README.md new file mode 100644 index 00000000..e7caef61 --- /dev/null +++ b/ATM interface/README.md @@ -0,0 +1,3 @@ +# ATM interface program using Java + +A Java program can be written to simulate ATM transactions. The user must choose an option from the possibilities shown on the screen. The choices include those to withdraw money, deposit money, check your balance, and leave. diff --git a/ATM interface/atm.class b/ATM interface/atm.class new file mode 100644 index 00000000..28e450d3 Binary files /dev/null and b/ATM interface/atm.class differ diff --git a/ATM interface/atm.java b/ATM interface/atm.java new file mode 100644 index 00000000..2a327d94 --- /dev/null +++ b/ATM interface/atm.java @@ -0,0 +1,89 @@ +//import required classes and packages +import java.util.Scanner; + +//create ATMExample class to implement the ATM functionality +public class atm +{ + public static boolean validateInputAmount(Integer amount) + { + return amount>0; + } + //main method starts + public static void main(String args[] ) + { + //declare and initialize balance, withdraw, and deposit + int balance = 100000, withdraw, deposit; + + //create scanner class object to get choice of user + Scanner sc = new Scanner(System.in); + + while(true) + { + System.out.println("Automated Teller Machine"); + System.out.println("Choose 1 for Withdraw"); + System.out.println("Choose 2 for Deposit"); + System.out.println("Choose 3 for Check Balance"); + System.out.println("Choose 4 for EXIT"); + System.out.print("Choose the operation you want to perform:"); + + //get choice from user + int choice = sc.nextInt(); + switch(choice) + { + case 1: + System.out.print("Enter money to be withdrawn:"); + + //get the withdrawl money from user + withdraw = sc.nextInt(); + if(!validateInputAmount(withdraw)) + { + System.out.println("Enter amount greater than zero"); + break; + } + + //check whether the balance is greater than or equal to the withdrawal amount + if(balance >= withdraw) + { + //remove the withdrawl amount from the total balance + balance = balance - withdraw; + System.out.println("Please collect your money"); + } + else + { + //show custom error message + System.out.println("Insufficient Balance"); + } + System.out.println(""); + break; + + case 2: + + System.out.print("Enter money to be deposited:"); + + //get deposite amount from te user + deposit = sc.nextInt(); + if(!validateInputAmount(deposit)) + { + System.out.println("Enter amount greater than zero"); + break; + } + + //add the deposit amount to the total balanace + balance = balance + deposit; + System.out.println("Your Money has been successfully depsited"); + System.out.println(""); + break; + + case 3: + //displaying the total balance of the user + System.out.println("Balance : "+balance); + System.out.println(""); + break; + + case 4: + //exit from the menu + System.exit(0); + } + } + } +} diff --git a/ATM/ATM.java b/ATM/ATM.java new file mode 100644 index 00000000..fdffd1ca --- /dev/null +++ b/ATM/ATM.java @@ -0,0 +1,7 @@ + +public class ATM extends OptionMenu { + public static void main(String[] args) { + OptionMenu options = new OptionMenu(); + options.getLogin(); + } +} \ No newline at end of file diff --git a/ATM/Account.java b/ATM/Account.java new file mode 100644 index 00000000..04f5dd0e --- /dev/null +++ b/ATM/Account.java @@ -0,0 +1,110 @@ +import java.text.DecimalFormat; +import java.util.Scanner; + +public class Account { + + private int customerNumber; + private int pinNumber; + private double checkingBalance = 0; + private double savingBalance = 0; + + Scanner input = new Scanner(System.in); + DecimalFormat moneyFormat = new DecimalFormat("'$'###,##0.00"); + + public void setCustomerNumber(int customerNumber){ + this.customerNumber = customerNumber; + } + + public int getCustomerNumber(){ + return customerNumber; + } + + public void setPinNumber(int pinNumber){ + this.pinNumber = pinNumber; + } + + public int getPinNumber(){ + return pinNumber; + } + + public double getCheckingBalance() { + return checkingBalance; + } + + public double getSavingBalance(){ + return savingBalance; + } + + public void calcCheckingWithdraw(double amount){ + checkingBalance = (checkingBalance - amount); + } + + public void calcSavingWithdraw(double amount){ + savingBalance = (savingBalance - amount); + } + + public void calcCheckingDeposit(double amount){ + checkingBalance = (checkingBalance + amount); + } + + public void calcSavingDeposit(double amount){ + savingBalance = (savingBalance + amount); + } + + public void getCheckingWithdrawInput() { + System.out.println("Checking Account balance: " + moneyFormat.format(checkingBalance)); + System.out.print("Amount you want to withdraw from Checking Account: "); + double amount = input.nextDouble(); + + if(checkingBalance - amount >= 0){ + calcCheckingWithdraw(amount); + System.out.println("New Checking Account Balance: " + moneyFormat.format(checkingBalance)); + } + else{ + System.out.println("Not Enough Money to Withdraw"); + } + } + + public void getSavingWithdrawInput() { + System.out.println("Saving Account balance: " + moneyFormat.format(savingBalance)); + System.out.print("Amount you want to withdraw from Saving Account: "); + double amount = input.nextDouble(); + + if(savingBalance - amount >= 0){ + calcSavingWithdraw(amount); + System.out.println("New Saving Account Balance: " + moneyFormat.format(savingBalance)); + } + else{ + System.out.println("Not Enough Money to Withdraw"); + } + } + + public void getCheckingDepositInput(){ + System.out.println("Checking Account Balance: " + moneyFormat.format(checkingBalance)); + System.out.print("Amount you want to deposit to Checking Account: "); + double amount = input.nextDouble(); + + if(checkingBalance + amount >= 0){ + calcCheckingDeposit(amount); + System.out.println("New Checking Account Balance: " + moneyFormat.format(checkingBalance)); + } + else{ + System.out.println("No Money to Deposit"); + } + } + + public void getSavingDepositInput(){ + System.out.println("Saving Account Balance: " + moneyFormat.format(savingBalance)); + System.out.print("Amount you want to deposit to Saving Account: "); + double amount = input.nextDouble(); + + if(checkingBalance + amount >= 0){ + calcSavingDeposit(amount); + System.out.println("New Saving Account Balance: " + moneyFormat.format(savingBalance)); + } + else{ + System.out.println("No Money to Deposit"); + } + } + +} diff --git a/ATM/OptionMenu.java b/ATM/OptionMenu.java new file mode 100644 index 00000000..5658dda9 --- /dev/null +++ b/ATM/OptionMenu.java @@ -0,0 +1,118 @@ +import java.text.DecimalFormat; +import java.util.HashMap; +import java.util.Scanner; + +public class OptionMenu extends Account { + + Scanner menuInput = new Scanner(System.in); + DecimalFormat moneyFormat = new DecimalFormat("'$'###,##0.00"); + + HashMap data = new HashMap<>(); + + public void getLogin() { + int x = 1; + do{ + try{ + data.put(952141, 191904); + data.put(989947, 717976); + + System.out.println("Welcome to ATM"); + System.out.println("Enter your Customer Number"); + setCustomerNumber(menuInput.nextInt()); + + System.out.println("Enter your PIN Number"); + setPinNumber(menuInput.nextInt()); + } + catch(Exception e){ + System.out.println("\nInvalid Characters Only Numbers Allowed\n" + e); + x = 2; + } + + int cn = getCustomerNumber(); + int pn = getPinNumber(); + if(data.containsKey(cn) && data.get(cn) == pn){ + getAccountType(); + } + else{ + System.out.println("\nWrong Customer Number or Wrong PIN Number\n\n"); + } + }while(x == 1); + } + + public void getAccountType() { + System.out.println("Select Account Type you want to Access"); + System.out.println("Type 1 - Checking Account"); + System.out.println("Type 2 - Savings Account"); + System.out.println("Type 3 - Exit"); + + int selection = menuInput.nextInt(); + + switch (selection) { + case 1 -> getChecking(); + case 2 -> getSaving(); + case 3 -> System.out.println("Thank you for using ATM, BYE\n"); + default -> System.out.println("\n Invalid Choice \n"); + } + } + + public void getChecking() { + System.out.println("Checking Account"); + System.out.println("Type 1 - View Balance"); + System.out.println("Type 2 - Withdraw Money"); + System.out.println("Type 3 - Deposit Funds"); + System.out.println("Type 4 - Exit"); + + int selection = menuInput.nextInt(); + + switch (selection) { + case 1 -> { + System.out.println("Checking Account Balance: " + moneyFormat.format(getCheckingBalance())); + getAccountType(); + } + case 2 -> { + getCheckingWithdrawInput(); + getAccountType(); + } + case 3 -> { + getCheckingDepositInput(); + getAccountType(); + } + case 4 -> System.out.println("Thank you for using ATM, Bye"); + default -> { + System.out.println("\nInvalid Choice\n"); + getChecking(); + } + } + } + + public void getSaving() { + System.out.println("Saving Account"); + System.out.println("Type 1 - View Balance"); + System.out.println("Type 2 - Withdraw Money"); + System.out.println("Type 3 - Deposit Funds"); + System.out.println("Type 4 - Exit"); + System.out.print("Choice: "); + + int selection = menuInput.nextInt(); + + switch (selection) { + case 1 -> { + System.out.println("Saving Account Balance: " + moneyFormat.format(getSavingBalance())); + getAccountType(); + } + case 2 -> { + getSavingWithdrawInput(); + getAccountType(); + } + case 3 -> { + getSavingDepositInput(); + getAccountType(); + } + case 4 -> System.out.println("Thank you for using ATM, Bye\n"); + default -> { + System.out.println("\nInvalid Choice\n"); + getChecking(); + } + } + } +} \ No newline at end of file diff --git a/Add Your Code Hs/CI.js b/Add Your Code Hs/CI.js new file mode 100644 index 00000000..7c8bfc2b --- /dev/null +++ b/Add Your Code Hs/CI.js @@ -0,0 +1,16 @@ +function calculateCompoundInterest() { + // Get input values + var principal = parseFloat(document.getElementById("principal").value); + var annualRate = parseFloat(document.getElementById("annualRate").value); + var compoundingFrequency = parseInt(document.getElementById("compoundingFrequency").value); + var years = parseInt(document.getElementById("years").value); + + // Calculate compound interest + var amount = principal * Math.pow(1 + (annualRate / compoundingFrequency), compoundingFrequency * years); + + // Round the result to two decimal places + amount = Math.round(amount * 100) / 100; + + // Display the result + document.getElementById("result").innerHTML = "The final amount after " + years + " years is: $" + amount; +} diff --git a/Add Your Code Hs/Percentage.js b/Add Your Code Hs/Percentage.js new file mode 100644 index 00000000..8c2528a5 --- /dev/null +++ b/Add Your Code Hs/Percentage.js @@ -0,0 +1,11 @@ +function calculatePercentage() { + // Get input values + var number = parseFloat(document.getElementById("number").value); + var percentage = parseFloat(document.getElementById("percentage").value); + + // Calculate the result + var result = (number * percentage) / 100; + + // Display the result + document.getElementById("result").innerHTML = percentage + "% of " + number + " is " + result; +} diff --git a/Add Your Code Hs/SI.html b/Add Your Code Hs/SI.html new file mode 100644 index 00000000..f62b343c --- /dev/null +++ b/Add Your Code Hs/SI.html @@ -0,0 +1,38 @@ + + + + Simple Interest Calculator + + + +

Simple Interest Calculator

+

Enter the following details to calculate simple interest:

+
+ +

+ + +

+ + +

+ + +
+ +

+ + diff --git a/Add Your Code Hs/html b/Add Your Code Hs/html new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/Add Your Code Hs/html @@ -0,0 +1 @@ + diff --git a/Added CGPA Calculator in Java b/Added CGPA Calculator in Java new file mode 100644 index 00000000..2f4f156a --- /dev/null +++ b/Added CGPA Calculator in Java @@ -0,0 +1,47 @@ +import java.util.Scanner; + +class CGPACalculator { + private double[] marks; + + public CGPACalculator(double[] marks) { + this.marks = marks; + } + + public double calculateCGPA() { + double totalGradePoints = 0.0; + for (double mark : marks) { + double grade = mark / 10.0; + totalGradePoints += grade; + } + return totalGradePoints / marks.length; + } + + public double calculatePercentage() { + double cgpa = calculateCGPA(); + return cgpa * 9.5; + } +} + +public class CGPA { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + + System.out.println("Enter the number of subjects:"); + int n = sc.nextInt(); + + double[] marks = new double[n]; + + System.out.println("Enter marks:"); + for (int i = 0; i < n; i++) { + marks[i] = sc.nextDouble(); + } + + CGPACalculator calculator = new CGPACalculator(marks); + + double cgpa = calculator.calculateCGPA(); + System.out.println("CGPA: " + cgpa); + + double percentage = calculator.calculatePercentage(); + System.out.println("Percentage from CGPA: " + percentage); + } +} diff --git a/Added Text Editor in Java b/Added Text Editor in Java new file mode 100644 index 00000000..e53f1194 --- /dev/null +++ b/Added Text Editor in Java @@ -0,0 +1,100 @@ +import javafx.application.Application; +import javafx.stage.Stage; +import javafx.scene.Scene; +import javafx.scene.control.*; +import javafx.scene.layout.BorderPane; +import java.io.*; +import java.util.Scanner; + +public class JavaFXTextEditor extends Application { + private TextArea textArea; + private File currentFile; + + public static void main(String[] args) { + launch(args); + } + + @Override + public void start(Stage primaryStage) { + primaryStage.setTitle("JavaFX Text Editor"); + + textArea = new TextArea(); + textArea.setWrapText(true); + + MenuBar menuBar = createMenuBar(); + + BorderPane layout = new BorderPane(); + layout.setTop(menuBar); + layout.setCenter(textArea); + + Scene scene = new Scene(layout, 800, 600); + primaryStage.setScene(scene); + primaryStage.show(); + } + + private MenuBar createMenuBar() { + MenuBar menuBar = new MenuBar(); + + // File menu + Menu fileMenu = new Menu("File"); + MenuItem newFile = new MenuItem("New"); + MenuItem openFile = new MenuItem("Open"); + MenuItem saveFile = new MenuItem("Save"); + MenuItem exit = new MenuItem("Exit"); + + newFile.setOnAction(e -> newFile()); + openFile.setOnAction(e -> openFile()); + saveFile.setOnAction(e -> saveFile()); + exit.setOnAction(e -> System.exit(0)); + + fileMenu.getItems().addAll(newFile, openFile, saveFile, new SeparatorMenuItem(), exit); + + menuBar.getMenus().add(fileMenu); + + return menuBar; + } + + private void newFile() { + textArea.clear(); + currentFile = null; + } + + private void openFile() { + FileChooser fileChooser = new FileChooser(); + fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("Text Files", "*.txt")); + File selectedFile = fileChooser.showOpenDialog(null); + + if (selectedFile != null) { + currentFile = selectedFile; + try { + Scanner scanner = new Scanner(selectedFile); + StringBuilder content = new StringBuilder(); + while (scanner.hasNext()) { + content.append(scanner.nextLine()).append("\n"); + } + textArea.setText(content.toString()); + scanner.close(); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + } + } + + private void saveFile() { + if (currentFile == null) { + FileChooser fileChooser = new FileChooser(); + fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("Text Files", "*.txt")); + currentFile = fileChooser.showSaveDialog(null); + } + + if (currentFile != null) { + try { + FileWriter writer = new FileWriter(currentFile); + writer.write(textArea.getText()); + writer.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } +} diff --git a/AddressBook.py b/AddressBook.py new file mode 100644 index 00000000..b7c8ff63 --- /dev/null +++ b/AddressBook.py @@ -0,0 +1,124 @@ +import pickle +import os.path +from tkinter import * # Import tkinter +import tkinter.messagebox + +class Address: + def __init__(self, name, street, city, state, zip): + self.name = name + self.street = street + self.city = city + self.state = state + self.zip = zip + +class AddressBook: + def __init__(self): + window = Tk() # Create a window + window.title("AddressBook") # Set title + + self.nameVar = StringVar() + self.streetVar = StringVar() + self.cityVar = StringVar() + self.stateVar = StringVar() + self.zipVar = StringVar() + + frame1 = Frame(window) + frame1.pack() + Label(frame1, text = "Name").grid(row = 1, + column = 1, sticky = W) + Entry(frame1, textvariable = self.nameVar, + width = 40).grid(row = 1, column = 2) + + frame2 = Frame(window) + frame2.pack() + Label(frame2, text = "Street").grid(row = 1, + column = 1, sticky = W) + Entry(frame2, textvariable = self.streetVar, + width = 40).grid(row = 1, column = 2) + + frame3 = Frame(window) + frame3.pack() + Label(frame3, text = "City", width = 5).grid(row = 1, + column = 1, sticky = W) + Entry(frame3, + textvariable = self.cityVar).grid(row = 1, column = 2) + Label(frame3, text = "State").grid(row = 1, + column = 3, sticky = W) + Entry(frame3, textvariable = self.stateVar, + width = 5).grid(row = 1, column = 4) + Label(frame3, text = "ZIP").grid(row = 1, + column = 5, sticky = W) + Entry(frame3, textvariable = self.zipVar, + width = 5).grid(row = 1, column = 6) + + frame4 = Frame(window) + frame4.pack() + Button(frame4, text = "Add", + command = self.processAdd).grid(row = 1, column = 1) + btFirst = Button(frame4, text = "First", + command = self.processFirst).grid(row = 1, column = 2) + btNext = Button(frame4, text = "Next", + command = self.processNext).grid(row = 1, column = 3) + btPrevious = Button(frame4, text = "Previous", command = + self.processPrevious).grid(row = 1, column = 4) + btLast = Button(frame4, text = "Last", + command = self.processLast).grid(row = 1, column = 5) + + self.addressList = self.loadAddress() + self.current = 0 + + if len(self.addressList) > 0: + self.setAddress() + + window.mainloop() # Create an event loop + + def saveAddress(self): + outfile = open("address.dat", "wb") + pickle.dump(self.addressList, outfile) + tkinter.messagebox.showinfo( + "Address saved", "A new address is saved") + outfile.close() + + def loadAddress(self): + if not os.path.isfile("address.dat"): + return [] # Return an empty list + + try: + infile = open("address.dat", "rb") + addressList = pickle.load(infile) + except EOFError: + addressList = [] + + infile.close() + return addressList + + def processAdd(self): + address = Address(self.nameVar.get(), + self.streetVar.get(), self.cityVar.get(), + self.stateVar.get(), self.zipVar.get()) + self.addressList.append(address) + self.saveAddress() + + def processFirst(self): + self.current = 0 + self.setAddress() + + def processNext(self): + if self.current < len(self.addressList) - 1: + self.current += 1 + self.setAddress() + + def processPrevious(self): + pass # Left as exercise + + def processLast(self): + pass # Left as exercise + + def setAddress(self): + self.nameVar.set(self.addressList[self.current].name) + self.streetVar.set(self.addressList[self.current].street) + self.cityVar.set(self.addressList[self.current].city) + self.stateVar.set(self.addressList[self.current].state) + self.zipVar.set(self.addressList[self.current].zip) + +AddressBook() # Create GUI diff --git a/Admission-counselling-system/.classpath b/Admission-counselling-system/.classpath new file mode 100644 index 00000000..d6d450f0 --- /dev/null +++ b/Admission-counselling-system/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/Admission-counselling-system/.gitignore b/Admission-counselling-system/.gitignore new file mode 100644 index 00000000..68fa45d9 --- /dev/null +++ b/Admission-counselling-system/.gitignore @@ -0,0 +1,2 @@ +/nbproject/private/ +/build/ \ No newline at end of file diff --git a/Admission-counselling-system/.project b/Admission-counselling-system/.project new file mode 100644 index 00000000..ccda3b5f --- /dev/null +++ b/Admission-counselling-system/.project @@ -0,0 +1,17 @@ + + + Admission + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/Admission-counselling-system/Choices.png b/Admission-counselling-system/Choices.png new file mode 100644 index 00000000..d59c6a1d Binary files /dev/null and b/Admission-counselling-system/Choices.png differ diff --git a/Admission-counselling-system/My Choice.png b/Admission-counselling-system/My Choice.png new file mode 100644 index 00000000..ea124690 Binary files /dev/null and b/Admission-counselling-system/My Choice.png differ diff --git a/Admission-counselling-system/README.md b/Admission-counselling-system/README.md new file mode 100644 index 00000000..c5b6f111 --- /dev/null +++ b/Admission-counselling-system/README.md @@ -0,0 +1,5 @@ +# Online-Admission-Counselling +This is an addmission counselling system Java Swing. +To run this project u need to install Netbeans with (java 1.8 ) recommended . +Just Clone / Download And run +This Project uses File System as database. diff --git a/Admission-counselling-system/build.xml b/Admission-counselling-system/build.xml new file mode 100644 index 00000000..b040e3d0 --- /dev/null +++ b/Admission-counselling-system/build.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + Builds, tests, and runs the project Admission. + + + diff --git a/Admission-counselling-system/choices.txt b/Admission-counselling-system/choices.txt new file mode 100644 index 00000000..fbf3185a --- /dev/null +++ b/Admission-counselling-system/choices.txt @@ -0,0 +1,16 @@ +5 Choice-1: BENNETT Choice-2: SNU Choice-3: SRM Choice-4: GNIOT Choice-5: AMITY Branch-Choice-1: COMPUTER_SCIENCE Branch-Choice-2: BIOTECH Branch-Choice-3: ECE Branch-Choice-4: MECHANICAL Branch-Choice-5: ECE +2 Choice-1: BENNETT Choice-2: SRM Choice-3: SNU Choice-4: GNIOT Choice-5: AMITY Branch-Choice-1: BIOTECH Branch-Choice-2: CIVIL Branch-Choice-3: MECHANICAL Branch-Choice-4: ECE Branch-Choice-5: COMPUTER_SCIENCE + +2 Choice-1: BENNETT Choice-2: SNU Choice-3: AMITY Choice-4: SRM Choice-5: GNIOT Branch-Choice-1: CIVIL Branch-Choice-2: BIOTECH Branch-Choice-3: MECHANICAL Branch-Choice-4: ECE Branch-Choice-5: COMPUTER_SCIENCE + +3 Choice-1: GNIOT Choice-2: SRM Choice-3: GNIOT Choice-4: BENNETT Choice-5: SNU Branch-Choice-1: MECHANICAL Branch-Choice-2: ECE Branch-Choice-3: CIVIL Branch-Choice-4: MECHANICAL Branch-Choice-5: ECE + +3 Choice-1: SRM Choice-2: GNIOT Choice-3: SRM Choice-4: SNU Choice-5: AMITY Branch-Choice-1: COMPUTER_SCIENCE Branch-Choice-2: MECHANICAL Branch-Choice-3: BIOTECH Branch-Choice-4: CIVIL Branch-Choice-5: BIOTECH + +2 Choice-1: GNIOT Choice-2: SRM Choice-3: SNU Choice-4: BENNETT Choice-5: SRM Branch-Choice-1: COMPUTER_SCIENCE Branch-Choice-2: MECHANICAL Branch-Choice-3: ECE Branch-Choice-4: MECHANICAL Branch-Choice-5: CIVIL + +2 Choice-1: BENNETT Choice-2: GNIOT Choice-3: AMITY Choice-4: SRM Choice-5: AMITY Branch-Choice-1: ECE Branch-Choice-2: MECHANICAL Branch-Choice-3: COMPUTER_SCIENCE Branch-Choice-4: BIOTECH Branch-Choice-5: CIVIL + +2 Choice-1: AMITY Choice-2: GNIOT Choice-3: BENNETT Choice-4: SNU Choice-5: SRM Branch-Choice-1: COMPUTER_SCIENCE Branch-Choice-2: MECHANICAL Branch-Choice-3: ECE Branch-Choice-4: MECHANICAL Branch-Choice-5: BIOTECH + +101 Choice-1: AMITY Choice-2: SNU Choice-3: AMITY Choice-4: SNU Choice-5: SRM Branch-Choice-1: ECE Branch-Choice-2: COMPUTER_SCIENCE Branch-Choice-3: BIOTECH Branch-Choice-4: ECE Branch-Choice-5: CIVIL diff --git a/Admission-counselling-system/dist/Admission.jar b/Admission-counselling-system/dist/Admission.jar new file mode 100644 index 00000000..086407b4 Binary files /dev/null and b/Admission-counselling-system/dist/Admission.jar differ diff --git a/Admission-counselling-system/dist/README.TXT b/Admission-counselling-system/dist/README.TXT new file mode 100644 index 00000000..a7d1532c --- /dev/null +++ b/Admission-counselling-system/dist/README.TXT @@ -0,0 +1,32 @@ +======================== +BUILD OUTPUT DESCRIPTION +======================== + +When you build an Java application project that has a main class, the IDE +automatically copies all of the JAR +files on the projects classpath to your projects dist/lib folder. The IDE +also adds each of the JAR files to the Class-Path element in the application +JAR files manifest file (MANIFEST.MF). + +To run the project from the command line, go to the dist folder and +type the following: + +java -jar "Admission.jar" + +To distribute this project, zip up the dist folder (including the lib folder) +and distribute the ZIP file. + +Notes: + +* If two JAR files on the project classpath have the same name, only the first +JAR file is copied to the lib folder. +* Only JAR files are copied to the lib folder. +If the classpath contains other types of files or folders, these files (folders) +are not copied. +* If a library on the projects classpath also has a Class-Path element +specified in the manifest,the content of the Class-Path element has to be on +the projects runtime path. +* To set a main class in a standard Java project, right-click the project node +in the Projects window and choose Properties. Then click Run and enter the +class name in the Main Class field. Alternatively, you can manually type the +class name in the manifest Main-Class element. diff --git a/Admission-counselling-system/dist/lib/AbsoluteLayout.jar b/Admission-counselling-system/dist/lib/AbsoluteLayout.jar new file mode 100644 index 00000000..f5b265cf Binary files /dev/null and b/Admission-counselling-system/dist/lib/AbsoluteLayout.jar differ diff --git a/Admission-counselling-system/dist/lib/rs2xml.jar b/Admission-counselling-system/dist/lib/rs2xml.jar new file mode 100644 index 00000000..75d9c622 Binary files /dev/null and b/Admission-counselling-system/dist/lib/rs2xml.jar differ diff --git a/Admission-counselling-system/dist/lib/sqlitejdbc-v056.jar b/Admission-counselling-system/dist/lib/sqlitejdbc-v056.jar new file mode 100644 index 00000000..f95d90eb Binary files /dev/null and b/Admission-counselling-system/dist/lib/sqlitejdbc-v056.jar differ diff --git a/Admission-counselling-system/f.png b/Admission-counselling-system/f.png new file mode 100644 index 00000000..a27fc08b Binary files /dev/null and b/Admission-counselling-system/f.png differ diff --git a/Admission-counselling-system/manifest.mf b/Admission-counselling-system/manifest.mf new file mode 100644 index 00000000..328e8e5b --- /dev/null +++ b/Admission-counselling-system/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +X-COMMENT: Main-Class will be added automatically by build + diff --git a/Admission-counselling-system/nbproject/build-impl.xml b/Admission-counselling-system/nbproject/build-impl.xml new file mode 100644 index 00000000..d0167b0d --- /dev/null +++ b/Admission-counselling-system/nbproject/build-impl.xml @@ -0,0 +1,1420 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + Must select one file in the IDE or set profile.class + This target only works when run from inside the NetBeans IDE. + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + Must select some files in the IDE or set test.includes + + + + + Must select one file in the IDE or set run.class + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Admission-counselling-system/nbproject/genfiles.properties b/Admission-counselling-system/nbproject/genfiles.properties new file mode 100644 index 00000000..70cc4d01 --- /dev/null +++ b/Admission-counselling-system/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=3fa495eb +build.xml.script.CRC32=6c4ba5e8 +build.xml.stylesheet.CRC32=8064a381@1.80.1.48 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=3fa495eb +nbproject/build-impl.xml.script.CRC32=f737ad99 +nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 diff --git a/Admission-counselling-system/nbproject/project.properties b/Admission-counselling-system/nbproject/project.properties new file mode 100644 index 00000000..8d59df2e --- /dev/null +++ b/Admission-counselling-system/nbproject/project.properties @@ -0,0 +1,81 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=false +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +application.title=Admission +application.vendor=Hyrex +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# Files in build.classes.dir which should be excluded from distribution jar +dist.archive.excludes= +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/Admission.jar +dist.javadoc.dir=${dist.dir}/javadoc +endorsed.classpath= +excludes= +file.reference.rs2xml.jar=rs2xml.jar +file.reference.sqlitejdbc-v056.jar=sqlitejdbc-v056.jar +includes=** +jar.compress=false +javac.classpath=\ + ${file.reference.sqlitejdbc-v056.jar}:\ + ${file.reference.rs2xml.jar}:\ + ${libs.absolutelayout.classpath} +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.external.vm=true +javac.processorpath=\ + ${javac.classpath} +javac.source=1.8 +javac.target=1.8 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +main.class=student.information.system.Login +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=false +platform.active=default_platform +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project. +# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. +# To set system properties for unit tests define test-sys-prop.name=value: +run.jvmargs= +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +source.encoding=UTF-8 +src.dir=src +test.src.dir=test diff --git a/Admission-counselling-system/nbproject/project.xml b/Admission-counselling-system/nbproject/project.xml new file mode 100644 index 00000000..480d9208 --- /dev/null +++ b/Admission-counselling-system/nbproject/project.xml @@ -0,0 +1,15 @@ + + + org.netbeans.modules.java.j2seproject + + + Admission + + + + + + + + + diff --git a/Admission-counselling-system/output.txt b/Admission-counselling-system/output.txt new file mode 100644 index 00000000..171d369f --- /dev/null +++ b/Admission-counselling-system/output.txt @@ -0,0 +1,5 @@ +xkvn gndlh 22/1/1998 1 poadpiofs@gmail.com 98981100123 dasdg;m; csdondfohnfgo 65 2016001 +Pawan gndlh 22/1/1998 2 poadpiofs@gmail.com 98981100123 dasdg;m; csdondfohnfgo 70 2016001 +Saksham gndlh 22/1/1998 3 poadpiofs@gmail.com 98981100123 dasdg;m; csdondfohnfgo 80 2016001 +Chandra basaa 14/09/98 5 basaaa@gmail.com 321455698 s13,gdfl hsgdgau 98 201310 +yugesh verma 22/1/1996 101 yugesh@gmail.com 6263056779 da sdg;m; csdondfohnfgo zwenlfnsf,,vs 2016001 \ No newline at end of file diff --git a/Admission-counselling-system/rs2xml.jar b/Admission-counselling-system/rs2xml.jar new file mode 100644 index 00000000..75d9c622 Binary files /dev/null and b/Admission-counselling-system/rs2xml.jar differ diff --git a/Admission-counselling-system/sqlitejdbc-v056.jar b/Admission-counselling-system/sqlitejdbc-v056.jar new file mode 100644 index 00000000..f95d90eb Binary files /dev/null and b/Admission-counselling-system/sqlitejdbc-v056.jar differ diff --git a/Admission-counselling-system/src/student/information/system/Audit_details.form b/Admission-counselling-system/src/student/information/system/Audit_details.form new file mode 100644 index 00000000..e756c91c --- /dev/null +++ b/Admission-counselling-system/src/student/information/system/Audit_details.form @@ -0,0 +1,175 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
+ + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ diff --git a/Admission-counselling-system/src/student/information/system/Audit_details.java b/Admission-counselling-system/src/student/information/system/Audit_details.java new file mode 100644 index 00000000..fc5fec30 --- /dev/null +++ b/Admission-counselling-system/src/student/information/system/Audit_details.java @@ -0,0 +1,281 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package student.information.system; +import javax.swing.JOptionPane; +import java.awt.*; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.Calendar; +import java.util.GregorianCalendar; +import javax.swing.*; +import net.proteanit.sql.DbUtils; + +/** + * + * @author Hyrex + */ +public class Audit_details extends javax.swing.JFrame { +Connection conn=null; +ResultSet rs=null; +PreparedStatement pst=null; + /** + * Creates new form Audit_details + */ + public Audit_details() { + initComponents(); + conn=db.java_db(); + Toolkit toolkit = getToolkit(); + Dimension size = toolkit.getScreenSize(); + setLocation(size.width/2 - getWidth()/2, + size.height/2 - getHeight()/2); + + Update_table3(); + + } + + + private void Update_table3() { + try{ + + + String sql ="select * from Audit"; + + pst=conn.prepareStatement(sql); + rs=pst.executeQuery(); + tbl_3.setModel(DbUtils.resultSetToTableModel(rs)); + + } + catch(Exception e){ + JOptionPane.showMessageDialog(null, e); + } + finally { + + try{ + rs.close(); + pst.close(); + + } + catch(Exception e){ + + } + } + } + + + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jPanel3 = new javax.swing.JPanel(); + jScrollPane3 = new javax.swing.JScrollPane(); + tbl_3 = new javax.swing.JTable(); + jButton1 = new javax.swing.JButton(); + jPanel4 = new javax.swing.JPanel(); + jLabel2 = new javax.swing.JLabel(); + txt_search = new javax.swing.JTextField(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setResizable(false); + + jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Login_Record", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Adobe Arabic", 1, 14))); // NOI18N + + tbl_3.setModel(new javax.swing.table.DefaultTableModel( + new Object [][] { + {null, null, null, null}, + {null, null, null, null}, + {null, null, null, null}, + {null, null, null, null} + }, + new String [] { + "Title 1", "Title 2", "Title 3", "Title 4" + } + )); + jScrollPane3.setViewportView(tbl_3); + + jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/student/information/system/images/erase-128.png"))); // NOI18N + jButton1.setText("Reset"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); + jPanel3.setLayout(jPanel3Layout); + jPanel3Layout.setHorizontalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 557, Short.MAX_VALUE) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup() + .addGap(0, 0, Short.MAX_VALUE) + .addComponent(jButton1))) + .addContainerGap()) + ); + jPanel3Layout.setVerticalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addContainerGap() + .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 327, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jButton1) + .addGap(6, 6, 6)) + ); + + jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Search", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Adobe Arabic", 1, 14))); // NOI18N + + jLabel2.setText("ID:"); + + txt_search.addKeyListener(new java.awt.event.KeyAdapter() { + public void keyReleased(java.awt.event.KeyEvent evt) { + txt_searchKeyReleased(evt); + } + }); + + javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); + jPanel4.setLayout(jPanel4Layout); + jPanel4Layout.setHorizontalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addContainerGap() + .addComponent(jLabel2) + .addGap(18, 18, 18) + .addComponent(txt_search) + .addContainerGap()) + ); + jPanel4Layout.setVerticalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(txt_search, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel2)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE)) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(20, 20, 20) + .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(26, 26, 26) + .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + pack(); + }// //GEN-END:initComponents + + private void txt_searchKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_searchKeyReleased + // TODO add your handling code here: + try{ + + String sql ="select * from Audit where emp_id=? "; + + + pst=conn.prepareStatement(sql); + pst.setString(1,txt_search.getText()); + rs=pst.executeQuery(); + tbl_3.setModel(DbUtils.resultSetToTableModel(rs)); + + + + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e); + } + finally { + + try{ + + rs.close(); + pst.close(); + + } + catch(Exception e){ + + } + } + + + + }//GEN-LAST:event_txt_searchKeyReleased + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + // TODO add your handling code here: + + Update_table3(); + txt_search.setText(""); + + }//GEN-LAST:event_jButton1ActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(Audit_details.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(Audit_details.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(Audit_details.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(Audit_details.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + // + // + // + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new Audit_details().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JLabel jLabel2; + private javax.swing.JPanel jPanel3; + private javax.swing.JPanel jPanel4; + private javax.swing.JScrollPane jScrollPane3; + private javax.swing.JTable tbl_3; + private javax.swing.JTextField txt_search; + // End of variables declaration//GEN-END:variables +} diff --git a/Admission-counselling-system/src/student/information/system/Choice.form b/Admission-counselling-system/src/student/information/system/Choice.form new file mode 100644 index 00000000..e2d8336a --- /dev/null +++ b/Admission-counselling-system/src/student/information/system/Choice.form @@ -0,0 +1,516 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Admission-counselling-system/src/student/information/system/Choice.java b/Admission-counselling-system/src/student/information/system/Choice.java new file mode 100644 index 00000000..a2356733 --- /dev/null +++ b/Admission-counselling-system/src/student/information/system/Choice.java @@ -0,0 +1,408 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package student.information.system; + +import java.awt.Component; +import java.awt.HeadlessException; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.imageio.ImageIO; + +/** + * + */ +public class Choice extends javax.swing.JFrame { + + /** + * Creates new form Choice + */ + public Choice() { + initComponents(); + } + public Choice(String dat){ + initComponents(); + this.jTextField1.setText(dat); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jPanel1 = new javax.swing.JPanel(); + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jComboBox1 = new javax.swing.JComboBox<>(); + jLabel3 = new javax.swing.JLabel(); + jComboBox2 = new javax.swing.JComboBox<>(); + jLabel4 = new javax.swing.JLabel(); + jComboBox3 = new javax.swing.JComboBox<>(); + jLabel5 = new javax.swing.JLabel(); + jComboBox4 = new javax.swing.JComboBox<>(); + jLabel6 = new javax.swing.JLabel(); + jComboBox5 = new javax.swing.JComboBox<>(); + jLabel7 = new javax.swing.JLabel(); + jLabel8 = new javax.swing.JLabel(); + jComboBox6 = new javax.swing.JComboBox<>(); + jLabel9 = new javax.swing.JLabel(); + jComboBox7 = new javax.swing.JComboBox<>(); + jLabel10 = new javax.swing.JLabel(); + jComboBox8 = new javax.swing.JComboBox<>(); + jLabel11 = new javax.swing.JLabel(); + jComboBox9 = new javax.swing.JComboBox<>(); + jLabel12 = new javax.swing.JLabel(); + jComboBox10 = new javax.swing.JComboBox<>(); + jButton1 = new javax.swing.JButton(); + Print = new javax.swing.JButton(); + jLabel13 = new javax.swing.JLabel(); + jTextField1 = new javax.swing.JTextField(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); + + jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 4), "CHOICES", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 24))); // NOI18N + + jLabel1.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N + jLabel1.setText("Select your college"); + + jLabel2.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N + jLabel2.setText("Choice 1"); + + jComboBox1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N + jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Select", "BENNETT", "AMITY", "SNU", "GNIOT", "SRM" })); + + jLabel3.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N + jLabel3.setText("Choice 2"); + + jComboBox2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N + jComboBox2.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Select", "BENNETT", "SNU", "SRM", "GNIOT", "AMITY" })); + + jLabel4.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N + jLabel4.setText("Choice 3"); + + jComboBox3.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N + jComboBox3.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Select", "BENNETT", "AMITY", "SNU", "SRM", "GNIOT" })); + + jLabel5.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N + jLabel5.setText("Choice 4"); + + jComboBox4.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N + jComboBox4.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Select", "BENNETT", "SNU", "SRM", "GNIOT", "AMITY" })); + + jLabel6.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N + jLabel6.setText("Choice 5"); + + jComboBox5.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N + jComboBox5.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Select", "BENNETT", "SNU", "SRM", "AMITY", "GNIOT" })); + + jLabel7.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N + jLabel7.setText("Select your branch"); + + jLabel8.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N + jLabel8.setText("Choice 1"); + + jComboBox6.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N + jComboBox6.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Select", "COMPUTER_SCIENCE", "ECE", "MECHANICAL", "CIVIL", "BIOTECH" })); + jComboBox6.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jComboBox6ActionPerformed(evt); + } + }); + + jLabel9.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N + jLabel9.setText("Choice 2"); + + jComboBox7.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N + jComboBox7.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Select", "COMPUTER_SCIENCE", "MECHANICAL", "ECE", "CIVIL", "BIOTECH" })); + + jLabel10.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N + jLabel10.setText("Choice 3"); + + jComboBox8.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N + jComboBox8.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "select", "COMPUTER_SCIENCE", "ECE", "MECHANICAL", "BIOTECH", "CIVIL" })); + jComboBox8.setToolTipText(""); + + jLabel11.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N + jLabel11.setText("Choice 4"); + + jComboBox9.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N + jComboBox9.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Select", "COMPUTER_SCIENCE", "ECE", "MECHANICAL", "CIVIL", "BIOTECH" })); + + jLabel12.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N + jLabel12.setText("Choice 5"); + + jComboBox10.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N + jComboBox10.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Select", "COMPUTER_SCIENCE", "ECE", "MECHANICAL", "CIVIL", "BIOTECH" })); + + jButton1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N + jButton1.setText("OK"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + Print.setText("Print"); + Print.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + PrintActionPerformed(evt); + } + }); + + jLabel13.setFont(new java.awt.Font("Dialog", 1, 24)); // NOI18N + jLabel13.setText("Student ID"); + + jTextField1.setText("jTextField1"); + jTextField1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jTextField1ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(23, 23, 23) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel1) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 95, Short.MAX_VALUE) + .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jComboBox1, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jComboBox2, 0, 136, Short.MAX_VALUE) + .addComponent(jComboBox3, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jComboBox4, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jComboBox5, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 223, Short.MAX_VALUE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addGap(0, 0, Short.MAX_VALUE) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel7) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(jLabel12, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel11, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel10, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel9, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel8, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 85, Short.MAX_VALUE)) + .addGap(32, 32, 32) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jComboBox6, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jComboBox7, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jComboBox8, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jComboBox9, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jComboBox10, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(26, 26, 26) + .addComponent(Print, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(23, 23, 23)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(164, 164, 164) + .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(104, 104, 104) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1) + .addComponent(jLabel7)) + .addGap(18, 18, 18) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel13, javax.swing.GroupLayout.DEFAULT_SIZE, 36, Short.MAX_VALUE) + .addComponent(jTextField1)) + .addGap(29, 29, 29) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2) + .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel8) + .addComponent(jComboBox6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(49, 49, 49) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel3) + .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel9) + .addComponent(jComboBox7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(53, 53, 53) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel4) + .addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel10) + .addComponent(jComboBox8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(66, 66, 66) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel5) + .addComponent(jComboBox4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel11) + .addComponent(jComboBox9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(63, 63, 63) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel6) + .addComponent(jComboBox5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel12) + .addComponent(jComboBox10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 61, Short.MAX_VALUE) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jButton1) + .addComponent(Print, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(46, 46, 46)) + ); + + getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 20, 830, 670)); + + pack(); + }// //GEN-END:initComponents + + private void jComboBox6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox6ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jComboBox6ActionPerformed + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed +String t1=jTextField1.getText(); + String c1 = jComboBox1.getSelectedItem().toString(); +String c2 = jComboBox2.getSelectedItem().toString(); +String c3 = jComboBox3.getSelectedItem().toString(); +String c4 = jComboBox4.getSelectedItem().toString(); +String c5 = jComboBox5.getSelectedItem().toString(); +String b1 = jComboBox6.getSelectedItem().toString(); +String b2 = jComboBox7.getSelectedItem().toString(); +String b3= jComboBox8.getSelectedItem().toString(); +String b4 = jComboBox9.getSelectedItem().toString(); +String b5 = jComboBox10.getSelectedItem().toString(); + ChoicesData ch; + try { + ch = new ChoicesData(t1,c1,c2,c3,c4,c5,b1,b2,b3,b4,b5); + } catch (HeadlessException ex) { + Logger.getLogger(Choice.class.getName()).log(Level.SEVERE, null, ex); + } catch (IOException ex) { + Logger.getLogger(Choice.class.getName()).log(Level.SEVERE, null, ex); + } + + try { + // TODO add your handling code here: + new CounsellingResult(String.valueOf(this.jTextField1.getText())).setVisible(true); + } catch (FileNotFoundException ex) { + Logger.getLogger(Choice.class.getName()).log(Level.SEVERE, null, ex); + } + this.setVisible(false); + }//GEN-LAST:event_jButton1ActionPerformed +public static BufferedImage getScreenShot(Component component){ +BufferedImage image =new BufferedImage(component.getWidth(),component.getHeight(),BufferedImage.TYPE_INT_RGB); +component.paint(image.getGraphics()); +return image; +} +public static void SaveScreenShot(Component component,String filename)throws Exception{ +BufferedImage img = getScreenShot(component); + ImageIO.write(img, "png", new File(filename));} + private void PrintActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PrintActionPerformed + // TODO add your handling code here: + try{ // TODO add your handling code here: +SaveScreenShot(jPanel1,"Choices.png"); + } + catch (Exception ex) { + Logger.getLogger(Choice.class.getName()).log(Level.SEVERE, null, ex); + } + }//GEN-LAST:event_PrintActionPerformed + + private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed + try { + // TODO add your handling code here: + new CounsellingResult(String.valueOf(jTextField1.getText())).setVisible(true); + } catch (FileNotFoundException ex) { + Logger.getLogger(Choice.class.getName()).log(Level.SEVERE, null, ex); + } + this.setVisible(false); + }//GEN-LAST:event_jTextField1ActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(Choice.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(Choice.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(Choice.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(Choice.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new Choice().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton Print; + private javax.swing.JButton jButton1; + private javax.swing.JComboBox jComboBox1; + private javax.swing.JComboBox jComboBox10; + private javax.swing.JComboBox jComboBox2; + private javax.swing.JComboBox jComboBox3; + private javax.swing.JComboBox jComboBox4; + private javax.swing.JComboBox jComboBox5; + private javax.swing.JComboBox jComboBox6; + private javax.swing.JComboBox jComboBox7; + private javax.swing.JComboBox jComboBox8; + private javax.swing.JComboBox jComboBox9; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel10; + private javax.swing.JLabel jLabel11; + private javax.swing.JLabel jLabel12; + private javax.swing.JLabel jLabel13; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JLabel jLabel7; + private javax.swing.JLabel jLabel8; + private javax.swing.JLabel jLabel9; + private javax.swing.JPanel jPanel1; + private javax.swing.JTextField jTextField1; + // End of variables declaration//GEN-END:variables +} diff --git a/Admission-counselling-system/src/student/information/system/ChoicesData.java b/Admission-counselling-system/src/student/information/system/ChoicesData.java new file mode 100644 index 00000000..3e7e1e8a --- /dev/null +++ b/Admission-counselling-system/src/student/information/system/ChoicesData.java @@ -0,0 +1,69 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package student.information.system; + +import java.awt.HeadlessException; +import java.io.FileWriter; +import java.io.IOException; +import java.io.Writer; +import static student.information.system.StudentData.newWriter; + +/** + * + * @author pawan saxena + */ + public class ChoicesData { + public static Writer ChoicesWriter,SortWriter; + + String cChoice1; + String cChoice2; + String cChoice3; + String cChoice4; + String cChoice5; + String bChoice1; + String bChoice2; + String bChoice3; + String bChoice4; + String bChoice5; + + + + ChoicesData(String stud,String cChoice1, String cChoice2, String cChoice3, String cChoice4, String cChoice5, String bChoice1, String bChoice2, String bChoice3, String bChoice4, String bChoice5) throws HeadlessException, IOException { + this.cChoice1 = cChoice1; + this.cChoice2 = cChoice2; + this.cChoice3 = cChoice3; + this.cChoice4 = cChoice4; + this.cChoice5 = cChoice5; + this.bChoice1 = bChoice1; + this.bChoice2 = bChoice2; + this.bChoice3 = bChoice3; + this.bChoice4 = bChoice4; + this.bChoice5 = bChoice5; + Store(stud); + } + +public void Store(String txt) throws IOException{ +ChoicesWriter= new FileWriter("choices.txt",true); + ChoicesWriter.write(System.lineSeparator()); + String value1 = this.cChoice1; + String value2 = this.cChoice2; + String value3 = this.cChoice3; + String value4 = this.cChoice4; + String value5 = this.cChoice5; + String value6 = this.bChoice1; + String value7 = this.bChoice2; + String value8 = this.bChoice3; + String value9= this.bChoice4; + String value10 = this.bChoice5; +ChoicesWriter.write(txt+" Choice-1: "+value1+" Choice-2: "+value2+" Choice-3: "+value3+" Choice-4: "+value4+" Choice-5: "+value5+" Branch-Choice-1: "+value6+" Branch-Choice-2: "+value7+" Branch-Choice-3: "+value8+" Branch-Choice-4: "+value9+" Branch-Choice-5: "+value10+" "); + ChoicesWriter.write(System.lineSeparator()); + + + ChoicesWriter.flush(); + ChoicesWriter.close(); + +} +} diff --git a/Admission-counselling-system/src/student/information/system/CounsellingResult.form b/Admission-counselling-system/src/student/information/system/CounsellingResult.form new file mode 100644 index 00000000..220893eb --- /dev/null +++ b/Admission-counselling-system/src/student/information/system/CounsellingResult.form @@ -0,0 +1,213 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Admission-counselling-system/src/student/information/system/CounsellingResult.java b/Admission-counselling-system/src/student/information/system/CounsellingResult.java new file mode 100644 index 00000000..cf975be3 --- /dev/null +++ b/Admission-counselling-system/src/student/information/system/CounsellingResult.java @@ -0,0 +1,338 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package student.information.system; + +import java.awt.Component; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.FileNotFoundException; +import java.util.Scanner; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.imageio.ImageIO; + +/** + * + * @author HP + */ +public class CounsellingResult extends javax.swing.JFrame { + + /** + * Creates new form CounsellingResult + */ + public CounsellingResult() { + initComponents(); + } + public CounsellingResult(String value) throws FileNotFoundException { + initComponents(); + this.jTextField2.setText(value); + File f = new File("output.txt"); + Scanner sc =new Scanner(f); + while(sc.hasNextLine()){ + String data = sc.nextLine(); +String variable[] = data.split("\\s+"); +String p=variable[3]; + if(p.equals(value)){ + + + this.jTextField1.setText(variable[0]+" "+variable[1]); + + + + + }}} + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jPanel1 = new javax.swing.JPanel(); + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + jTextField1 = new javax.swing.JTextField(); + jLabel4 = new javax.swing.JLabel(); + jTextField2 = new javax.swing.JTextField(); + jLabel5 = new javax.swing.JLabel(); + jTextField3 = new javax.swing.JTextField(); + jLabel6 = new javax.swing.JLabel(); + jTextField4 = new javax.swing.JTextField(); + jButton1 = new javax.swing.JButton(); + jButton2 = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); + + jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 3)); + + jLabel2.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N + jLabel2.setText("COUNSELLING RESULT"); + + jLabel3.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N + jLabel3.setText("Name"); + + jTextField1.setText("jTextField1"); + jTextField1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jTextField1ActionPerformed(evt); + } + }); + + jLabel4.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N + jLabel4.setText("Student ID"); + + jTextField2.setText("jTextField2"); + jTextField2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jTextField2ActionPerformed(evt); + } + }); + + jLabel5.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N + jLabel5.setText("College Allotted"); + + jTextField3.setText("jTextField3"); + + jLabel6.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N + jLabel6.setText("Branch Allotted"); + + jTextField4.setText("jTextField4"); + jTextField4.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jTextField4ActionPerformed(evt); + } + }); + + jButton1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N + jButton1.setText("ok"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + jButton2.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N + jButton2.setText("Save as Image"); + jButton2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton2ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(308, 308, 308) + .addComponent(jLabel2) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel1)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(260, 260, 260) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(45, 45, 45) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jTextField2) + .addComponent(jTextField1) + .addComponent(jTextField3) + .addComponent(jTextField4) + .addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)))) + .addContainerGap(160, Short.MAX_VALUE)) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(21, 21, 21) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(57, 57, 57) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel3)) + .addGap(29, 29, 29) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel4) + .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(39, 39, 39) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel5) + .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(37, 37, 37) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel6) + .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 45, Short.MAX_VALUE) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jButton1) + .addComponent(jButton2)) + .addGap(29, 29, 29)) + ); + + getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 20, 860, 460)); + + pack(); + }// //GEN-END:initComponents + + private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jTextField1ActionPerformed + + private void jTextField2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField2ActionPerformed + String val= this.jTextField2.getText(); +String q=""; + File ci=new File("output.txt"); + try { + Scanner c1=new Scanner(ci); + while(c1.hasNextLine()){ + String data = c1.nextLine(); +String variable[] = data.split("\\s+"); +String p=variable[3]; + if(p.equals(val)){ + q=variable[8]; + } + }// TODO add your handling code here: + } catch (FileNotFoundException ex) { + Logger.getLogger(CounsellingResult.class.getName()).log(Level.SEVERE, null, ex); + } + + File choices = new File("choices.txt"); + +Scanner sc = null; + try { + sc = new Scanner(choices); + } catch (FileNotFoundException ex) { + Logger.getLogger(CounsellingResult.class.getName()).log(Level.SEVERE, null, ex); + } +while(sc.hasNextLine()){ + String data = sc.nextLine(); +String variable[] = data.split("\\s+"); +String p=variable[0]; +int k=Integer.parseInt(q); +if(p.equals(val)) + if (k>=90 ){ +jTextField3.setText(variable[2]); +jTextField4.setText(variable[12]); +} + else if (k<90 && k>=80){ +jTextField3.setText(variable[4]); +jTextField4.setText(variable[14]); +} + else if (k>=75&& k<80){ +jTextField3.setText(variable[6]); +jTextField4.setText(variable[16]); +} + else if (k>=70&& k<75){ +jTextField3.setText(variable[8]); +jTextField4.setText(variable[18]); +} + else if (k>=60&& k<70){ +jTextField3.setText(variable[10]); +jTextField4.setText(variable[20]); +} + else{ +jTextField3.setText(" No seat alloted "); +jTextField4.setText(" No seat alloted "); +} + +} + }//GEN-LAST:event_jTextField2ActionPerformed +public static BufferedImage getScreenShot(Component component){ +BufferedImage image =new BufferedImage(component.getWidth(),component.getHeight(),BufferedImage.TYPE_INT_RGB); +component.paint(image.getGraphics()); +return image; +} +public static void SaveScreenShot(Component component,String filename)throws Exception{ +BufferedImage img = getScreenShot(component); + ImageIO.write(img, "png", new File(filename));} + private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed + + // TODO add your handling code here: + try{ // TODO add your handling code here: +SaveScreenShot(jPanel1,"My Choice.png"); + } + catch (Exception ex) { + Logger.getLogger(Choice.class.getName()).log(Level.SEVERE, null, ex); + } + }//GEN-LAST:event_jButton2ActionPerformed + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + this.setVisible(false); + + // TODO add your handling code here: + + }//GEN-LAST:event_jButton1ActionPerformed + + private void jTextField4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField4ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jTextField4ActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(CounsellingResult.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(CounsellingResult.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(CounsellingResult.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(CounsellingResult.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new CounsellingResult().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton2; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JPanel jPanel1; + private javax.swing.JTextField jTextField1; + private javax.swing.JTextField jTextField2; + private javax.swing.JTextField jTextField3; + private javax.swing.JTextField jTextField4; + // End of variables declaration//GEN-END:variables + + +} diff --git a/Admission-counselling-system/src/student/information/system/DbUtils.java b/Admission-counselling-system/src/student/information/system/DbUtils.java new file mode 100644 index 00000000..163dc83e --- /dev/null +++ b/Admission-counselling-system/src/student/information/system/DbUtils.java @@ -0,0 +1,14 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package student.information.system; + +/** + * + * @author Hyrex + */ +class DbUtils { + +} diff --git a/Admission-counselling-system/src/student/information/system/Emp.java b/Admission-counselling-system/src/student/information/system/Emp.java new file mode 100644 index 00000000..c627c475 --- /dev/null +++ b/Admission-counselling-system/src/student/information/system/Emp.java @@ -0,0 +1,17 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package student.information.system; + +/** + * + * @author AliHyrex + */ +public class Emp { + public static int empId; + + + +} diff --git a/Admission-counselling-system/src/student/information/system/Login.form b/Admission-counselling-system/src/student/information/system/Login.form new file mode 100644 index 00000000..37ca3379 --- /dev/null +++ b/Admission-counselling-system/src/student/information/system/Login.form @@ -0,0 +1,174 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Admission-counselling-system/src/student/information/system/Login.java b/Admission-counselling-system/src/student/information/system/Login.java new file mode 100644 index 00000000..3f2b1f50 --- /dev/null +++ b/Admission-counselling-system/src/student/information/system/Login.java @@ -0,0 +1,290 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package student.information.system; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.GregorianCalendar; +import javax.swing.JOptionPane; +import com.sun.glass.events.KeyEvent; +import java.awt.*; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileWriter; +import java.io.IOException; +import java.io.Writer; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import javax.swing.*; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.LinkedList; +import java.util.Scanner; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * + * @author Hyrex + */ +public class Login extends javax.swing.JFrame { +public static Writer newWriter,SortWriter; + + Connection conn=null; +ResultSet rs=null; +PreparedStatement pst=null; + + /** + * Creates new form Login + */ + public Login() { + initComponents(); + conn=db.java_db(); + Toolkit toolkit = getToolkit(); + Dimension size = toolkit.getScreenSize(); + setLocation(size.width/2 - getWidth()/2, + size.height/2 - getHeight()/2); + currentDate(); + } + public void currentDate (){ + + Calendar cal =new GregorianCalendar(); + int month = cal.get(Calendar.MONTH); + int year = cal.get(Calendar.YEAR); + int day = cal.get(Calendar.DAY_OF_MONTH); + + txt_date.setText((month+1)+"/"+day+"/"+year); + } + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jPanel1 = new javax.swing.JPanel(); + jLabel2 = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + jButton1 = new javax.swing.JButton(); + txt_username = new javax.swing.JTextField(); + txt_password = new javax.swing.JPasswordField(); + txt_combo = new javax.swing.JComboBox<>(); + jLabel4 = new javax.swing.JLabel(); + jLabel1 = new javax.swing.JLabel(); + jMenuBar1 = new javax.swing.JMenuBar(); + txt_date = new javax.swing.JMenu(); + txt_time = new javax.swing.JMenu(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setResizable(false); + + jPanel1.setLayout(null); + + jLabel2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N + jLabel2.setForeground(new java.awt.Color(255, 255, 255)); + jLabel2.setText("Username :"); + jPanel1.add(jLabel2); + jLabel2.setBounds(20, 280, 90, 17); + + jLabel3.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N + jLabel3.setForeground(new java.awt.Color(255, 255, 255)); + jLabel3.setText("Password :"); + jPanel1.add(jLabel3); + jLabel3.setBounds(20, 320, 80, 17); + + jButton1.setText("Login"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + jPanel1.add(jButton1); + jButton1.setBounds(180, 390, 70, 30); + + txt_username.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + txt_usernameActionPerformed(evt); + } + }); + jPanel1.add(txt_username); + txt_username.setBounds(110, 270, 160, 30); + jPanel1.add(txt_password); + txt_password.setBounds(110, 310, 160, 30); + + txt_combo.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Admin", "Student" })); + txt_combo.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + txt_comboActionPerformed(evt); + } + }); + jPanel1.add(txt_combo); + txt_combo.setBounds(110, 350, 160, 30); + + jLabel4.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N + jLabel4.setForeground(new java.awt.Color(255, 255, 255)); + jLabel4.setText("Division :"); + jPanel1.add(jLabel4); + jLabel4.setBounds(20, 360, 70, 17); + + jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/student/information/system/images/Presentation1.jpg"))); // NOI18N + jPanel1.add(jLabel1); + jLabel1.setBounds(0, 0, 660, 430); + + txt_date.setText("Date"); + jMenuBar1.add(txt_date); + + txt_time.setText("Time"); + jMenuBar1.add(txt_time); + + setJMenuBar(jMenuBar1); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 661, Short.MAX_VALUE) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 433, Short.MAX_VALUE) + ); + + pack(); + }// //GEN-END:initComponents + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + + String access; + access = this.txt_combo.getSelectedItem().toString(); + + + String p=String.valueOf(this.txt_password.getPassword()); + if(access.equals("Admin") && this.txt_username.getText().equals("admin") && p.equals("admin")) { + + + JOptionPane.showMessageDialog(null,"Sucess" ); + MainMenu j = new MainMenu(); + j.setVisible(true); + this.dispose(); + + + Date currentDate = GregorianCalendar.getInstance().getTime(); + DateFormat df = DateFormat.getDateInstance(); + String dateString = df.format(currentDate); + + Date d = new Date(); + SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); + String timeString = sdf.format(d); + + String value0 = timeString; + String values = dateString; + + + + this.dispose(); + + + } + else if(access.equals("Student")){ + this.jLabel2.setText("Firstname"); + this.jLabel3.setText("12h Roll No"); + File f=new File("output.txt"); + + + + Scanner sc = null; + try { + sc = new Scanner(f); + } catch (FileNotFoundException ex) { + Logger.getLogger(StudentInformation.class.getName()).log(Level.SEVERE, null, ex); + } +while(sc.hasNextLine()){ + String data = sc.nextLine(); + System.out.println(data); +String variable[] = data.split("\\s+"); +String user=variable[0]; +String perc=variable[3]; + if(perc.equals(String.valueOf(this.txt_password.getPassword())) && user.equals(String.valueOf(this.txt_username.getText()))){ + new StudentInformation(perc).setVisible(true); + this.setVisible(false); + + + } + } + + }//GEN-LAST:event_jButton1ActionPerformed + } + private void txt_usernameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txt_usernameActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_txt_usernameActionPerformed + + private void txt_comboActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txt_comboActionPerformed + // TODO add your handling code here: +String id1=this.txt_combo.getSelectedItem().toString(); +if(id1.equals("Student")){ + this.jLabel2.setText("Firstname"); + this.jLabel3.setText("12h Roll No"); + +} + }//GEN-LAST:event_txt_comboActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new Login().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JMenuBar jMenuBar1; + private javax.swing.JPanel jPanel1; + private javax.swing.JComboBox txt_combo; + private javax.swing.JMenu txt_date; + private javax.swing.JPasswordField txt_password; + private javax.swing.JMenu txt_time; + private javax.swing.JTextField txt_username; + // End of variables declaration//GEN-END:variables +} diff --git a/Admission-counselling-system/src/student/information/system/MainMenu.form b/Admission-counselling-system/src/student/information/system/MainMenu.form new file mode 100644 index 00000000..a2775502 --- /dev/null +++ b/Admission-counselling-system/src/student/information/system/MainMenu.form @@ -0,0 +1,119 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/Admission-counselling-system/src/student/information/system/MainMenu.java b/Admission-counselling-system/src/student/information/system/MainMenu.java new file mode 100644 index 00000000..eccc97ab --- /dev/null +++ b/Admission-counselling-system/src/student/information/system/MainMenu.java @@ -0,0 +1,232 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package student.information.system; + +import java.awt.Dimension; +import java.awt.Toolkit; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.GregorianCalendar; +import javax.swing.JOptionPane; + +/** + * + * @author Hyrex + */ +public class MainMenu extends javax.swing.JFrame { +Connection conn=null; +ResultSet rs=null; +PreparedStatement pst=null; + /** + * Creates new form MainMenu + */ + public MainMenu() { + conn=db.java_db(); + initComponents(); + Toolkit toolkit = getToolkit(); + Dimension size = toolkit.getScreenSize(); + setLocation(size.width/2 - getWidth()/2, + size.height/2 - getHeight()/2); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jPanel1 = new javax.swing.JPanel(); + jButton1 = new javax.swing.JButton(); + jButton5 = new javax.swing.JButton(); + jLabel1 = new javax.swing.JLabel(); + jMenuBar1 = new javax.swing.JMenuBar(); + jMenu1 = new javax.swing.JMenu(); + jMenuItem1 = new javax.swing.JMenuItem(); + jMenuItem2 = new javax.swing.JMenuItem(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setResizable(false); + + jPanel1.setLayout(null); + + jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/student/information/system/images/Add.png"))); // NOI18N + jButton1.setText("Student Manager"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + jPanel1.add(jButton1); + jButton1.setBounds(570, 430, 190, 60); + + jButton5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/student/information/system/images/logout.png"))); // NOI18N + jButton5.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton5ActionPerformed(evt); + } + }); + jPanel1.add(jButton5); + jButton5.setBounds(750, 10, 40, 30); + + jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/student/information/system/images/pnbennet.png"))); // NOI18N + jPanel1.add(jLabel1); + jLabel1.setBounds(0, 0, 800, 530); + + jMenu1.setText("File"); + + jMenuItem1.setText("Audit"); + jMenuItem1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem1ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem1); + + jMenuItem2.setText("Users"); + jMenuItem2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem2ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem2); + + jMenuBar1.add(jMenu1); + + setJMenuBar(jMenuBar1); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 799, Short.MAX_VALUE) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 529, Short.MAX_VALUE) + ); + + pack(); + }// //GEN-END:initComponents + + private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed + // TODO add your handling code here: + Login j = new Login(); + j.setVisible(true); + this.dispose(); + + + try{ + Date currentDate = GregorianCalendar.getInstance().getTime(); + DateFormat df = DateFormat.getDateInstance(); + String dateString = df.format(currentDate); + + Date d = new Date(); + SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); + String timeString = sdf.format(d); + + String value0 = timeString; + String values = dateString; + + + int value = Emp.empId; + String reg = "insert into Audit (emp_id,date,status) values ('"+value+"','"+value0+" / "+values+"','Logged out')"; + pst=conn.prepareStatement(reg); + pst.execute(); + this.dispose(); + }catch (Exception e){ + + JOptionPane.showMessageDialog(null, e); + + } + finally { + + try{ + rs.close(); + pst.close(); + + } + catch(Exception e){ + + } + } + + }//GEN-LAST:event_jButton5ActionPerformed + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + // TODO add your handling code here: + + StudentInformation j= new StudentInformation(); + j.setVisible(true); + + + }//GEN-LAST:event_jButton1ActionPerformed + + private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed + // TODO add your handling code here: + Audit_details j = new Audit_details(); + j.setVisible(true); + }//GEN-LAST:event_jMenuItem1ActionPerformed + + private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed + // TODO add your handling code here: + + users j = new users(); + j.setVisible(true); + }//GEN-LAST:event_jMenuItem2ActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new MainMenu().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton5; + private javax.swing.JLabel jLabel1; + private javax.swing.JMenu jMenu1; + private javax.swing.JMenuBar jMenuBar1; + private javax.swing.JMenuItem jMenuItem1; + private javax.swing.JMenuItem jMenuItem2; + private javax.swing.JPanel jPanel1; + // End of variables declaration//GEN-END:variables +} diff --git a/Admission-counselling-system/src/student/information/system/Result.form b/Admission-counselling-system/src/student/information/system/Result.form new file mode 100644 index 00000000..3434b1bc --- /dev/null +++ b/Admission-counselling-system/src/student/information/system/Result.form @@ -0,0 +1,53 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Admission-counselling-system/src/student/information/system/Result.java b/Admission-counselling-system/src/student/information/system/Result.java new file mode 100644 index 00000000..8b19cbd3 --- /dev/null +++ b/Admission-counselling-system/src/student/information/system/Result.java @@ -0,0 +1,95 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package student.information.system; + +/** + * + * @author pawan saxena + */ +public class Result extends javax.swing.JFrame { + + /** + * Creates new form Result + */ + public Result() { + initComponents(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jLabel1 = new javax.swing.JLabel(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + + jLabel1.setFont(new java.awt.Font("Dialog", 1, 24)); // NOI18N + jLabel1.setText(" Name :"); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(181, 181, 181) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(388, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(64, 64, 64) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(340, Short.MAX_VALUE)) + ); + + pack(); + }// //GEN-END:initComponents + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(Result.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(Result.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(Result.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(Result.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new Result().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JLabel jLabel1; + // End of variables declaration//GEN-END:variables +} diff --git a/Admission-counselling-system/src/student/information/system/StudentData.java b/Admission-counselling-system/src/student/information/system/StudentData.java new file mode 100644 index 00000000..7f1ea37b --- /dev/null +++ b/Admission-counselling-system/src/student/information/system/StudentData.java @@ -0,0 +1,76 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package student.information.system; + +import java.io.FileNotFoundException; +import java.io.FileWriter; +import java.io.IOException; +import java.io.Writer; +import static student.information.system.Login.newWriter; + +/** + * + * @author pawan saxena + */ +public class StudentData { + public static Writer newWriter,SortWriter; +String firstname; +String lastname; +String dob; +String studId; +String email; +String tel; +String address; +String add2; +String apt; +String pc; +StudentData(String firstname, +String lastname, +String dob, +String studId, +String email, +String tel, +String address, +String add2, +String apt, +String pc) throws IOException, FileNotFoundException, InterruptedException { + + this.firstname=firstname; +this.lastname=lastname; +this.dob=dob; +this.studId=studId; +this.email=email; +this.tel=tel; +this.address=address; +this.add2=add2; +this.apt=apt; +this.pc=pc; +Store(); +} + +public void Store() throws FileNotFoundException, IOException, InterruptedException { + newWriter= new FileWriter("output.txt",true); + newWriter.write(System.lineSeparator()); + String value1 = this.firstname; + String value2 = this.lastname; + String value3 = this.dob; + String value4 = this.studId; + String value5 = this.email; + String value6 = this.tel; + String value7 = this.address; + String value9 = this.add2; + String value10 = this.apt; + String value11 = this.pc; + +newWriter.write(value1+" " + value2+" "+ value3+" "+ value4+" "+ value5+" "+ value6+" "+ value7+" "+ value9+" "+ value10+" "+ value11+" "); + + + newWriter.flush(); + newWriter.close(); + + + } +} diff --git a/Admission-counselling-system/src/student/information/system/StudentInformation.form b/Admission-counselling-system/src/student/information/system/StudentInformation.form new file mode 100644 index 00000000..ce6fb2ab --- /dev/null +++ b/Admission-counselling-system/src/student/information/system/StudentInformation.form @@ -0,0 +1,536 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Admission-counselling-system/src/student/information/system/StudentInformation.java b/Admission-counselling-system/src/student/information/system/StudentInformation.java new file mode 100644 index 00000000..0ce7afaf --- /dev/null +++ b/Admission-counselling-system/src/student/information/system/StudentInformation.java @@ -0,0 +1,903 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +package student.information.system; + +/** + * + * @author Hyrex + */ +import net.proteanit.sql.DbUtils; +import java.awt.*; +import java.awt.image.BufferedImage; +import java.io.BufferedWriter; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileWriter; +import java.io.IOException; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.LinkedList; +import java.util.Scanner; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.imageio.ImageIO; +import javax.swing.*; + + + +public class StudentInformation extends javax.swing.JFrame { +Connection conn=null; +ResultSet rs=null; +PreparedStatement pst=null; + /** + * Creates new form Staff_details + */ + public StudentInformation() { + initComponents(); + conn=db.java_db(); + Toolkit toolkit = getToolkit(); + Dimension size = toolkit.getScreenSize(); + setLocation(size.width/2 - getWidth()/2, + size.height/2 - getHeight()/2); + currentDate(); + txt_emp.setText(String.valueOf(Emp.empId).toString()); + } + public StudentInformation(String StudsId) { + initComponents(); + Toolkit toolkit = getToolkit(); + Dimension size = toolkit.getScreenSize(); + setLocation(size.width/2 - getWidth()/2, + size.height/2 - getHeight()/2); + currentDate(); + txt_search1.setText(StudsId); + cmd_save.setVisible(false); + jButton3.setVisible(false); + cmd_save.setEnabled(false); + jButton3.setEnabled(false); + } + + public void currentDate (){ + + Calendar cal =new GregorianCalendar(); + int month = cal.get(Calendar.MONTH); + int year = cal.get(Calendar.YEAR); + int day = cal.get(Calendar.DAY_OF_MONTH); + + lbl_date.setText((month+1)+"/"+day+"/"+year); + + //Time + + int second = cal.get(Calendar.SECOND); + int minute = cal.get(Calendar.MINUTE); + int hour = cal.get(Calendar.HOUR); + + lbl_time.setText(hour+":"+(minute)+":"+second); + + + } + + + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jMenuBar2 = new javax.swing.JMenuBar(); + jMenu1 = new javax.swing.JMenu(); + jMenu2 = new javax.swing.JMenu(); + jDialog1 = new javax.swing.JDialog(); + jPanel3 = new javax.swing.JPanel(); + jLabel7 = new javax.swing.JLabel(); + txt_tel = new javax.swing.JTextField(); + txt_email = new javax.swing.JTextField(); + jLabel6 = new javax.swing.JLabel(); + jLabel11 = new javax.swing.JLabel(); + r_male = new javax.swing.JRadioButton(); + r_female = new javax.swing.JRadioButton(); + txt_dob = new javax.swing.JTextField(); + jLabel3 = new javax.swing.JLabel(); + txt_surname = new javax.swing.JTextField(); + jLabel2 = new javax.swing.JLabel(); + jLabel1 = new javax.swing.JLabel(); + txt_firstname = new javax.swing.JTextField(); + jDesktopPane1 = new javax.swing.JDesktopPane(); + lbl_img = new javax.swing.JLabel(); + jLabel8 = new javax.swing.JLabel(); + jLabel14 = new javax.swing.JLabel(); + jLabel15 = new javax.swing.JLabel(); + jLabel16 = new javax.swing.JLabel(); + txt_pc = new javax.swing.JTextField(); + txt_apt = new javax.swing.JTextField(); + txt_add2 = new javax.swing.JTextField(); + txt_address = new javax.swing.JTextField(); + cmd_save = new javax.swing.JButton(); + jButton1 = new javax.swing.JButton(); + jButton3 = new javax.swing.JButton(); + jLabel5 = new javax.swing.JLabel(); + txt_studentid = new javax.swing.JTextField(); + button2 = new java.awt.Button(); + txt_emp = new javax.swing.JLabel(); + jLabel10 = new javax.swing.JLabel(); + jPanel5 = new javax.swing.JPanel(); + jLabel13 = new javax.swing.JLabel(); + txt_search1 = new javax.swing.JTextField(); + jMenuBar1 = new javax.swing.JMenuBar(); + File = new javax.swing.JMenu(); + jMenuItem1 = new javax.swing.JMenuItem(); + lbl_date = new javax.swing.JMenu(); + lbl_time = new javax.swing.JMenu(); + + jMenu1.setText("File"); + jMenuBar2.add(jMenu1); + + jMenu2.setText("Edit"); + jMenuBar2.add(jMenu2); + + javax.swing.GroupLayout jDialog1Layout = new javax.swing.GroupLayout(jDialog1.getContentPane()); + jDialog1.getContentPane().setLayout(jDialog1Layout); + jDialog1Layout.setHorizontalGroup( + jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 400, Short.MAX_VALUE) + ); + jDialog1Layout.setVerticalGroup( + jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 300, Short.MAX_VALUE) + ); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setResizable(false); + + jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Student Information", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Adobe Arabic", 1, 36))); // NOI18N + + jLabel7.setText("Contact Number :"); + + jLabel6.setText("Email :"); + + jLabel11.setText("Gender:"); + + r_male.setText("Male"); + r_male.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + r_maleActionPerformed(evt); + } + }); + + r_female.setText("Female"); + r_female.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + r_femaleActionPerformed(evt); + } + }); + + jLabel3.setText("Date of Birth :"); + + jLabel2.setText("Surname :"); + + jLabel1.setText("First name :"); + + txt_firstname.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + txt_firstnameActionPerformed(evt); + } + }); + + jDesktopPane1.setLayer(lbl_img, javax.swing.JLayeredPane.DEFAULT_LAYER); + + javax.swing.GroupLayout jDesktopPane1Layout = new javax.swing.GroupLayout(jDesktopPane1); + jDesktopPane1.setLayout(jDesktopPane1Layout); + jDesktopPane1Layout.setHorizontalGroup( + jDesktopPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jDesktopPane1Layout.createSequentialGroup() + .addContainerGap() + .addComponent(lbl_img, javax.swing.GroupLayout.DEFAULT_SIZE, 231, Short.MAX_VALUE) + .addContainerGap()) + ); + jDesktopPane1Layout.setVerticalGroup( + jDesktopPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jDesktopPane1Layout.createSequentialGroup() + .addContainerGap() + .addComponent(lbl_img, javax.swing.GroupLayout.DEFAULT_SIZE, 145, Short.MAX_VALUE) + .addContainerGap()) + ); + + jLabel8.setText("Address Line 1 :"); + + jLabel14.setText("Address Line 2 :"); + + jLabel15.setText("12th Percentage"); + + jLabel16.setText("Post Code :"); + + txt_apt.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + txt_aptActionPerformed(evt); + } + }); + + txt_address.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + txt_addressActionPerformed(evt); + } + }); + + cmd_save.setIcon(new javax.swing.ImageIcon(getClass().getResource("/student/information/system/images/Save-icon.png"))); // NOI18N + cmd_save.setText("Add Record"); + cmd_save.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + cmd_saveActionPerformed(evt); + } + }); + + jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/student/information/system/images/erase-128.png"))); // NOI18N + jButton1.setText("Clear"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/student/information/system/images/delete_16x16.gif"))); // NOI18N + jButton3.setText("Delete"); + jButton3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton3ActionPerformed(evt); + } + }); + + jLabel5.setText("Student ID :"); + + button2.setLabel("Select Your Choices"); + button2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + button2ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); + jPanel3.setLayout(jPanel3Layout); + jPanel3Layout.setHorizontalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel6) + .addComponent(jLabel7) + .addComponent(jLabel11)) + .addGap(41, 41, 41) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addComponent(r_male) + .addGap(4, 4, 4) + .addComponent(r_female)) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(txt_tel, javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(txt_email, javax.swing.GroupLayout.PREFERRED_SIZE, 168, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addGroup(jPanel3Layout.createSequentialGroup() + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel1) + .addComponent(jLabel2) + .addComponent(jLabel3) + .addComponent(jLabel5)) + .addGap(58, 58, 58) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(txt_surname, javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(txt_firstname) + .addComponent(txt_dob) + .addComponent(txt_studentid, javax.swing.GroupLayout.DEFAULT_SIZE, 168, Short.MAX_VALUE))) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addGap(141, 141, 141) + .addComponent(button2, javax.swing.GroupLayout.PREFERRED_SIZE, 168, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup() + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel14) + .addComponent(jLabel15) + .addComponent(jLabel16) + .addComponent(jLabel8)) + .addGap(48, 48, 48) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(txt_pc, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 168, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(txt_apt, javax.swing.GroupLayout.PREFERRED_SIZE, 168, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(txt_add2, javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(txt_address, javax.swing.GroupLayout.PREFERRED_SIZE, 168, javax.swing.GroupLayout.PREFERRED_SIZE))))))) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addGap(57, 57, 57) + .addComponent(jDesktopPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(jPanel3Layout.createSequentialGroup() + .addGap(243, 243, 243) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jButton3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(cmd_save, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButton1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addContainerGap(112, Short.MAX_VALUE)) + ); + jPanel3Layout.setVerticalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jDesktopPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(cmd_save, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(32, 32, 32) + .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(37, 37, 37) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(93, 93, 93)) + .addGroup(jPanel3Layout.createSequentialGroup() + .addGap(18, 18, 18) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel5) + .addComponent(txt_studentid, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1) + .addComponent(txt_firstname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel2) + .addComponent(txt_surname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel3) + .addComponent(txt_dob, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel11) + .addComponent(r_male) + .addComponent(r_female)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(txt_email, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel6)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(txt_tel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel7)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(txt_address, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel8)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(txt_add2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel14)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(txt_apt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel15)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel16) + .addComponent(txt_pc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(39, 39, 39) + .addComponent(button2, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + txt_emp.setText("emp"); + + jLabel10.setText("Logged in As :"); + + jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Search", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Adobe Arabic", 1, 14))); // NOI18N + + jLabel13.setText("Student ID :"); + + txt_search1.addContainerListener(new java.awt.event.ContainerAdapter() { + public void componentRemoved(java.awt.event.ContainerEvent evt) { + txt_search1ComponentRemoved(evt); + } + }); + txt_search1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + txt_search1ActionPerformed(evt); + } + }); + txt_search1.addKeyListener(new java.awt.event.KeyAdapter() { + public void keyReleased(java.awt.event.KeyEvent evt) { + txt_search1KeyReleased(evt); + } + }); + + javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); + jPanel5.setLayout(jPanel5Layout); + jPanel5Layout.setHorizontalGroup( + jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel5Layout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel13) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(txt_search1, javax.swing.GroupLayout.PREFERRED_SIZE, 565, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(8, 8, 8)) + ); + jPanel5Layout.setVerticalGroup( + jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel5Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(txt_search1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel13)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + File.setText("File"); + + jMenuItem1.setText("Attach Image"); + jMenuItem1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem1ActionPerformed(evt); + } + }); + File.add(jMenuItem1); + + jMenuBar1.add(File); + + lbl_date.setText("Date"); + jMenuBar1.add(lbl_date); + + lbl_time.setText("Time"); + jMenuBar1.add(lbl_time); + + setJMenuBar(jMenuBar1); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(415, 415, 415) + .addComponent(jLabel10) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(txt_emp)) + .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addGap(6, 6, 6) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(txt_emp)))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap()) + ); + + pack(); + }// //GEN-END:initComponents + + private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed + // TODO add your handling code here: + + JFileChooser chooser = new JFileChooser(); + chooser.showOpenDialog(null); + File f = chooser.getSelectedFile(); + + filename =f.getAbsolutePath(); + ImageIcon imageIcon = new ImageIcon(new ImageIcon(filename).getImage().getScaledInstance(lbl_img.getWidth(), lbl_img.getHeight(), Image.SCALE_DEFAULT)); + lbl_img.setIcon(imageIcon); + try { + + File image = new File(filename); + FileInputStream fis = new FileInputStream (image); + ByteArrayOutputStream bos= new ByteArrayOutputStream(); + byte[] buf = new byte[1024]; + + for(int readNum; (readNum=fis.read(buf))!=-1; ){ + + bos.write(buf,0,readNum); + } + person_image=bos.toByteArray(); + } + + catch(Exception e){ + JOptionPane.showMessageDialog(null,e); + + } + + }//GEN-LAST:event_jMenuItem1ActionPerformed + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + // TODO add your handling code here: + + txt_firstname.setText(""); + txt_surname.setText(""); + txt_tel.setText(""); + txt_dob.setText(""); + txt_email.setText(""); + txt_address.setText(""); + + txt_studentid.setText(""); + + txt_add2.setText(""); + txt_pc.setText(""); + txt_apt.setText(""); + lbl_img.setIcon(null); + txt_search1.setText(""); + }//GEN-LAST:event_jButton1ActionPerformed + + private void cmd_saveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmd_saveActionPerformed + // TODO add your handling code here: + int p = JOptionPane.showConfirmDialog(null, "Are you sure you want to add record?","Add Record",JOptionPane.YES_NO_OPTION); + + + if(p==0){ + + String value110 = txt_firstname.getText(); + String value2 = txt_surname.getText(); + String value3 = txt_dob.getText(); + String value4 = txt_studentid.getText(); + String value5 = txt_email.getText(); + String value6 = txt_tel.getText(); + String value7 = txt_address.getText(); + String value9 = txt_add2.getText(); + String value10 = txt_apt.getText(); + String value11 = txt_pc.getText(); + try { + StudentData stud= new StudentData(value110,value2,value3,value4,value5,value6,value7,value9,value10,value11); + } catch (IOException ex) { + Logger.getLogger(StudentInformation.class.getName()).log(Level.SEVERE, null, ex); + } catch (InterruptedException ex) { + Logger.getLogger(StudentInformation.class.getName()).log(Level.SEVERE, null, ex); + } + + + + + + JOptionPane.showMessageDialog(null,"Data is saved successfully"); + + + + + Date currentDate = GregorianCalendar.getInstance().getTime(); + DateFormat df = DateFormat.getDateInstance(); + String dateString = df.format(currentDate); + + Date d = new Date(); + SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); + String timeString = sdf.format(d); + + String value0 = timeString; + String value1 = dateString; + String val = txt_emp.getText().toString(); + + + + + } + + }//GEN-LAST:event_cmd_saveActionPerformed + + + + + + + private void txt_aptActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txt_aptActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_txt_aptActionPerformed + + private void txt_firstnameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txt_firstnameActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_txt_firstnameActionPerformed + + private void r_femaleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_r_femaleActionPerformed + // TODO add your handling code here: + gender ="Female"; + r_female.setSelected(true); + r_male.setSelected(false); + + }//GEN-LAST:event_r_femaleActionPerformed + + private void r_maleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_r_maleActionPerformed + // TODO add your handling code here: + gender ="Male"; + r_male.setSelected(true); + r_female.setSelected(false); + }//GEN-LAST:event_r_maleActionPerformed + + private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed + // TODO add your handling code here: + + int p = JOptionPane.showConfirmDialog(null, "Are you sure you want to delete record?","Delete",JOptionPane.YES_NO_OPTION); + if(p==0){ + Date currentDate = GregorianCalendar.getInstance().getTime(); + DateFormat df = DateFormat.getDateInstance(); + String dateString = df.format(currentDate); + + Date d = new Date(); + SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); + String timeString = sdf.format(d); + + String value0 = timeString; + String value1 = dateString; + String val = txt_emp.getText().toString(); + + try{ +String notobedel= String.valueOf(txt_studentid.getText()); +File f1 = new File("output.txt"); +BufferedWriter writer; + writer = new BufferedWriter(new FileWriter(f1)); +Scanner sc =new Scanner (f1); +while(sc.hasNextLine()){String data = sc.nextLine(); +String variable[] = data.split("\\s+"); +String da=data.trim(); +String studid=variable[3]; +if(studid.equals(notobedel)){ +continue; +} +writer.write(data+System.lineSeparator()); +writer.close(); +sc.close(); +} + JOptionPane.showMessageDialog(null,"Record Deleted"); + + }catch(Exception e){ + + JOptionPane.showMessageDialog(null, e); + }finally { + + try{ + rs.close(); + pst.close(); + + } + catch(Exception e){ + + } + } + + } + + + }//GEN-LAST:event_jButton3ActionPerformed + + private void txt_search1ComponentRemoved(java.awt.event.ContainerEvent evt) {//GEN-FIRST:event_txt_search1ComponentRemoved + // TODO add your handling code here: + }//GEN-LAST:event_txt_search1ComponentRemoved + + private void txt_search1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txt_search1ActionPerformed + + File f = new File("output.txt"); + + Scanner sc = null; + try { + sc = new Scanner(f); + } catch (FileNotFoundException ex) { + Logger.getLogger(StudentInformation.class.getName()).log(Level.SEVERE, null, ex); + } +while(sc.hasNextLine()){ + String data = sc.nextLine(); +String variable[] = data.split("\\s+"); +String p=variable[3]; + if(p.equals(String.valueOf(this.txt_search1.getText()))){//linear Search + + + this.txt_studentid.setText(variable[3]); + this.txt_firstname.setText(variable[0]); + this.txt_surname.setText(variable[1]); + // this.jcmbDepartment.setText(variable[4]); + this.txt_dob.setText(variable[2]); + this.txt_email.setText(variable[4]); + this.txt_tel.setText(variable[5]); + this.txt_address.setText(variable[6]); + this.txt_add2.setText(variable[7]); + this.txt_apt.setText(variable[8]); + this.txt_pc.setText(variable[9]); + + } + +} + + }//GEN-LAST:event_txt_search1ActionPerformed + + private void txt_search1KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_search1KeyReleased + // TODO add your handling code here: + try{ + + String sql ="select * from Student_Information where id=? "; + + pst=conn.prepareStatement(sql); + pst.setString(1,txt_search1.getText()); + rs=pst.executeQuery(); + + String add1 =rs.getString("id"); + txt_studentid.setText(add1); + + String add2 =rs.getString("first_name"); + txt_firstname.setText(add2); + + String add3 =rs.getString("surname"); + txt_surname.setText(add3); + + String add4 =rs.getString("Dob"); + txt_dob.setText(add4); + + String add5 =rs.getString("Email"); + txt_email.setText(add5); + + String add6 =rs.getString("Telephone"); + txt_tel.setText(add6); + + String add7 =rs.getString("Address"); + txt_address.setText(add7); + + String add8 =rs.getString("Address2"); + txt_add2.setText(add8); + + String add9 =rs.getString("Apartment"); + txt_apt.setText(add9); + + String add10 =rs.getString("Post_code"); + txt_pc.setText(add10); + + + + + byte[] img = rs.getBytes("Image"); + ImageIcon imageIcon = new ImageIcon(new ImageIcon(img).getImage().getScaledInstance(lbl_img.getWidth(), lbl_img.getHeight(), Image.SCALE_SMOOTH)); + lbl_img.setIcon(imageIcon); + + }catch(Exception e){ + + } + finally { + + try{ + + rs.close(); + pst.close(); + + } + catch(Exception e){ + + } + } + }//GEN-LAST:event_txt_search1KeyReleased + + private void button2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button2ActionPerformed + new Choice(String.valueOf(this.txt_studentid.getText())).setVisible(true); // TODO add your handling code here: + + }//GEN-LAST:event_button2ActionPerformed + + private void txt_addressActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txt_addressActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_txt_addressActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(StudentInformation.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(StudentInformation.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(StudentInformation.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(StudentInformation.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new StudentInformation().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JMenu File; + private java.awt.Button button2; + private javax.swing.JButton cmd_save; + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton3; + private javax.swing.JDesktopPane jDesktopPane1; + private javax.swing.JDialog jDialog1; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel10; + private javax.swing.JLabel jLabel11; + private javax.swing.JLabel jLabel13; + private javax.swing.JLabel jLabel14; + private javax.swing.JLabel jLabel15; + private javax.swing.JLabel jLabel16; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JLabel jLabel7; + private javax.swing.JLabel jLabel8; + private javax.swing.JMenu jMenu1; + private javax.swing.JMenu jMenu2; + private javax.swing.JMenuBar jMenuBar1; + private javax.swing.JMenuBar jMenuBar2; + private javax.swing.JMenuItem jMenuItem1; + private javax.swing.JPanel jPanel3; + private javax.swing.JPanel jPanel5; + private javax.swing.JMenu lbl_date; + private javax.swing.JLabel lbl_img; + private javax.swing.JMenu lbl_time; + private javax.swing.JRadioButton r_female; + private javax.swing.JRadioButton r_male; + private javax.swing.JTextField txt_add2; + private javax.swing.JTextField txt_address; + private javax.swing.JTextField txt_apt; + private javax.swing.JTextField txt_dob; + private javax.swing.JTextField txt_email; + private javax.swing.JLabel txt_emp; + private javax.swing.JTextField txt_firstname; + private javax.swing.JTextField txt_pc; + private javax.swing.JTextField txt_search1; + private javax.swing.JTextField txt_studentid; + private javax.swing.JTextField txt_surname; + private javax.swing.JTextField txt_tel; + // End of variables declaration//GEN-END:variables + + private ImageIcon format =null; + //strin filename + String filename = null; + byte[] person_image = null; + + private String gender; + + +} diff --git a/Admission-counselling-system/src/student/information/system/StudentInformationSystem.java b/Admission-counselling-system/src/student/information/system/StudentInformationSystem.java new file mode 100644 index 00000000..3f9f439f --- /dev/null +++ b/Admission-counselling-system/src/student/information/system/StudentInformationSystem.java @@ -0,0 +1,21 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package student.information.system; + +/** + * + * @author Hyrex + */ +public class StudentInformationSystem { + + /** + * @param args the command line arguments + */ + public static void main(String[] args) { + // TODO code application logic here + } + +} diff --git a/Admission-counselling-system/src/student/information/system/db.java b/Admission-counselling-system/src/student/information/system/db.java new file mode 100644 index 00000000..38dc8b41 --- /dev/null +++ b/Admission-counselling-system/src/student/information/system/db.java @@ -0,0 +1,33 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package student.information.system; + +/** + * + * @author Hyrex + */ +import java.sql.*; +import javax.swing.*; +public class db { + + Connection conn=null; + public static Connection java_db(){ + + try{ + Class.forName("org.sqlite.JDBC"); + Connection conn =DriverManager.getConnection("jdbc:sqlite:studentInfo.sqlite"); + //JOptionPane.showMessageDialog(null, "Connection to database is successful"); + + return conn; + + + }catch (Exception e){ + JOptionPane.showMessageDialog(null, e); + return null; + } + + } +} \ No newline at end of file diff --git a/Admission-counselling-system/src/student/information/system/images/Add.png b/Admission-counselling-system/src/student/information/system/images/Add.png new file mode 100644 index 00000000..04c46166 Binary files /dev/null and b/Admission-counselling-system/src/student/information/system/images/Add.png differ diff --git a/Admission-counselling-system/src/student/information/system/images/Presentation1.jpg b/Admission-counselling-system/src/student/information/system/images/Presentation1.jpg new file mode 100644 index 00000000..74a78a0c Binary files /dev/null and b/Admission-counselling-system/src/student/information/system/images/Presentation1.jpg differ diff --git a/Admission-counselling-system/src/student/information/system/images/Save-icon.png b/Admission-counselling-system/src/student/information/system/images/Save-icon.png new file mode 100644 index 00000000..fcc18dc7 Binary files /dev/null and b/Admission-counselling-system/src/student/information/system/images/Save-icon.png differ diff --git a/Admission-counselling-system/src/student/information/system/images/Search.png b/Admission-counselling-system/src/student/information/system/images/Search.png new file mode 100644 index 00000000..3838cfc4 Binary files /dev/null and b/Admission-counselling-system/src/student/information/system/images/Search.png differ diff --git a/Admission-counselling-system/src/student/information/system/images/Update.png b/Admission-counselling-system/src/student/information/system/images/Update.png new file mode 100644 index 00000000..c1312686 Binary files /dev/null and b/Admission-counselling-system/src/student/information/system/images/Update.png differ diff --git a/Admission-counselling-system/src/student/information/system/images/attach.png b/Admission-counselling-system/src/student/information/system/images/attach.png new file mode 100644 index 00000000..6310fa18 Binary files /dev/null and b/Admission-counselling-system/src/student/information/system/images/attach.png differ diff --git a/Admission-counselling-system/src/student/information/system/images/bk.jpg b/Admission-counselling-system/src/student/information/system/images/bk.jpg new file mode 100644 index 00000000..9116c7eb Binary files /dev/null and b/Admission-counselling-system/src/student/information/system/images/bk.jpg differ diff --git a/Admission-counselling-system/src/student/information/system/images/bk2.jpg b/Admission-counselling-system/src/student/information/system/images/bk2.jpg new file mode 100644 index 00000000..ece7844c Binary files /dev/null and b/Admission-counselling-system/src/student/information/system/images/bk2.jpg differ diff --git a/Admission-counselling-system/src/student/information/system/images/bk3.jpg b/Admission-counselling-system/src/student/information/system/images/bk3.jpg new file mode 100644 index 00000000..65aa2cb2 Binary files /dev/null and b/Admission-counselling-system/src/student/information/system/images/bk3.jpg differ diff --git a/Admission-counselling-system/src/student/information/system/images/bk4.jpg b/Admission-counselling-system/src/student/information/system/images/bk4.jpg new file mode 100644 index 00000000..af404351 Binary files /dev/null and b/Admission-counselling-system/src/student/information/system/images/bk4.jpg differ diff --git a/Admission-counselling-system/src/student/information/system/images/delete_16x16.gif b/Admission-counselling-system/src/student/information/system/images/delete_16x16.gif new file mode 100644 index 00000000..327af2a5 Binary files /dev/null and b/Admission-counselling-system/src/student/information/system/images/delete_16x16.gif differ diff --git a/Admission-counselling-system/src/student/information/system/images/erase-128.png b/Admission-counselling-system/src/student/information/system/images/erase-128.png new file mode 100644 index 00000000..9f86d130 Binary files /dev/null and b/Admission-counselling-system/src/student/information/system/images/erase-128.png differ diff --git a/Admission-counselling-system/src/student/information/system/images/logout.png b/Admission-counselling-system/src/student/information/system/images/logout.png new file mode 100644 index 00000000..35c88106 Binary files /dev/null and b/Admission-counselling-system/src/student/information/system/images/logout.png differ diff --git a/Admission-counselling-system/src/student/information/system/images/pnbennet.png b/Admission-counselling-system/src/student/information/system/images/pnbennet.png new file mode 100644 index 00000000..50fc3ae4 Binary files /dev/null and b/Admission-counselling-system/src/student/information/system/images/pnbennet.png differ diff --git a/Admission-counselling-system/src/student/information/system/images/update icon.png b/Admission-counselling-system/src/student/information/system/images/update icon.png new file mode 100644 index 00000000..3778d945 Binary files /dev/null and b/Admission-counselling-system/src/student/information/system/images/update icon.png differ diff --git a/Admission-counselling-system/src/student/information/system/users.form b/Admission-counselling-system/src/student/information/system/users.form new file mode 100644 index 00000000..3fbb8d45 --- /dev/null +++ b/Admission-counselling-system/src/student/information/system/users.form @@ -0,0 +1,266 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Admission-counselling-system/src/student/information/system/users.java b/Admission-counselling-system/src/student/information/system/users.java new file mode 100644 index 00000000..0b839355 --- /dev/null +++ b/Admission-counselling-system/src/student/information/system/users.java @@ -0,0 +1,471 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package student.information.system; + +/** + * + * @author Hyrex + */ +import java.awt.*; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import javax.swing.*; +public class users extends javax.swing.JFrame { +Connection conn=null; +ResultSet rs=null; +PreparedStatement pst=null; + /** + * Creates new form Users_details + */ + public users() { + initComponents(); + conn=db.java_db(); + Toolkit toolkit = getToolkit(); + Dimension size = toolkit.getScreenSize(); + setLocation(size.width/2 - getWidth()/2, + size.height/2 - getHeight()/2); + Fillcombobox(); + } +private void Fillcombobox(){ + + try { + String sql ="select * from Users"; + pst=conn.prepareStatement(sql); + rs=pst.executeQuery(); + + while(rs.next()) { + String name =rs.getString("username"); + txt_combo.addItem(name); + } + }catch (Exception e){ + + JOptionPane.showMessageDialog(null, e); + } finally { + + try{ + rs.close(); + pst.close(); + + }catch (Exception e){ + + } + } + + } + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jPanel2 = new javax.swing.JPanel(); + cmd_add = new javax.swing.JButton(); + jPanel1 = new javax.swing.JPanel(); + jLabel1 = new javax.swing.JLabel(); + txt_password = new javax.swing.JTextField(); + txt_combo = new javax.swing.JComboBox(); + jLabel3 = new javax.swing.JLabel(); + txt_username = new javax.swing.JTextField(); + jLabel2 = new javax.swing.JLabel(); + jLabel4 = new javax.swing.JLabel(); + txt_id = new javax.swing.JTextField(); + jLabel5 = new javax.swing.JLabel(); + txt_dep = new javax.swing.JTextField(); + cmd_delete = new javax.swing.JButton(); + cmd_update = new javax.swing.JButton(); + jButton1 = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + + cmd_add.setIcon(new javax.swing.ImageIcon(getClass().getResource("/student/information/system/images/Save-icon.png"))); // NOI18N + cmd_add.setText("Add "); + cmd_add.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + cmd_addActionPerformed(evt); + } + }); + + jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Login_Information", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Adobe Arabic", 1, 18))); // NOI18N + + jLabel1.setText("Select Users"); + + txt_combo.addPopupMenuListener(new javax.swing.event.PopupMenuListener() { + public void popupMenuCanceled(javax.swing.event.PopupMenuEvent evt) { + } + public void popupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent evt) { + txt_comboPopupMenuWillBecomeInvisible(evt); + } + public void popupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent evt) { + } + }); + + jLabel3.setText("Password"); + + jLabel2.setText("Username"); + + jLabel4.setText("Id"); + + txt_id.setEditable(false); + + jLabel5.setText("Division"); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.LEADING)) + .addGap(29, 29, 29)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jLabel5) + .addGap(20, 20, 20))) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel4) + .addComponent(jLabel1)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(txt_dep) + .addComponent(txt_password, javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(txt_username, javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(txt_combo, javax.swing.GroupLayout.Alignment.LEADING, 0, 160, Short.MAX_VALUE) + .addComponent(txt_id, javax.swing.GroupLayout.Alignment.LEADING)) + .addContainerGap(42, Short.MAX_VALUE)) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap(25, Short.MAX_VALUE) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(txt_combo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel1)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(txt_id, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel4)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel5) + .addComponent(txt_dep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(txt_username, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel2)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(txt_password, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel3)) + .addContainerGap()) + ); + + cmd_delete.setIcon(new javax.swing.ImageIcon(getClass().getResource("/student/information/system/images/delete_16x16.gif"))); // NOI18N + cmd_delete.setText("Delete"); + cmd_delete.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + cmd_deleteActionPerformed(evt); + } + }); + + cmd_update.setIcon(new javax.swing.ImageIcon(getClass().getResource("/student/information/system/images/update icon.png"))); // NOI18N + cmd_update.setText("Update"); + cmd_update.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + cmd_updateActionPerformed(evt); + } + }); + + jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/student/information/system/images/erase-128.png"))); // NOI18N + jButton1.setText("Clear"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); + jPanel2.setLayout(jPanel2Layout); + jPanel2Layout.setHorizontalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGap(18, 18, 18) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(cmd_add, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(cmd_delete, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(cmd_update, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap(40, Short.MAX_VALUE)) + ); + jPanel2Layout.setVerticalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGap(48, 48, 48) + .addComponent(cmd_add) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(cmd_update) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(cmd_delete) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jButton1)) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGap(28, 28, 28) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(11, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(27, 27, 27) + .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + pack(); + }// //GEN-END:initComponents + + private void cmd_deleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmd_deleteActionPerformed + // TODO add your handling code here: + + int p = JOptionPane.showConfirmDialog(null, "Are you sure you want to delete record?","Delete",JOptionPane.YES_NO_OPTION); + if(p==0){ + String sql ="delete from Users where username=? "; + try{ + pst=conn.prepareStatement(sql); + pst.setString(1, txt_username.getText()); + pst.execute(); + JOptionPane.showMessageDialog(null,"Record Deleted"); + + + }catch(Exception e){ + + JOptionPane.showMessageDialog(null, e); + }finally { + + try{ + rs.close(); + pst.close(); + + } + catch(Exception e){ + + } + } + + } + Fillcombobox(); + }//GEN-LAST:event_cmd_deleteActionPerformed + + private void txt_comboPopupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent evt) {//GEN-FIRST:event_txt_comboPopupMenuWillBecomeInvisible + + String tmp =(String) txt_combo.getSelectedItem(); + String sql="select * from Users where username=?"; + + + try{ + pst=conn.prepareStatement(sql); + pst.setString(1, tmp); + rs=pst.executeQuery(); + + if(rs.next()){ + + String add1 =rs.getString("username"); + txt_username.setText(add1); + + String add2 =rs.getString("password"); + txt_password.setText(add2); + + String add3 =rs.getString("id"); + txt_id.setText(add3); + + String add4 =rs.getString("division"); + txt_dep.setText(add4); + + + } + + }catch (Exception e){ + JOptionPane.showMessageDialog(null, e); + } + finally { + + try{ + rs.close(); + pst.close(); + + } + catch(Exception e){ + + } + }// TODO add your handling code here: + + + }//GEN-LAST:event_txt_comboPopupMenuWillBecomeInvisible + + private void cmd_updateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmd_updateActionPerformed + // TODO add your handling code here: + int p = JOptionPane.showConfirmDialog(null, "Are you sure you want to update record?","Update Record",JOptionPane.YES_NO_OPTION); + if(p==0){ + try{ + + String value1 = txt_id.getText(); + String value2 = txt_username.getText(); + String value3 = txt_password.getText(); + String value4 = txt_dep.getText(); + + + String sql= "update Users set id='"+value1+"', username='"+value2+"', password='"+value3+"',division='"+value4+"' where id='"+value1+"' "; + + pst=conn.prepareStatement(sql); + pst.execute(); + JOptionPane.showMessageDialog(null, "Record Updated"); + + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e); + } + finally { + + try{ + rs.close(); + pst.close(); + + } + catch(Exception e){ + + } + } + } + Fillcombobox(); + }//GEN-LAST:event_cmd_updateActionPerformed + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + // TODO add your handling code here: + txt_username.setText(""); + txt_password.setText(""); + txt_dep.setText(""); + txt_id.setText(""); + }//GEN-LAST:event_jButton1ActionPerformed + + private void cmd_addActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmd_addActionPerformed + int p = JOptionPane.showConfirmDialog(null, "Are you sure you want to add record?","Add Record",JOptionPane.YES_NO_OPTION); + if(p==0){ // TODO add your handling code here: + + try { + + String sql ="insert into Users (username,password,division) values (?,?,?) "; + + pst=conn.prepareStatement(sql); + pst.setString(1,txt_username.getText()); + pst.setString(2,txt_password.getText()); + pst.setString(3,txt_dep.getText()); + + pst.execute(); + JOptionPane.showMessageDialog(null,"Data is saved successfully"); + + } + catch (Exception e) + + { + JOptionPane.showMessageDialog(null,e); + } + finally { + + try{ + rs.close(); + pst.close(); + + } + catch(Exception e){ + + } + } + } + Fillcombobox(); + }//GEN-LAST:event_cmd_addActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(users.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(users.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(users.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(users.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + // + // + // + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new users().setVisible(true); + } + }); + } + + + + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton cmd_add; + private javax.swing.JButton cmd_delete; + private javax.swing.JButton cmd_update; + private javax.swing.JButton jButton1; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private javax.swing.JComboBox txt_combo; + private javax.swing.JTextField txt_dep; + private javax.swing.JTextField txt_id; + private javax.swing.JTextField txt_password; + private javax.swing.JTextField txt_username; + // End of variables declaration//GEN-END:variables +} diff --git a/Admission-counselling-system/studentInfo.sqlite b/Admission-counselling-system/studentInfo.sqlite new file mode 100644 index 00000000..3e4485b0 Binary files /dev/null and b/Admission-counselling-system/studentInfo.sqlite differ diff --git a/Age_Frame_Calculator.java b/Age_Frame_Calculator.java new file mode 100644 index 00000000..8e642e9c --- /dev/null +++ b/Age_Frame_Calculator.java @@ -0,0 +1,64 @@ +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.time.LocalDate; +import java.time.Period; + +public class AgeCalculatorApp { + public static void main(String[] args) { + SwingUtilities.invokeLater(() -> { + createAndShowGUI(); + }); + } + + private static void createAndShowGUI() { + JFrame frame = new JFrame("Age Calculator"); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + JPanel panel = new JPanel(); + panel.setLayout(new GridLayout(3, 2)); + + JLabel birthDateLabel = new JLabel("Enter Birthdate (yyyy-mm-dd): "); + JTextField birthDateField = new JTextField(); + JLabel ageLabel = new JLabel("Your Age: "); + JLabel ageResult = new JLabel(""); + JLabel remainingDaysLabel = new JLabel("Remaining Days Until Next Birthday: "); + JLabel remainingDaysResult = new JLabel(""); + + JButton calculateButton = new JButton("Calculate"); + + calculateButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + String birthDateText = birthDateField.getText(); + LocalDate birthDate = LocalDate.parse(birthDateText); + LocalDate currentDate = LocalDate.now(); + + Period age = Period.between(birthDate, currentDate); + ageResult.setText(age.getYears() + " years, " + age.getMonths() + " months, " + age.getDays() + " days"); + + LocalDate nextBirthday = birthDate.withYear(currentDate.getYear()); + if (nextBirthday.isBefore(currentDate) || nextBirthday.isEqual(currentDate)) { + nextBirthday = nextBirthday.plusYears(1); + } + + Period remainingDays = Period.between(currentDate, nextBirthday); + remainingDaysResult.setText(remainingDays.getDays() + " days"); + } + }); + + panel.add(birthDateLabel); + panel.add(birthDateField); + panel.add(ageLabel); + panel.add(ageResult); + panel.add(remainingDaysLabel); + panel.add(remainingDaysResult); + + frame.getContentPane().add(panel, BorderLayout.CENTER); + frame.getContentPane().add(calculateButton, BorderLayout.SOUTH); + + frame.pack(); + frame.setVisible(true); + } +} diff --git a/AirlineReservationSystem.java b/AirlineReservationSystem.java new file mode 100644 index 00000000..d5dbe903 --- /dev/null +++ b/AirlineReservationSystem.java @@ -0,0 +1,147 @@ +import java.util.ArrayList; +import java.util.List; +import java.util.Scanner; + +class Passenger { + private String name; + private int age; + private String passportNumber; + + public Passenger(String name, int age, String passportNumber) { + this.name = name; + this.age = age; + this.passportNumber = passportNumber; + } + + public String getName() { + return name; + } + + @Override + public String toString() { + return "Name: " + name + ", Age: " + age + ", Passport Number: " + passportNumber; + } +} + +class Flight { + private String flightNumber; + private String destination; + private int availableSeats; + private List passengers; + + public Flight(String flightNumber, String destination, int availableSeats) { + this.flightNumber = flightNumber; + this.destination = destination; + this.availableSeats = availableSeats; + this.passengers = new ArrayList<>(); + } + + public String getFlightNumber() { + return flightNumber; + } + + public String getDestination() { + return destination; + } + + public int getAvailableSeats() { + return availableSeats; + } + + public List getPassengers() { + return passengers; + } + + public boolean bookSeat(Passenger passenger) { + if (availableSeats > 0) { + passengers.add(passenger); + availableSeats--; + return true; + } + return false; + } + + @Override + public String toString() { + return "Flight Number: " + flightNumber + ", Destination: " + destination + ", Available Seats: " + availableSeats; + } +} + +public class AirlineReservationSystem { + private static List flights = new ArrayList<>(); + + public static void main(String[] args) { + initializeFlights(); + Scanner scanner = new Scanner(System.in); + + while (true) { + System.out.println("Airline Reservation System Menu:"); + System.out.println("1. List Available Flights"); + System.out.println("2. Book a Flight"); + System.out.println("3. Exit"); + System.out.print("Enter your choice: "); + + int choice = scanner.nextInt(); + scanner.nextLine(); // Consume the newline character + + switch (choice) { + case 1: + listAvailableFlights(); + break; + case 2: + bookAFlight(scanner); + break; + case 3: + System.out.println("Exiting the program. Thank you!"); + scanner.close(); + System.exit(0); + default: + System.out.println("Invalid choice. Please enter a valid option."); + } + } + } + + private static void initializeFlights() { + flights.add(new Flight("F101", "New York", 100)); + flights.add(new Flight("F102", "Los Angeles", 120)); + flights.add(new Flight("F103", "Chicago", 90)); + } + + private static void listAvailableFlights() { + System.out.println("Available Flights:"); + for (Flight flight : flights) { + System.out.println(flight); + } + } + + private static void bookAFlight(Scanner scanner) { + System.out.print("Enter your name: "); + String name = scanner.nextLine(); + System.out.print("Enter your age: "); + int age = scanner.nextInt(); + scanner.nextLine(); // Consume the newline character + System.out.print("Enter your passport number: "); + String passportNumber = scanner.nextLine(); + System.out.print("Enter the flight number you want to book: "); + String flightNumber = scanner.nextLine(); + + Flight selectedFlight = null; + for (Flight flight : flights) { + if (flight.getFlightNumber().equalsIgnoreCase(flightNumber)) { + selectedFlight = flight; + break; + } + } + + if (selectedFlight != null) { + Passenger passenger = new Passenger(name, age, passportNumber); + if (selectedFlight.bookSeat(passenger)) { + System.out.println("Seat booked successfully!"); + } else { + System.out.println("Sorry, the flight is fully booked."); + } + } else { + System.out.println("Invalid flight number. Please enter a valid flight number."); + } + } +} diff --git a/Alaram_clock.java b/Alaram_clock.java new file mode 100644 index 00000000..7786dff3 --- /dev/null +++ b/Alaram_clock.java @@ -0,0 +1,25 @@ +import java.util.Timer; +import java.util.TimerTask; +import java.text.SimpleDateFormat; +import java.util.Date; + +public class AlarmClock { + + public static void main(String[] args) { + // Set the alarm time (24-hour format) + String alarmTime = "15:30"; // Change this to your desired alarm time + + // Create a timer + Timer timer = new Timer(); + + // Define a task to be executed when the alarm time is reached + TimerTask task = new TimerTask() { + public void run() { + SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); + String currentTime = sdf.format(new Date()); + if (currentTime.equals(alarmTime)) { + System.out.println("Alarm! It's time to wake up!"); + // You can replace the message with any action you want + } + } + }; diff --git a/Analog Clock.java b/Analog Clock.java new file mode 100644 index 00000000..95c08ec0 --- /dev/null +++ b/Analog Clock.java @@ -0,0 +1,73 @@ +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Calendar; +import java.util.GregorianCalendar; + +public class AnalogClock extends JPanel { + private int radius; + private int centerX; + private int centerY; + + public AnalogClock(int radius) { + this.radius = radius; + this.setPreferredSize(new Dimension(2 * radius, 2 * radius)); + Timer timer = new Timer(1000, new ClockListener()); + timer.start(); + } + + private class ClockListener implements ActionListener { + @Override + public void actionPerformed(ActionEvent e) { + repaint(); + } + } + + private void drawClockHand(Graphics g, int handLength, int angle, int value) { + int x = (int) (centerX + handLength * Math.sin(Math.toRadians(angle))); + int y = (int) (centerY - handLength * Math.cos(Math.toRadians(angle))); + g.drawLine(centerX, centerY, x, y); + if (value != -1) { + g.drawString(Integer.toString(value), x, y); + } + } + + @Override + protected void paintComponent(Graphics g) { + super.paintComponent(g); + centerX = getWidth() / 2; + centerY = getHeight() / 2; + + Calendar now = new GregorianCalendar(); + int hour = now.get(Calendar.HOUR); + int minute = now.get(Calendar.MINUTE); + int second = now.get(Calendar.SECOND); + + g.setColor(Color.BLACK); + g.drawOval(centerX - radius, centerY - radius, 2 * radius, 2 * radius); + g.drawString("12", centerX - 5, centerY - radius + 15); + g.drawString("3", centerX + radius - 10, centerY + 5); + g.drawString("6", centerX - 5, centerY + radius - 5); + g.drawString("9", centerX - radius + 5, centerY + 5); + + int hourAngle = (360 / 12) * (hour % 12) - 90; + int minuteAngle = (360 / 60) * minute - 90; + int secondAngle = (360 / 60) * second - 90; + + g.setColor(Color.BLUE); + drawClockHand(g, (int) (0.5 * radius), hourAngle, hour); + g.setColor(Color.GREEN); + drawClockHand(g, (int) (0.8 * radius), minuteAngle, minute); + g.setColor(Color.RED); + drawClockHand(g, (int) (0.9 * radius), secondAngle, second); + } + + public static void main(String[] args) { + JFrame frame = new JFrame("Analog Clock"); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.add(new AnalogClock(200)); + frame.pack(); + frame.setVisible(true); + } +} diff --git a/AnimationDemo.py b/AnimationDemo.py new file mode 100644 index 00000000..80a05263 --- /dev/null +++ b/AnimationDemo.py @@ -0,0 +1,33 @@ +from tkinter import * # Import tkinter + +class AnimationDemo: + def __init__(self): + window = Tk() # Create a window + window.title("Animation Demo") # Set a title + + width = 250 # Width of the canvas + canvas = Canvas(window, bg = "white", + width = 250, height = 50) + canvas.pack() + + x = 0 # Starting x position + canvas.create_text(x, 30, + text = "Message moving?", tags = "text") + + dx = 3 + while True: + canvas.move("text", dx, 0) # Move text dx unit + canvas.after(100) # Sleep for 100 milliseconds + canvas.update() # Update canvas + if x < width: + x += dx # Get the current position for string + else: + x = 0 # Reset string position to the beginning + canvas.delete("text") + # Redraw text at the beginning + canvas.create_text(x, 30, text = "Message moving?", + tags = "text") + + window.mainloop() # Create an event loop + +AnimationDemo() # Create GUI \ No newline at end of file diff --git a/AppletAnalogClock.java b/AppletAnalogClock.java new file mode 100644 index 00000000..5464e050 --- /dev/null +++ b/AppletAnalogClock.java @@ -0,0 +1,101 @@ +import java.applet.*; +import java.awt.*; +import java.util.*; +import java.text.*; + +public class MyClock extends Applet implements Runnable { + + int width, height; + Thread t = null; + boolean threadSuspended; + int hours=0, minutes=0, seconds=0; + String timeString = ""; + + public void init() { + width = getSize().width; + height = getSize().height; + setBackground( Color.black ); + } + + public void start() { + if ( t == null ) { + t = new Thread( this ); + t.setPriority( Thread.MIN_PRIORITY ); + threadSuspended = false; + t.start(); + } + else { + if ( threadSuspended ) { + threadSuspended = false; + synchronized( this ) { + notify(); + } + } + } + } + + public void stop() { + threadSuspended = true; + } + + public void run() { + try { + while (true) { + + Calendar cal = Calendar.getInstance(); + hours = cal.get( Calendar.HOUR_OF_DAY ); + if ( hours > 12 ) hours -= 12; + minutes = cal.get( Calendar.MINUTE ); + seconds = cal.get( Calendar.SECOND ); + + SimpleDateFormat formatter + = new SimpleDateFormat( "hh:mm:ss", Locale.getDefault() ); + Date date = cal.getTime(); + timeString = formatter.format( date ); + + // Now the thread checks to see if it should suspend itself + if ( threadSuspended ) { + synchronized( this ) { + while ( threadSuspended ) { + wait(); + } + } + } + repaint(); + t.sleep( 1000 ); // interval specified in milliseconds + } + } + catch (Exception e) { } + } + + void drawHand( double angle, int radius, Graphics g ) { + angle -= 0.5 * Math.PI; + int x = (int)( radius*Math.cos(angle) ); + int y = (int)( radius*Math.sin(angle) ); + g.drawLine( width/2, height/2, width/2 + x, height/2 + y ); + } + + void drawWedge( double angle, int radius, Graphics g ) { + angle -= 0.5 * Math.PI; + int x = (int)( radius*Math.cos(angle) ); + int y = (int)( radius*Math.sin(angle) ); + angle += 2*Math.PI/3; + int x2 = (int)( 5*Math.cos(angle) ); + int y2 = (int)( 5*Math.sin(angle) ); + angle += 2*Math.PI/3; + int x3 = (int)( 5*Math.cos(angle) ); + int y3 = (int)( 5*Math.sin(angle) ); + g.drawLine( width/2+x2, height/2+y2, width/2 + x, height/2 + y ); + g.drawLine( width/2+x3, height/2+y3, width/2 + x, height/2 + y ); + g.drawLine( width/2+x2, height/2+y2, width/2 + x3, height/2 + y3 ); + } + + public void paint( Graphics g ) { + g.setColor( Color.gray ); + drawWedge( 2*Math.PI * hours / 12, width/5, g ); + drawWedge( 2*Math.PI * minutes / 60, width/3, g ); + drawHand( 2*Math.PI * seconds / 60, width/2, g ); + g.setColor( Color.white ); + g.drawString( timeString, 10, height-10 ); + } +} diff --git a/AppletCom.java b/AppletCom.java new file mode 100644 index 00000000..371f046f --- /dev/null +++ b/AppletCom.java @@ -0,0 +1,21 @@ +import java.applet.*; +import java.awt.*; +import java.awt.event.*; +public class ContextApplet extends Applet implements ActionListener{ +Button b; + +public void init(){ +b=new Button("Click"); +b.setBounds(50,50,60,50); + +add(b); +b.addActionListener(this); +} + +public void actionPerformed(ActionEvent e){ + +AppletContext ctx=getAppletContext(); +Applet a=ctx.getApplet("app2"); +a.setBackground(Color.yellow); +} +} diff --git a/Ascii_art/README.md b/Ascii_art/README.md new file mode 100644 index 00000000..b7bb3326 --- /dev/null +++ b/Ascii_art/README.md @@ -0,0 +1,30 @@ +# ascii-art + +## Description +This Project will take an image and print out an [ASCII-art](https://en.wikipedia.org/wiki/ASCII_art). + +## About this Project +This project uses [opencv](https://www.opencv.org) to process image and [numpy](https://numpy.org) to manipulate arrays. The Image is numerically coded for different threshold regions it comes under and for each coded regions , a symbol is used for printing it out in the stdout. + +## Usage +Use the Script [make_art.py](https://github.com/Shiny-Akash/python-mini-projects/blob/ascii-art/projects/asciiart/make_art.py) . +In the command line, Enter + +`python3 make_art.py [image_path]` + +Replace the `[image_path]` with the image you want to do ascii-art. By default it takes [sample_image.png](https://github.com/Shiny-Akash/python-mini-projects/blob/ascii-art/projects/asciiart/sample_image.png) + +## Customization +There are two things you can customize in [make_art.py](https://github.com/Shiny-Akash/python-mini-projects/blob/ascii-art/projects/asciiart/make_art.py). + +* `symbols_list` +* `threshold_list` + +Modify the threshold list to take **different threshold values** thereby changing the patterns in the printed image. +Modify the symbols list to substitute **different symbols** in the coded patterns. + +## Sample +Input Image : +![input_image](sample_image.png) +Output : +![output_image](sample_output.png) diff --git a/Ascii_art/make_art.py b/Ascii_art/make_art.py new file mode 100644 index 00000000..f966d676 --- /dev/null +++ b/Ascii_art/make_art.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python3 + +import cv2 +import numpy as np + +import sys + +symbols_list = ["#", "-", "*", ".", "+", "o"] +threshold_list = [0, 50, 100, 150, 200] + +def print_out_ascii(array): + """prints the coded image with symbols""" + + for row in array: + for e in row: + # select symbol based on the type of coding + print(symbols_list[int(e) % len(symbols_list)], end="") + print() + + +def img_to_ascii(image): + """returns the numeric coded image""" + + # resizing parameters + # adjust these parameters if the output doesn't fit to the screen + height, width = image.shape + new_width = int(width / 20) + new_height = int(height / 40) + + # resize image to fit the printing screen + resized_image = cv2.resize(image, (new_width, new_height),) + + thresh_image = np.zeros(resized_image.shape) + + for i, threshold in enumerate(threshold_list): + # assign corresponding values according to the index of threshold applied + thresh_image[resized_image > threshold] = i + return thresh_image + + +if __name__ == "__main__": + + if len(sys.argv) < 2: + print("Image Path not specified : Using sample_image.png\n") + image_path = "sample_image.png" # default image path + + if len(sys.argv) == 2: + print("Using {} as Image Path\n".format(sys.argv[1])) + image_path = sys.argv[1] + + image = cv2.imread(image_path, 0) # read image + + ascii_art = img_to_ascii(image) + print_out_ascii(ascii_art) diff --git a/Ascii_art/requirements.txt b/Ascii_art/requirements.txt new file mode 100644 index 00000000..eeb7194f --- /dev/null +++ b/Ascii_art/requirements.txt @@ -0,0 +1,2 @@ +opencv-python==4.3.0.36 +numpy==1.19.1 diff --git a/Ascii_art/sample_image.png b/Ascii_art/sample_image.png new file mode 100644 index 00000000..7a0af276 Binary files /dev/null and b/Ascii_art/sample_image.png differ diff --git a/Ascii_art/sample_output.png b/Ascii_art/sample_output.png new file mode 100644 index 00000000..b3b20fee Binary files /dev/null and b/Ascii_art/sample_output.png differ diff --git a/Authentication System b/Authentication System new file mode 100644 index 00000000..56e93223 --- /dev/null +++ b/Authentication System @@ -0,0 +1,47 @@ +import java.util.HashMap; +import java.util.Map; + +public class AuthenticationSystem { + + private Map users; + + public AuthenticationSystem() { + this.users = new HashMap<>(); + } + + public void registerUser(User user) { + this.users.put(user.getUsername(), user); + } + + public User login(String username, String password) { + User user = this.users.get(username); + if (user != null && user.isAuthenticated(password)) { + return user; + } else { + return null; + } + } + + public static class User { + + private String username; + private String password; + + public User(String username, String password) { + this.username = username; + this.password = password; + } + + public String getUsername() { + return username; + } + + public String getPassword() { + return password; + } + + public boolean isAuthenticated(String password) { + return this.password.equals(password); + } + } +} diff --git a/AwtMouseListener.java b/AwtMouseListener.java new file mode 100644 index 00000000..4f09c6d9 --- /dev/null +++ b/AwtMouseListener.java @@ -0,0 +1,33 @@ +import java.awt.*; +import java.awt.event.*; +public class MouseListenerExample extends Frame implements MouseListener{ + Label l; + MouseListenerExample(){ + addMouseListener(this); + + l=new Label(); + l.setBounds(20,50,100,20); + add(l); + setSize(300,300); + setLayout(null); + setVisible(true); + } + public void mouseClicked(MouseEvent e) { + l.setText("Mouse Clicked"); + } + public void mouseEntered(MouseEvent e) { + l.setText("Mouse Entered"); + } + public void mouseExited(MouseEvent e) { + l.setText("Mouse Exited"); + } + public void mousePressed(MouseEvent e) { + l.setText("Mouse Pressed"); + } + public void mouseReleased(MouseEvent e) { + l.setText("Mouse Released"); + } +public static void main(String[] args) { + new MouseListenerExample(); +} +} diff --git a/BMI Calculator b/BMI Calculator new file mode 100644 index 00000000..b4bb139e --- /dev/null +++ b/BMI Calculator @@ -0,0 +1,39 @@ + +class Complex{ + int real; + int img; + Complex(){ + + } + Complex(int real,int img){ + this.real=real; + this.img=img; + } + void display() { + System.out.println(real+" + i"+img); + } + Complex add(Complex c1,Complex c2) { + Complex temp=new Complex(); + temp.real=c1.real+c2.real; + temp.img=c1.img+c2.img; + return temp; + + + } + +} +public class q3 { + + public static void main(String[] args) { + Complex c=new Complex(10,20); + Complex c1=new Complex(20,30); + Complex c3=new Complex(); + c3=c1.add(c1, c); + + c1.display(); + c.display(); + c3.display(); + + } + +} diff --git a/BMI.java b/BMI.java new file mode 100644 index 00000000..e97e22a3 --- /dev/null +++ b/BMI.java @@ -0,0 +1,14 @@ +import java.util.Scanner; +public class Example { + public static void main(String args[]) { + Scanner sc = new Scanner(System.in); + System.out.print("Input weight in kilogram: "); + double weight = sc.nextDouble(); + System.out.print(" +Input height in meters: "); + double height = sc.nextDouble(); + double BMI = weight / (height * height); + System.out.print(" +The Body Mass Index (BMI) is " + BMI + " kg/m2"); + } +} diff --git a/BMI.py b/BMI.py new file mode 100644 index 00000000..2c86fc0f --- /dev/null +++ b/BMI.py @@ -0,0 +1,37 @@ +class BMI: + def __init__(self, name, age, weight, height): + self.__name = name + self.__age = age + self.__weight = weight + self.__height = height + + def getBMI(self): + KILOGRAMS_PER_POUND = 0.45359237 + METERS_PER_INCH = 0.0254 + bmi = self.__weight * KILOGRAMS_PER_POUND / \ + ((self.__height * METERS_PER_INCH) * \ + (self.__height * METERS_PER_INCH)) + return round(bmi * 100) / 100 + + def getStatus(self): + bmi = self.getBMI() + if bmi < 18.5: + return "Underweight" + elif bmi < 25: + return "Normal" + elif bmi < 30: + return "Overweight" + else: + return "Obese" + + def getName(self): + return self.__name + + def getAge(self): + return self.__age + + def getWeight(self): + return self.__weight + + def getHeight(self): + return self.__height diff --git a/BMI.pyc b/BMI.pyc new file mode 100644 index 00000000..56b34df0 Binary files /dev/null and b/BMI.pyc differ diff --git a/BMI_calculator.java b/BMI_calculator.java new file mode 100644 index 00000000..c4221550 --- /dev/null +++ b/BMI_calculator.java @@ -0,0 +1,40 @@ +import java.util.Scanner; + +public class BMICalculator { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + + System.out.println("BMI Calculator"); + System.out.println("---------------"); + + System.out.print("Enter your weight in kilograms: "); + double weight = scanner.nextDouble(); + + System.out.print("Enter your height in meters: "); + double height = scanner.nextDouble(); + + double bmi = calculateBMI(weight, height); + + System.out.println("\nYour BMI is: " + bmi); + interpretBMI(bmi); + + scanner.close(); + } + + public static double calculateBMI(double weight, double height) { + return weight / (height * height); + } + + public static void interpretBMI(double bmi) { + System.out.print("BMI Interpretation: "); + if (bmi < 18.5) { + System.out.println("Underweight"); + } else if (bmi < 25) { + System.out.println("Normal Weight"); + } else if (bmi < 30) { + System.out.println("Overweight"); + } else { + System.out.println("Obese"); + } + } +} diff --git a/BSTVisualization.java b/BSTVisualization.java new file mode 100644 index 00000000..21a30550 --- /dev/null +++ b/BSTVisualization.java @@ -0,0 +1,540 @@ + +import java.util.*; +import javax.swing.*; +import java.awt.*; +import java.awt.event.*; + +public class BSTVisualization extends JFrame implements ActionListener, KeyListener { + // Tree Root Node. + private Node root; + + // private Color color; + private JPanel topPanel, treePanel, infoPanel; + private JPanel topLeftPanel, topRightPanel; + private JButton btnAdd, btnDelete; + private JTextField tf; + private int X = 300, Y = 75; + private Graphics2D g2; + private Rectangle size; + private JLabel labelInorder, labelPreorder, labelPostorder, labelHeight; + private JLabel ansInorder, ansPreorder, ansPostorder, ansHeight; + private FontMetrics fontMatrix; + + //Node Structure + private static class Node { + static int TEXT_WIDTH = 40; + static int TEXT_HEIGHT = 40; + + JLabel data; + Node left; + Node right; + Points p; + + Node(int info) { + data = new JLabel(info + "", SwingConstants.CENTER); + data.setFont(new Font("Arial", Font.BOLD, 20)); + data.setBorder(BorderFactory.createLineBorder(Color.black)); + data.setOpaque(true); + data.setBackground(Color.green); + p = null; + } + } + + //Points structure + private static class Points { + int x1 = 0, x2 = 0, y2 = 0, y1 = 0; + + Points(int x1, int y1, int x2, int y2) { + this.x1 = x1; + this.x2 = x2; + this.y2 = y2; + this.y1 = y1; + } + + public String toString() { + return "x1 = " + x1 + ", y1 = " + y1 + ", x2 = " + x2 + ", y2 = " + y2; + } + } + + // For storing the Height of the root,left and right child height. + private static class Height { + int root, left, right; + + Height() { + this.root = 0; + this.left = 0; + this.right = 0; + } + + Height(int left, int right) { + this.left = left; + this.right = right; + } + + @Override + public String toString() { + return Integer.toString(this.root); + } + } + + public void paint(Graphics g) { + super.paintComponents(g); + + g2 = (Graphics2D) g; + g2.setStroke(new BasicStroke(3.0f)); + + Stack s = new Stack<>(); + Node curr = root; + Points pts; + int offset = topPanel.getBounds().height; + while (!s.isEmpty() || curr != null) { + while (curr != null) { + s.push(curr); + curr = curr.left; + } + if (!s.isEmpty()) + curr = s.pop(); + pts = curr.p; + g2.drawLine(pts.x1 + 7, pts.y1 + 30 + offset, pts.x2 + 3, pts.y2 + 10 + offset); + curr = curr.right; + } + + // x1 = label.getX()+7 + // y1 = label.getY()+30 + } + + public BSTVisualization() { + // Initialize the frame. + initialize(); + } + + private void initialize() { + + // setLayout(null); // layout + setSize(1200, 700); //frame size + + size = getBounds(); + X = size.width / 2; + + topPanel = new JPanel(new BorderLayout()); + Rectangle top = topPanel.getBounds(); + + topLeftPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 10, 10)); + topPanel.add(topLeftPanel, BorderLayout.WEST); + + topRightPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); + topPanel.add(topRightPanel, BorderLayout.EAST); + + treePanel = new JPanel(null); + treePanel.setPreferredSize(new Dimension(size.width, size.height - 300)); + + infoPanel = new JPanel(); + infoPanel.setLayout(new BoxLayout(infoPanel, BoxLayout.Y_AXIS)); + infoPanel.setPreferredSize(new Dimension(size.width, 200)); + + // Height of BST label + labelHeight = new JLabel("BST Height : "); + labelHeight.setFont(new Font("Calibri", Font.BOLD, 20)); + topLeftPanel.add(labelHeight); + + // Height of BST answer + ansHeight = new JLabel("0"); + ansHeight.setFont(new Font("Calibri", Font.BOLD, 20)); + ansHeight.setPreferredSize(new Dimension(50, 30)); + topLeftPanel.add(ansHeight); + + //For geting data. + tf = new JTextField(""); + tf.setFont(new Font("Arial", Font.BOLD, 20)); + tf.setPreferredSize(new Dimension(150, 30)); + tf.addKeyListener(this); + topRightPanel.add(tf); + + //Add Button + btnAdd = new JButton("Add"); + btnAdd.setFont(new Font("Arial", Font.BOLD, 20)); + // btnAdd.setBounds(size.width - 130, 20, 100, 30); + btnAdd.addActionListener(this); + topRightPanel.add(btnAdd); + + //Delete Button + btnDelete = new JButton("Delete"); + btnDelete.setFont(new Font("Arial", Font.BOLD, 20)); + // btnDelete.setBounds(size.width - 130, 60, 100, 30); + btnDelete.addActionListener(this); + topRightPanel.add(btnDelete); + + // Inorder label + labelInorder = new JLabel("Inorder :"); + labelInorder.setFont(new Font("Times New Roman", Font.BOLD, 20)); + infoPanel.add(labelInorder); + + infoPanel.add(Box.createRigidArea(new Dimension(7, 5))); + + // Inorder traversal answer + ansInorder = new JLabel("BST is empty."); + ansInorder.setFont(new Font("Arial", Font.PLAIN, 18)); + infoPanel.add(ansInorder); + + infoPanel.add(Box.createRigidArea(new Dimension(7, 15))); + + // Preorder label + labelPreorder = new JLabel("Preorder :"); + labelPreorder.setFont(new Font("Times New Roman", Font.BOLD, 20)); + infoPanel.add(labelPreorder); + + infoPanel.add(Box.createRigidArea(new Dimension(7, 5))); + + // Preorder traversal answer + ansPreorder = new JLabel("BST is empty."); + ansPreorder.setFont(new Font("Arial", Font.PLAIN, 18)); + infoPanel.add(ansPreorder); + + infoPanel.add(Box.createRigidArea(new Dimension(7, 15))); + + // Postorder label + labelPostorder = new JLabel("Postorder :"); + labelPostorder.setFont(new Font("Times New Roman", Font.BOLD, 20)); + infoPanel.add(labelPostorder); + + // Postorder traversal answer + ansPostorder = new JLabel("BST is empty."); + ansPostorder.setFont(new Font("Arial", Font.PLAIN, 18)); + infoPanel.add(ansPostorder); + + tf.requestFocusInWindow(); + + add(topPanel, BorderLayout.NORTH); + add(treePanel, BorderLayout.CENTER); + add(infoPanel, BorderLayout.SOUTH); + + setTitle("Binary Search Tree Visualization"); //Title Frame + setResizable(false); + setLocationRelativeTo(null); + setVisible(true); + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + } + + @Override + public void actionPerformed(ActionEvent evt) { + if (tf.isEnabled()) { + try { + int data = Integer.parseInt(tf.getText()); + if (evt.getSource() == btnAdd) { + add(data); + } else { + delete(data); + } + tf.setText(""); + tf.requestFocusInWindow(); + } catch (Exception e) { + JOptionPane.showMessageDialog(null, "Please Enter Integer."); + } + } + } + + @Override + public void keyTyped(KeyEvent evt) { + char c = evt.getKeyChar(); + if (!tf.isEnabled()) { + return; + } else if (c == 'a' || c == 'A' || c == '\n') { + try { + String data = tf.getText(); + evt.consume(); // Not type 'a' or 'A' character in textfield + if (!data.isEmpty()) { + add(Integer.parseInt(data)); + } else { + throw new Exception(); + } + tf.requestFocusInWindow(); + } catch (Exception e) { + JOptionPane.showMessageDialog(null, "Please Enter Integer."); + } + tf.setText(""); + } else if (c == 'd' || c == 'D') { + try { + String data = tf.getText(); + evt.consume(); // Not type 'd' or 'D' character in textfield + if (!data.isEmpty()) { + delete(Integer.parseInt(data)); + } + tf.requestFocusInWindow(); + } catch (Exception e) { + JOptionPane.showMessageDialog(null, "Please Enter Integer."); + } + tf.setText(""); + } else if (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z') + evt.consume(); + } + + @Override + public void keyPressed(KeyEvent evt) { + } + + @Override + public void keyReleased(KeyEvent evt) { + } + + //Add element in BST. + public void add(int info) { + Node newNode = new Node(info); + int width = getWidth(newNode); + + if (root == null) { + root = newNode; + newNode.data.setBounds(treePanel.getBounds().width / 2, 10, width, 40); + newNode.p = new Points(0, 0, 0, 0); + } else { + Node curr = root, pre = root; + int currData; + X = treePanel.getBounds().width / 2; + while (curr != null) { + pre = curr; + currData = Integer.parseInt(curr.data.getText()); + if (info == currData) { + JOptionPane.showMessageDialog(null, info + " is already exist."); + return; + } else if (currData > info) { + curr = curr.left; + } else { + curr = curr.right; + } + X /= 2; + } + + currData = Integer.parseInt(pre.data.getText()); + int x = pre.data.getX(); + int y = pre.data.getY(); + Dimension preDimension = pre.data.getSize(); + Dimension currDimension = new Dimension(width, Node.TEXT_HEIGHT); + + if (currData > info) { + pre.left = newNode; + newNode.data.setBounds(x - X, y + Y, width, 40); + // x1=x;y1=y+20;x2=x-X+20;y2=y+Y+20; + newNode.p = new Points(x, y + preDimension.height / 2, x - X + currDimension.width / 2, y + Y + currDimension.height / 2); + } else { + pre.right = newNode; + newNode.data.setBounds(x + X, y + Y, width, 40); + // x1=x+40;y1=y+20;x2=x+X+20;y2=y+Y+20; + newNode.p = new Points(x + preDimension.width, y + preDimension.height / 2, x + X + currDimension.width / 2, y + Y + currDimension.height / 2); + } + } + + // Set all traversal and height of BST + setInfo(); + + // paint(treePanel.getGraphics()); + treePanel.add(newNode.data); + treePanel.validate(); + treePanel.repaint(); + + validate(); + repaint(); + } + + // Delete Node from BST + public void delete(int data) { + if (root == null) { + JOptionPane.showMessageDialog(null, "BST is empty."); + } else { + Node curr = root, pre = root; + + while (curr != null) { + int info = Integer.parseInt(curr.data.getText()); + if (info == data) { + break; + } else if (info > data) { + pre = curr; + curr = curr.left; + } else { + pre = curr; + curr = curr.right; + } + } + + if (curr == null) { // data is not find. + JOptionPane.showMessageDialog(null, data + " is not available."); + return; + } else if (curr.left == null || curr.right == null) { // data has 0 or 1 child + + treePanel.remove(curr.data); + treePanel.validate(); + treePanel.repaint(); + + validate(); + repaint(); + + if (curr != root) { + Node address = curr.left != null ? curr.left : curr.right; + // curr.data>pre.data + int preData = Integer.parseInt(pre.data.getText()); + int currData = Integer.parseInt(curr.data.getText()); + if (currData > preData) { + pre.right = address; + } else { + pre.left = address; + } + } else { + if (curr.left != null) { + root = curr.left; + } else { + root = curr.right; + } + } + + } else { // data has 2 child. + + treePanel.remove(curr.data); + treePanel.validate(); + treePanel.repaint(); + + validate(); + repaint(); + + /* + It set another node depending upon the height of left and right sub tree. + */ + Node nextRoot = null, preRoot = curr; + Height height = calculateHeight(curr); + + /* For taking maximum element from the left Side. */ + if (height.left > height.right) { + nextRoot = curr.left; + while (nextRoot.right != null) { + preRoot = nextRoot; + nextRoot = nextRoot.right; + } + + if (preRoot != curr) { + preRoot.right = nextRoot.left; + } else { + preRoot.left = nextRoot.left; + } + } else { /* For taking minimum element from the right Side.*/ + nextRoot = curr.right; + while (nextRoot.left != null) { + preRoot = nextRoot; + nextRoot = nextRoot.left; + } + + if (preRoot != curr) { + preRoot.left = nextRoot.right; + } else { + preRoot.right = nextRoot.right; + } + } + + curr.data = nextRoot.data; + } + reArrangeNode(root, root, treePanel.getBounds().width / 2); + } + + // Set all traversal and height of BST + setInfo(); + } + + // Set all traversal and height of BST + private void setInfo() { + Height height = calculateHeight(root); + + if (height.root == 0) { + ansInorder.setText("BST is empty."); + ansPostorder.setText("BST is empty."); + ansPreorder.setText("BST is empty."); + } else { + ansInorder.setText(inorder(root)); + ansPostorder.setText(postorder(root)); + ansPreorder.setText(preorder(root)); + } + + ansHeight.setText(height.root + ""); + } + + private int getWidth(Node node) { + fontMatrix = getFontMetrics(node.data.getFont()); + int width = fontMatrix.stringWidth(node.data.getText()); + return width < Node.TEXT_WIDTH ? Node.TEXT_WIDTH : (width + 5); + } + + //Inorder logic + private String inorder(Node root) { + if (root == null) + return ""; + + return inorder(root.left) + root.data.getText() + " " + inorder(root.right); + } + + //Preorder logic + public String preorder(Node root) { + if (root == null) + return ""; + + return root.data.getText() + " " + preorder(root.left) + preorder(root.right); + } + + //Postorder logic + public String postorder(Node root) { + if (root == null) + return ""; + + return postorder(root.left) + postorder(root.right) + root.data.getText() + " "; + } + + // Calculate Height of BST using recursive method. + private Height calculateHeight(Node root) { + if (root == null) { + return new Height(); + } + Height leftChild = calculateHeight(root.left); + Height rightChild = calculateHeight(root.right); + Height current = new Height(leftChild.root, rightChild.root); + current.root = 1 + Math.max(leftChild.root, rightChild.root); + return current; + } + + // Rearrange nodes + private void reArrangeNode(Node node, Node pre, int X) { + if (node == null) + return; + + int width = getWidth(node); + + if (root == node) { + node.data.setBounds(X, 10, width, Node.TEXT_HEIGHT); + } else { + int x = pre.data.getX(); + int y = pre.data.getY(); + Dimension preDimension = pre.data.getSize(); + Dimension currDimension = new Dimension(width, Node.TEXT_HEIGHT); + + int preData = Integer.parseInt(pre.data.getText()); + int nodeData = Integer.parseInt(node.data.getText()); + if (nodeData < preData) { + node.data.setBounds(x - X, y + Y, width, Node.TEXT_HEIGHT); + node.p = new Points(x, y + preDimension.height / 2, x - X + currDimension.width / 2, y + Y + currDimension.height / 2); + } else { + node.data.setBounds(x + X, y + Y, width, Node.TEXT_HEIGHT); + // node.p = new Points(x + 40, y + 20, x + X + 20, y + Y + 20); + node.p = new Points(x + preDimension.width, y + preDimension.height / 2, x + X + currDimension.width / 2, y + Y + currDimension.height / 2); + } + } + + reArrangeNode(node.left, node, X / 2); + reArrangeNode(node.right, node, X / 2); + } + + public static void main(String arg[]) { + BSTVisualization bst = new BSTVisualization(); + + bst.add(500); + bst.add(250); + bst.add(350); + bst.add(200); + bst.add(750); + bst.add(1000); + bst.add(700); + bst.add(740); + } +} diff --git a/Bank.java b/Bank.java new file mode 100644 index 00000000..c040a5f1 --- /dev/null +++ b/Bank.java @@ -0,0 +1,138 @@ +package main; + +import java.util.Scanner; + +class Account{ + + int balance; + int prevTrans; + String custName; + int custId; + Scanner sc =new Scanner(System.in); + + void deposit(int amt1) { + if(amt1 !=0) { + balance= balance+amt1; + prevTrans = amt1; + } + } + + void withdraw(int amt2) { + if(balance !=0) { + balance = balance-amt2; + prevTrans = -amt2; + } + } + + void getPrevTrans() { + + if(prevTrans>0) { + System.out.println("Deposited Amount: "+prevTrans); + } + else if(prevTrans<0) { + System.out.println("Withdrawn Amount: "+Math.abs(prevTrans)); + } + else { + System.out.println("No Previous Transaction "); + } + + } + + void start() { + int z=0; + System.out.println("Greetings "+custName+"\nID : "+custId+"\n"); + System.out.println("What do you wish to do today?\n"); + System.out.println("1. Check Balance\n2. Deposit\n3. Withdraw\n4. View Previous Transaction\n5. Exit \n"); + + do { + System.out.println("******************"); + System.out.println("Enter your choice: "); + System.out.println("******************"); + z=sc.nextInt(); + + switch(z) { + + case 1: + System.out.println("---------------"); + System.out.println("Current Balance : "+balance); + System.out.println("---------------\n"); + break; + + case 2: + System.out.println("------------------------"); + System.out.println("Enter amount to deposit:"); + System.out.println("------------------------"); + int a=sc.nextInt(); + deposit(a); + System.out.println("\n"); + break; + + case 3: + System.out.println("-------------------------"); + System.out.println("Enter amount to withdraw:"); + System.out.println("-------------------------"); + int b=sc.nextInt(); + withdraw(b); + System.out.println("\n"); + break; + + case 4: + System.out.println("-------------------------"); + System.out.println("Previous Transaction : "); + getPrevTrans(); + System.out.println("-------------------------\n"); + break; + + case 5: + System.out.println("*******************************"); + break; + + default: + System.out.println("INVALID INPUT! \nPlease try again "); + break; + } + + }while(z!=5); + System.out.println("Thank you for using our services"); + } +} + + public class Bank { + public static void main(String[] args) { + + + Account b1=new Account(); + b1.custId= 9934823; + b1.custName="Paras Dongre"; + b1.balance= 52000; + + Account b2=new Account(); + b2.custId= 7842464; + b2.custName="Rahul Bhage"; + b2.balance= 72000; + + Account b3=new Account(); + b3.custId= 532568; + b3.custName="Anshul Pagle"; + b3.balance= 34000; + + System.out.println(" WELCOME TO THE PHD BANK"); + System.out.println(" ***********************\nEnter your pin : "); + + Scanner s=new Scanner(System.in); + int pin=s.nextInt(); + + if(pin==1234) { + b1.start(); + } + else if(pin==4321) { + b2.start(); + } + else if(pin==9876) { + b3.start(); + } + else { + System.out.println("Invalid PIN !! Try Again"); + } + } +} diff --git a/Banking.java b/Banking.java new file mode 100644 index 00000000..4e44c979 --- /dev/null +++ b/Banking.java @@ -0,0 +1,150 @@ +import java.util.Scanner; + +class BankDetails { + private String accno; + private String name; + private String acc_type; + private long balance; + Scanner sc = new Scanner(System.in); + + // Method to open a new account + public void openAccount() { + System.out.print("Enter Account No: "); + accno = sc.next(); + System.out.print("Enter Account type: "); + acc_type = sc.next(); + System.out.print("Enter Name: "); + name = sc.next(); + System.out.print("Enter Balance: "); + balance = sc.nextLong(); + } + + // Method to display account details + public void showAccount() { + System.out.println("Name of account holder: " + name); + System.out.println("Account no.: " + accno); + System.out.println("Account type: " + acc_type); + System.out.println("Balance: " + balance); + } + + // Method to deposit money + public void deposit() { + long amt; + System.out.println("Enter the amount you want to deposit: "); + amt = sc.nextLong(); + balance = balance + amt; + } + + // Method to withdraw money + public void withdrawal() { + long amt; + System.out.println("Enter the amount you want to withdraw: "); + amt = sc.nextLong(); + if (balance >= amt) { + balance = balance - amt; + System.out.println("Balance after withdrawal: " + balance); + } else { + System.out.println("Your balance is less than " + amt + "\tTransaction failed...!!"); + } + } + + // Method to search an account number + public boolean search(String ac_no) { + if (accno.equals(ac_no)) { + showAccount(); + return true; + } + return false; + } +} + +public class BankingApp { + public static void main(String arg[]) { + Scanner sc = new Scanner(System.in); + + // Create initial accounts + System.out.print("How many number of customers do you want to input? "); + int n = sc.nextInt(); + BankDetails[] accounts = new BankDetails[n]; + + for (int i = 0; i < accounts.length; i++) { + accounts[i] = new BankDetails(); + accounts[i].openAccount(); + } + + // Main menu loop + int choice; + do { + System.out.println("\n ***Banking System Application***"); + System.out.println("1. Display all account details"); + System.out.println("2. Search by Account number"); + System.out.println("3. Deposit the amount"); + System.out.println("4. Withdraw the amount"); + System.out.println("5. Exit"); + System.out.print("Enter your choice: "); + choice = sc.nextInt(); + + switch (choice) { + case 1: + // Display all account details + for (int i = 0; i < accounts.length; i++) { + accounts[i].showAccount(); + } + break; + case 2: + // Search by Account number + System.out.print("Enter account no. you want to search: "); + String ac_no = sc.next(); + boolean found = false; + for (int i = 0; i < accounts.length; i++) { + found = accounts[i].search(ac_no); + if (found) { + break; + } + } + if (!found) { + System.out.println("Search failed! Account doesn't exist..!!"); + } + break; + case 3: + // Deposit the amount + System.out.print("Enter Account no. : "); + ac_no = sc.next(); + found = false; + for (int i = 0; i < accounts.length; i++) { + found = accounts[i].search(ac_no); + if (found) { + accounts[i].deposit(); + break; + } + } + if (!found) { + System.out.println("Search failed! Account doesn't exist..!!"); + } + break; + case 4: + // Withdraw the amount + System.out.print("Enter Account No : "); + ac_no = sc.next(); + found = false; + for (int i = 0; i < accounts.length; i++) { + found = accounts[i].search(ac_no); + if (found) { + accounts[i].withdrawal(); + break; + } + } + if (!found) { + System.out.println("Search failed! Account doesn't exist..!!"); + } + break; + case 5: + System.out.println("See you soon..."); + break; + default: + System.out.println("Invalid choice! Please select a valid option."); + break; + } + } while (choice != 5); + } +} diff --git a/Basic Jarvis-like AI b/Basic Jarvis-like AI new file mode 100644 index 00000000..697eb217 --- /dev/null +++ b/Basic Jarvis-like AI @@ -0,0 +1,33 @@ +import java.util.Scanner; + +public class Jarvis { + + private SpeechRecognizer speechRecognizer; + private TextToSpeech textToSpeech; + private NaturalLanguageProcessor nlp; + private KnowledgeBase knowledgeBase; + + public Jarvis(SpeechRecognizer speechRecognizer, TextToSpeech textToSpeech, NaturalLanguageProcessor nlp, KnowledgeBase knowledgeBase) { + this.speechRecognizer = speechRecognizer; + this.textToSpeech = textToSpeech; + this.nlp = nlp; + this.knowledgeBase = knowledgeBase; + } + + public void listenAndRespond() { + String userInput = speechRecognizer.recognizeSpeech(); + String response = nlp.processInput(userInput, knowledgeBase); + textToSpeech.speak(response); + } + + public static void main(String[] args) { + SpeechRecognizer speechRecognizer = new GoogleCloudSpeechRecognizer(); + TextToSpeech textToSpeech = new GoogleCloudTextToSpeech(); + NaturalLanguageProcessor nlp = new OpenNLPProcessor(); + KnowledgeBase knowledgeBase = new WikidataKnowledgeBase(); + + Jarvis jarvis = new Jarvis(speechRecognizer, textToSpeech, nlp, knowledgeBase); + + jarvis.listenAndRespond(); + } +} diff --git a/Basic_Bank_System/Basic_Bank_System.java b/Basic_Bank_System/Basic_Bank_System.java new file mode 100644 index 00000000..c8fabad4 --- /dev/null +++ b/Basic_Bank_System/Basic_Bank_System.java @@ -0,0 +1,83 @@ +import java.util.HashMap; +import java.util.Map; +import java.util.Scanner; + +class Bank { + private Map accounts; + + public Bank() { + this.accounts = new HashMap<>(); + } + + public void addAccount(String accountNumber, String customerName, double balance) { + Account account = new Account(accountNumber, customerName, balance); + accounts.put(accountNumber, account); + } + + public void displayAccountInfo(String accountNumber) { + if (accounts.containsKey(accountNumber)) { + Account account = accounts.get(accountNumber); + System.out.println("Account Number: " + account.getAccountNumber()); + System.out.println("Customer Name: " + account.getCustomerName()); + System.out.println("Balance: $" + account.getBalance()); + } else { + System.out.println("Account not found!"); + } + } + + public void performTransaction(String accountNumber, double amount) { + if (accounts.containsKey(accountNumber)) { + Account account = accounts.get(accountNumber); + account.deposit(amount); + System.out.println("Transaction successful. Updated balance: $" + account.getBalance()); + } else { + System.out.println("Account not found!"); + } + } +} + +class Account { + private String accountNumber; + private String customerName; + private double balance; + + public Account(String accountNumber, String customerName, double balance) { + this.accountNumber = accountNumber; + this.customerName = customerName; + this.balance = balance; + } + + public String getAccountNumber() { + return accountNumber; + } + + public String getCustomerName() { + return customerName; + } + + public double getBalance() { + return balance; + } + + public void deposit(double amount) { + balance += amount; + } +} + +public class BankingSystem { + public static void main(String[] args) { + Bank bank = new Bank(); + + // Adding a few accounts + bank.addAccount("101", "John Doe", 1000.0); + bank.addAccount("102", "Jane Smith", 1500.0); + + // Performing transactions + bank.performTransaction("101", 500.0); + bank.performTransaction("103", 200.0); // This account doesn't exist + + // Displaying account information + bank.displayAccountInfo("101"); + bank.displayAccountInfo("102"); + } +} diff --git a/Billing-system/.classpath b/Billing-system/.classpath new file mode 100644 index 00000000..d1ded76c --- /dev/null +++ b/Billing-system/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/Billing-system/.project b/Billing-system/.project new file mode 100644 index 00000000..003b6103 --- /dev/null +++ b/Billing-system/.project @@ -0,0 +1,17 @@ + + + RestaurantBillingSystem + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/Billing-system/bin/billingsystem/Login.fxml b/Billing-system/bin/billingsystem/Login.fxml new file mode 100644 index 00000000..93f816d1 --- /dev/null +++ b/Billing-system/bin/billingsystem/Login.fxml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + diff --git a/Billing-system/bin/billingsystem/Main.class b/Billing-system/bin/billingsystem/Main.class new file mode 100644 index 00000000..5bf4e430 Binary files /dev/null and b/Billing-system/bin/billingsystem/Main.class differ diff --git a/Billing-system/bin/billingsystem/MainController$1.class b/Billing-system/bin/billingsystem/MainController$1.class new file mode 100644 index 00000000..2d7f941c Binary files /dev/null and b/Billing-system/bin/billingsystem/MainController$1.class differ diff --git a/Billing-system/bin/billingsystem/MainController$10.class b/Billing-system/bin/billingsystem/MainController$10.class new file mode 100644 index 00000000..8fc74b4f Binary files /dev/null and b/Billing-system/bin/billingsystem/MainController$10.class differ diff --git a/Billing-system/bin/billingsystem/MainController$11.class b/Billing-system/bin/billingsystem/MainController$11.class new file mode 100644 index 00000000..15b60741 Binary files /dev/null and b/Billing-system/bin/billingsystem/MainController$11.class differ diff --git a/Billing-system/bin/billingsystem/MainController$2$1.class b/Billing-system/bin/billingsystem/MainController$2$1.class new file mode 100644 index 00000000..846737d5 Binary files /dev/null and b/Billing-system/bin/billingsystem/MainController$2$1.class differ diff --git a/Billing-system/bin/billingsystem/MainController$2$2.class b/Billing-system/bin/billingsystem/MainController$2$2.class new file mode 100644 index 00000000..9aff8034 Binary files /dev/null and b/Billing-system/bin/billingsystem/MainController$2$2.class differ diff --git a/Billing-system/bin/billingsystem/MainController$2.class b/Billing-system/bin/billingsystem/MainController$2.class new file mode 100644 index 00000000..386fbcad Binary files /dev/null and b/Billing-system/bin/billingsystem/MainController$2.class differ diff --git a/Billing-system/bin/billingsystem/MainController$3$1.class b/Billing-system/bin/billingsystem/MainController$3$1.class new file mode 100644 index 00000000..9b4e9479 Binary files /dev/null and b/Billing-system/bin/billingsystem/MainController$3$1.class differ diff --git a/Billing-system/bin/billingsystem/MainController$3.class b/Billing-system/bin/billingsystem/MainController$3.class new file mode 100644 index 00000000..ea6a0b13 Binary files /dev/null and b/Billing-system/bin/billingsystem/MainController$3.class differ diff --git a/Billing-system/bin/billingsystem/MainController$4$1.class b/Billing-system/bin/billingsystem/MainController$4$1.class new file mode 100644 index 00000000..6ab0434f Binary files /dev/null and b/Billing-system/bin/billingsystem/MainController$4$1.class differ diff --git a/Billing-system/bin/billingsystem/MainController$4$2.class b/Billing-system/bin/billingsystem/MainController$4$2.class new file mode 100644 index 00000000..04e5ce46 Binary files /dev/null and b/Billing-system/bin/billingsystem/MainController$4$2.class differ diff --git a/Billing-system/bin/billingsystem/MainController$4$3.class b/Billing-system/bin/billingsystem/MainController$4$3.class new file mode 100644 index 00000000..2533bd58 Binary files /dev/null and b/Billing-system/bin/billingsystem/MainController$4$3.class differ diff --git a/Billing-system/bin/billingsystem/MainController$4.class b/Billing-system/bin/billingsystem/MainController$4.class new file mode 100644 index 00000000..0e7379db Binary files /dev/null and b/Billing-system/bin/billingsystem/MainController$4.class differ diff --git a/Billing-system/bin/billingsystem/MainController$5$1.class b/Billing-system/bin/billingsystem/MainController$5$1.class new file mode 100644 index 00000000..2223e115 Binary files /dev/null and b/Billing-system/bin/billingsystem/MainController$5$1.class differ diff --git a/Billing-system/bin/billingsystem/MainController$5.class b/Billing-system/bin/billingsystem/MainController$5.class new file mode 100644 index 00000000..0a47614e Binary files /dev/null and b/Billing-system/bin/billingsystem/MainController$5.class differ diff --git a/Billing-system/bin/billingsystem/MainController$6$1.class b/Billing-system/bin/billingsystem/MainController$6$1.class new file mode 100644 index 00000000..3a6d45f9 Binary files /dev/null and b/Billing-system/bin/billingsystem/MainController$6$1.class differ diff --git a/Billing-system/bin/billingsystem/MainController$6$2.class b/Billing-system/bin/billingsystem/MainController$6$2.class new file mode 100644 index 00000000..f09f07ad Binary files /dev/null and b/Billing-system/bin/billingsystem/MainController$6$2.class differ diff --git a/Billing-system/bin/billingsystem/MainController$6.class b/Billing-system/bin/billingsystem/MainController$6.class new file mode 100644 index 00000000..3f65d731 Binary files /dev/null and b/Billing-system/bin/billingsystem/MainController$6.class differ diff --git a/Billing-system/bin/billingsystem/MainController$7.class b/Billing-system/bin/billingsystem/MainController$7.class new file mode 100644 index 00000000..7fca743e Binary files /dev/null and b/Billing-system/bin/billingsystem/MainController$7.class differ diff --git a/Billing-system/bin/billingsystem/MainController$8.class b/Billing-system/bin/billingsystem/MainController$8.class new file mode 100644 index 00000000..ab023ab0 Binary files /dev/null and b/Billing-system/bin/billingsystem/MainController$8.class differ diff --git a/Billing-system/bin/billingsystem/MainController$9.class b/Billing-system/bin/billingsystem/MainController$9.class new file mode 100644 index 00000000..932da29a Binary files /dev/null and b/Billing-system/bin/billingsystem/MainController$9.class differ diff --git a/Billing-system/bin/billingsystem/MainController.class b/Billing-system/bin/billingsystem/MainController.class new file mode 100644 index 00000000..5e0deec5 Binary files /dev/null and b/Billing-system/bin/billingsystem/MainController.class differ diff --git a/Billing-system/bin/billingsystem/Order.class b/Billing-system/bin/billingsystem/Order.class new file mode 100644 index 00000000..4576a9c7 Binary files /dev/null and b/Billing-system/bin/billingsystem/Order.class differ diff --git a/Billing-system/bin/billingsystem/Table.class b/Billing-system/bin/billingsystem/Table.class new file mode 100644 index 00000000..6b258a68 Binary files /dev/null and b/Billing-system/bin/billingsystem/Table.class differ diff --git a/Billing-system/bin/billingsystem/User.class b/Billing-system/bin/billingsystem/User.class new file mode 100644 index 00000000..dfcf746f Binary files /dev/null and b/Billing-system/bin/billingsystem/User.class differ diff --git a/Billing-system/bin/billingsystem/login.css b/Billing-system/bin/billingsystem/login.css new file mode 100644 index 00000000..537feecb --- /dev/null +++ b/Billing-system/bin/billingsystem/login.css @@ -0,0 +1,3 @@ +#pane { + -fx-background-image:url('login.jpg'); +} \ No newline at end of file diff --git a/Billing-system/bin/billingsystem/login.jpg b/Billing-system/bin/billingsystem/login.jpg new file mode 100644 index 00000000..7d2fe852 Binary files /dev/null and b/Billing-system/bin/billingsystem/login.jpg differ diff --git a/Billing-system/bin/login.jpg b/Billing-system/bin/login.jpg new file mode 100644 index 00000000..7d2fe852 Binary files /dev/null and b/Billing-system/bin/login.jpg differ diff --git a/Billing-system/bin/main.jpg b/Billing-system/bin/main.jpg new file mode 100644 index 00000000..dad82c17 Binary files /dev/null and b/Billing-system/bin/main.jpg differ diff --git a/Billing-system/bin/main_area.jpg b/Billing-system/bin/main_area.jpg new file mode 100644 index 00000000..2efc0758 Binary files /dev/null and b/Billing-system/bin/main_area.jpg differ diff --git a/Billing-system/bin/systemstyle/Format.class b/Billing-system/bin/systemstyle/Format.class new file mode 100644 index 00000000..9885b718 Binary files /dev/null and b/Billing-system/bin/systemstyle/Format.class differ diff --git a/Billing-system/img/login.jpg b/Billing-system/img/login.jpg new file mode 100644 index 00000000..7d2fe852 Binary files /dev/null and b/Billing-system/img/login.jpg differ diff --git a/Billing-system/img/main.jpg b/Billing-system/img/main.jpg new file mode 100644 index 00000000..dad82c17 Binary files /dev/null and b/Billing-system/img/main.jpg differ diff --git a/Billing-system/img/main_area.jpg b/Billing-system/img/main_area.jpg new file mode 100644 index 00000000..2efc0758 Binary files /dev/null and b/Billing-system/img/main_area.jpg differ diff --git a/Billing-system/src/billingsystem/Login.fxml b/Billing-system/src/billingsystem/Login.fxml new file mode 100644 index 00000000..93f816d1 --- /dev/null +++ b/Billing-system/src/billingsystem/Login.fxml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + diff --git a/Billing-system/src/billingsystem/Main.java b/Billing-system/src/billingsystem/Main.java new file mode 100644 index 00000000..e89d85e5 --- /dev/null +++ b/Billing-system/src/billingsystem/Main.java @@ -0,0 +1,118 @@ +package billingsystem; + +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.util.ArrayList; +import java.util.logging.FileHandler; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.logging.SimpleFormatter; + +import javafx.application.Application; +import javafx.fxml.FXMLLoader; +import javafx.stage.Stage; +import javafx.scene.Parent; +import javafx.scene.Scene; + +/** + * + * @author Jason Li + * @version 1.0 + * @since 19.12.2016 + * + * + * The Class Main. + */ +public class Main extends Application { + + /** The Constant logger. */ + private static final Logger logger = Logger.getLogger(Main.class.getName()); + + /** The fh log. */ + private static FileHandler fhLog; + + /** The user path. */ + private String userPath = "res/users.ser"; + + /** The log path. */ + private String logPath = "res/activity.log"; + + /** The root admin. */ + private final String rootAdmin = "admin"; + + /** The users list. */ + private ArrayList usersList = null; + + /** The jarpath. */ + private String jarpath; + + /* (non-Javadoc) + * @see javafx.application.Application#start(javafx.stage.Stage) + */ + @Override + public void start(Stage primaryStage) { + + try { + fhLog = new FileHandler(logPath, true); + logger.addHandler(fhLog); + SimpleFormatter formatter = new SimpleFormatter(); + fhLog.setFormatter(formatter); + } catch (SecurityException e) { + logger.log(Level.SEVERE, "" + e); + } catch (IOException e) { + logger.log(Level.WARNING, + "Logger could not be set up to log to activity log. Logs will only be displayed in the console. \n" + + e); + } + try { + try { + FileInputStream fileIn = new FileInputStream(userPath); + ObjectInputStream in = new ObjectInputStream(fileIn); + usersList = (ArrayList) in.readObject(); + in.close(); + fileIn.close(); + } catch (IOException i) { + logger.log(Level.INFO, "Root admin account 'admin' created on first time login."); + // Create admin account if not existent + User admin = new User(rootAdmin, "", true); + usersList = new ArrayList(); + usersList.add(admin); + try { + // Create user list with initial admin account + FileOutputStream fileOut = new FileOutputStream(userPath); + ObjectOutputStream out = new ObjectOutputStream(fileOut); + out.writeObject(usersList); + out.close(); + fileOut.close(); + } catch (IOException i2) { + logger.log(Level.WARNING, "" + i2); + } + } + + // Create Login Screen + Parent root = FXMLLoader.load(getClass().getResource("/billingsystem/Login.fxml")); + Scene scene = new Scene(root); + scene.getStylesheets().add(getClass().getResource("login.css").toExternalForm()); + primaryStage.setScene(scene); + primaryStage.setResizable(false); + primaryStage.show(); + fhLog.close(); + + } catch (Exception e) { + logger.log(Level.SEVERE, + "Login Screen file has been deleted or is corrupted. Please restore 'Login.fxml' links. \n" + e); + } + } + + /** + * The main method. + * + * @param args the arguments + */ + public static void main(String[] args) { + launch(args); + } +} diff --git a/Billing-system/src/billingsystem/MainController.java b/Billing-system/src/billingsystem/MainController.java new file mode 100644 index 00000000..da3edd0b --- /dev/null +++ b/Billing-system/src/billingsystem/MainController.java @@ -0,0 +1,1724 @@ +package billingsystem; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.text.DateFormat; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.LocalTime; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.Locale; +import java.util.Optional; +import java.util.Scanner; +import java.util.logging.FileHandler; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.logging.SimpleFormatter; +import java.util.stream.Collectors; + +import javafx.beans.value.ChangeListener; +import javafx.beans.value.ObservableValue; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; +import javafx.event.ActionEvent; +import javafx.event.EventHandler; +import javafx.fxml.FXML; +import javafx.geometry.Insets; +import javafx.geometry.Pos; +import javafx.geometry.Rectangle2D; +import javafx.scene.Node; +import javafx.scene.Scene; +import javafx.scene.control.Alert; +import javafx.scene.control.Alert.AlertType; +import javafx.scene.control.Button; +import javafx.scene.control.ButtonBar.ButtonData; +import javafx.scene.control.ButtonType; +import javafx.scene.control.CheckBox; +import javafx.scene.control.ComboBox; +import javafx.scene.control.DatePicker; +import javafx.scene.control.Dialog; +import javafx.scene.control.Label; +import javafx.scene.control.PasswordField; +import javafx.scene.control.ScrollPane; +import javafx.scene.control.ScrollPane.ScrollBarPolicy; +import javafx.scene.control.Separator; +import javafx.scene.control.TextArea; +import javafx.scene.control.TextField; +import javafx.scene.control.Tooltip; +import javafx.scene.input.MouseButton; +import javafx.scene.input.MouseEvent; +import javafx.scene.layout.ColumnConstraints; +import javafx.scene.layout.GridPane; +import javafx.scene.layout.Pane; +import javafx.scene.layout.VBox; +import javafx.stage.FileChooser; +import javafx.stage.Screen; +import javafx.stage.Stage; +import javafx.stage.WindowEvent; + +import systemstyle.Format; + +// TODO: Auto-generated Javadoc +/** + * * @author Jason Li. + * + * @version 1.0 + * @since 19.12.2016 * + * + * + * The Class MainController. + */ +public class MainController { + + /** The login. */ + @FXML + private Button login; + + /** The user. */ + @FXML + private TextField user; + + /** The pwd fld. */ + @FXML + private PasswordField pwdFld; + + /** The users list. */ + private ArrayList usersList; + + /** The current user. */ + private User currentUser; + + /** The Constant userLogger. */ + private static final Logger userLogger = Logger.getLogger(MainController.class.getName() + "_User"); + + /** The fh user. */ + private static FileHandler fhUser; + + /** The Constant logger. */ + private static final Logger logger = Logger.getLogger(MainController.class.getName()); + + /** The fh log. */ + private static FileHandler fhLog; + + /** The file. */ + private File file; + + /** The menubook. */ + private ArrayList menubook = new ArrayList(); + + /** The order log. */ + private ArrayList orderLog = new ArrayList(); + + /** The full format. */ + private static DateFormat fullFormat = DateFormat.getDateInstance(DateFormat.FULL, Locale.getDefault()); + + /** The date format. */ + private static DateFormat dateFormat = new SimpleDateFormat("HH:mm dd/MM/yyyy"); + + /** The time format. */ + private static DateFormat timeFormat = new SimpleDateFormat("HH:mm"); + + /** The date time format. */ + private static DateTimeFormatter dateTimeFormat = DateTimeFormatter.ofPattern("HH:mm"); + + /** The user path. */ + private String userPath = "res/users.ser"; + + /** The user log path. */ + private String userLogPath = "res/"; + + /** The log path. */ + private String logPath = "res/activity.log"; + + /** The order log path. */ + private String orderLogPath = "res/orderlog.ser"; + + /** The csv path. */ + private String csvPath = "res/export.csv"; + + /** The menu path. */ + private String menuPath = "res/menubook.ser"; + + /** + * Handle login. + * + * @param evt + * the login event + * + */ + @FXML + private void handleLogin(ActionEvent evt) { + + // Set up general logger + try { + fhLog = new FileHandler(logPath, true); + logger.addHandler(fhLog); + SimpleFormatter formatter = new SimpleFormatter(); + fhLog.setFormatter(formatter); + } catch (SecurityException e) { + logger.log(Level.SEVERE, "" + e); + } catch (IOException e) { + logger.log(Level.WARNING, + "Logger could not be set up to log to activity log. Logs will only be displayed in the console. \n" + + e); + } + + // Load available users for system + try { + FileInputStream fileIn = new FileInputStream(userPath); + ObjectInputStream in = new ObjectInputStream(fileIn); + usersList = (ArrayList) in.readObject(); + in.close(); + fileIn.close(); + } catch (IOException i) { + logger.log(Level.SEVERE, "No user list have been found. Try reloading program. "); + } catch (ClassNotFoundException c) { + logger.log(Level.SEVERE, "" + c); + } + + // Login validation section + // Loop through stored users to see if entered user matches any + boolean matchFound = false; + for (int i = 0; i < usersList.size(); i++) { + String enteredUser = user.getText(); + String storedUser = usersList.get(i).getUserName(); + if (enteredUser.equals(storedUser)) { + String enteredPwd = pwdFld.getText(); + if (enteredPwd.equals(usersList.get(i).getUserPassword())) { + matchFound = true; + currentUser = usersList.get(i); + userLogPath += (currentUser.getUserName() + "_activity.log"); + // Set up user logger + try { + fhUser = new FileHandler(userLogPath, true); + fhUser.setLevel(Level.FINE); + userLogger.setLevel(Level.FINE); + userLogger.addHandler(fhUser); + SimpleFormatter formatter = new SimpleFormatter(); + fhUser.setFormatter(formatter); + } catch (SecurityException e) { + logger.log(Level.SEVERE, "" + e); + } catch (IOException e) { + logger.log(Level.WARNING, + "User activity logger failed to set up. An unlogged user session has been started by " + + currentUser.getUserName()); + logger.log(Level.WARNING, + "Logger could not be set up to log to activity log. Logs will only be displayed in the console. \n" + + e); + } + userLogger.log(Level.FINE, currentUser.getUserName() + " has logged into the system. "); + } + break; + } + } + // Login & password correct + if (matchFound) { + constructMainScreen(); + } + // Else error message + else { + Alert alert = new Alert(AlertType.ERROR); + alert.setTitle("Login failed"); + alert.setHeaderText("Login failed"); + alert.setContentText("Login or password incorrect"); + + alert.showAndWait(); + } + } + + // Main Screen construction section + + /** The v menu. */ + // Variables for Main Screen Menu + private VBox vMenu; + + /** The account. */ + private Button account; + + /** The v manager. */ + // Variables for Manager Menu + private VBox vManager; + + /** The manage users. */ + private Button manageUsers; + + /** The add menubook. */ + private Button addMenubook; + + /** The tbl pane. */ + // Variables for Main Screen Scroll Pane + private Pane tblPane; + + /** The tbl scrl pane. */ + private ScrollPane tblScrlPane; + + /** The lbl. */ + private Table lbl; + + /** The pane height. */ + int paneWidth = 1000, paneHeight = 600; + + /** The btn height. */ + int btnWidth = 125, btnHeight = 35; + + /** The tbl height. */ + int tblWidth = 100, tblHeight = 100; + + /** The v menu width. */ + int vMenuWidth = 200; + + /** The v manager height. */ + int vManagerHeight = 200; + + /** The file chooser. */ + private static FileChooser fileChooser = new FileChooser(); + + /** + * Construct main screen. + */ + private void constructMainScreen() { + + Stage stage = null; + Pane root; + stage = (Stage) login.getScene().getWindow(); + root = new Pane(); + root.setPadding(new Insets(25)); + + // General Menu section + vMenu = new VBox(15); + vMenu.setPadding(new Insets(25)); + // vMenu.setStyle("-fx-background-color: #a0522d;"); + vMenu.setAlignment(Pos.TOP_CENTER); + vMenu.setPrefSize(vMenuWidth, paneHeight); + + account = new Button("Account settings"); + account.setPrefSize(btnWidth, btnHeight); + account.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent at) { + Dialog dialog = new Dialog(); + dialog.setTitle("Account Setting"); + dialog.setHeaderText("Enter new password and click save"); + + GridPane grid = new GridPane(); + grid.setHgap(10); + grid.setVgap(10); + + PasswordField password = new PasswordField(); + password.setPromptText("Password"); + PasswordField passwordConfirm = new PasswordField(); + passwordConfirm.setPromptText("Password"); + + Button save = new Button("Change password"); + save.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent change) { + String passwordSet = password.getText(); + String passwordSetConfirm = passwordConfirm.getText(); + // Check if both fields are filled + if (!(passwordSet.equals("") || (passwordSetConfirm.equals("")))) { + // Check if passwords matched + if (passwordSet.equals(passwordSetConfirm)) { + currentUser.setPassword(passwordSetConfirm); + userLogger.log(Level.FINE, "Successfully changed password."); + + Alert alert = new Alert(AlertType.INFORMATION); + alert.setTitle("Password changed"); + alert.setHeaderText("Password changed"); + alert.setContentText("You have successfully changed your password"); + alert.showAndWait(); + + try { + FileOutputStream fileOut = new FileOutputStream(userPath); + ObjectOutputStream out = new ObjectOutputStream(fileOut); + out.writeObject(usersList); + out.close(); + fileOut.close(); + } catch (IOException i) { + logger.log(Level.SEVERE, "" + i); + } + + } else { + + } + } else { + invalidInputAlert(); + } + } + }); + + grid.add(new Label("Logged in as: "), 0, 0); + grid.add(new Label(currentUser.getUserName()), 1, 0); + grid.add(new Label("New Password:"), 0, 1); + grid.add(password, 1, 1); + grid.add(new Label("Confirm new password:"), 0, 2); + grid.add(passwordConfirm, 1, 2); + grid.add(save, 1, 3); + + ButtonType exit = new ButtonType("Exit", ButtonData.OK_DONE); + dialog.getDialogPane().getButtonTypes().addAll(ButtonType.CANCEL); + + dialog.getDialogPane().setContent(grid); + dialog.showAndWait(); + } + }); + + Button allOrders = new Button("View Order Log"); + allOrders.setPrefSize(btnWidth, btnHeight); + allOrders.setOnAction(new EventHandler() { + @Override + @SuppressWarnings("deprecation") + public void handle(ActionEvent ravt) { + Dialog dialog = new Dialog(); + dialog.setTitle("Order Log Manager"); + dialog.setHeaderText("Order Log:"); + + GridPane grid = new GridPane(); + grid.setHgap(10); + grid.setVgap(10); + + grid.add(new Label("Search orders"), 0, 0); + String[] searchColumns = { "Table No.", "Order Name", "From", "Until", "From", "Until", "Comments" }; + // Populating columns + for (int i = 0; i < searchColumns.length; i++) { + Label searchLbl = new Label(searchColumns[i]); + grid.add(searchLbl, i, 1); + } + + // Inner display of all orders + GridPane searchInner = new GridPane(); + Format.innergrid(searchInner); + searchInner.setPrefWidth(400); + searchInner.setMinHeight(200); + String[] searchInnerCol = { "Table No.", "Order Name", "Price", "Quantity", "Total", "Order Datetime", + "Comments" }; + double multiplier = 1; + boolean localRights = currentUser.getUserRights(); + // Create list for selection + ArrayList selectedList = new ArrayList(); + // Adjust column width depending on user type + if (localRights) { + multiplier = 0.95; + } + ColumnConstraints scol1 = new ColumnConstraints(); + scol1.setPercentWidth(45 / (searchInnerCol.length - 4) * multiplier); + searchInner.getColumnConstraints().add(scol1); + ColumnConstraints scol2 = new ColumnConstraints(); + scol2.setPercentWidth(25 * multiplier); + searchInner.getColumnConstraints().add(scol2); + ColumnConstraints scol3 = new ColumnConstraints(); + scol3.setPercentWidth(10 * multiplier); + searchInner.getColumnConstraints().add(scol3); + ColumnConstraints scol4 = new ColumnConstraints(); + scol4.setPercentWidth(10 * multiplier); + searchInner.getColumnConstraints().add(scol4); + ColumnConstraints scol5 = new ColumnConstraints(); + scol5.setPercentWidth(10 * multiplier); + searchInner.getColumnConstraints().add(scol5); + ColumnConstraints scol6 = new ColumnConstraints(); + scol6.setPercentWidth(45 / (searchInnerCol.length - 4) * multiplier); + searchInner.getColumnConstraints().add(scol6); + ColumnConstraints scol7 = new ColumnConstraints(); + scol7.setPercentWidth(45 / (searchInnerCol.length - 4) * multiplier); + searchInner.getColumnConstraints().add(scol7); + if (localRights) { + ColumnConstraints scol8 = new ColumnConstraints(); + scol8.setPercentWidth(5); + searchInner.getColumnConstraints().add(scol8); + } + + // Generate search display + ArrayList localLog = new ArrayList(orderLog); + for (int i = 0; i < currentTables.size(); i++) { + ArrayList innerLocal = new ArrayList(currentTables.get(i).getOrders()); + for (int n = 0; n < innerLocal.size(); n++) { + localLog.add(innerLocal.get(n)); + } + } + ArrayList displayList = new ArrayList(localLog); + Collections.reverse(displayList); + refreshSearch(searchInner, displayList, searchInnerCol, selectedList); + ScrollPane searchScroll = new ScrollPane(); + searchScroll.setVbarPolicy(ScrollBarPolicy.ALWAYS); + searchScroll.setFitToWidth(true); + searchScroll.setPrefHeight(200); + searchScroll.setContent(searchInner); + grid.add(searchScroll, 0, 4, searchColumns.length, 1); + + // Populate search fields + ArrayList tblNames = new ArrayList(); + tblNames.add("Any"); + for (int i = 1; i <= 15; i++) { + tblNames.add("Table" + i); + } + ObservableList oTableList = FXCollections.observableArrayList(tblNames); + ComboBox searchTable = new ComboBox(oTableList); + searchTable.getSelectionModel().selectFirst(); + grid.add(searchTable, 0, 2); + + TextField searchName = new TextField(); + grid.add(searchName, 1, 2); + + DatePicker fromDate = new DatePicker(); + fromDate.setPrefWidth(btnWidth); + fromDate.setValue(LocalDate.now().minusDays(1)); + grid.add(fromDate, 2, 2); + + DatePicker untilDate = new DatePicker(); + untilDate.setPrefWidth(btnWidth); + untilDate.setValue(LocalDate.now()); + grid.add(untilDate, 3, 2); + + Date localNow = new Date(); + Date localFrom = (Date) localNow.clone(); + localFrom.setHours(localFrom.getHours() - 1); + TextField fromTime = new TextField(); + fromTime.setText(timeFormat.format(localFrom)); + grid.add(fromTime, 4, 2); + + TextField untilTime = new TextField(); + untilTime.setText(timeFormat.format(localNow)); + grid.add(untilTime, 5, 2); + + TextField searchComments = new TextField(); + grid.add(searchComments, 6, 2); + + Button launchSearch = new Button("Search"); + launchSearch.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent sat) { + // Prepare filled out search fields + String localTbl = (String) searchTable.getValue(); + String localName = searchName.getText(); + LocalDate localFromD; + if (fromDate.getValue() != null) { + // from date - 1 to include current day + localFromD = fromDate.getValue().minusDays(1); + } else { + localFromD = fromDate.getValue(); + } + LocalDate localUntilD; + if (untilDate.getValue() != null) { + // until date + 1 to include current day + localUntilD = untilDate.getValue().plusDays(1); + } else { + localUntilD = untilDate.getValue(); + } + LocalTime localFromT; + if (!fromTime.getText().equals("")) { + localFromT = LocalTime.parse(fromTime.getText(), dateTimeFormat).minusSeconds(1); + } else { + localFromT = null; + } + LocalTime localUntilT; + if (!untilTime.getText().equals("")) { + localUntilT = LocalTime.parse(untilTime.getText(), dateTimeFormat).plusMinutes(1); + } else { + localUntilT = null; + } + String localComments = searchComments.getText(); + if (!(localTbl.isEmpty() && localName.isEmpty() && localComments.isEmpty())) { + ArrayList searchDisplay = new ArrayList(displayList); + // Filter for table search value + if (!localTbl.equals("Any")) { + searchDisplay = (ArrayList) searchDisplay.stream() + .filter(result -> result.getSrcTbl().equals(localTbl)) + .collect(Collectors.toList()); + } + // Filter for order search value + if (!localName.isEmpty()) { + searchDisplay = (ArrayList) searchDisplay.stream() + .filter(result -> result.getName().equals(localName)) + .collect(Collectors.toList()); + } + // Filter for date intervals + if (!(localFromD == null || localUntilD == null)) { + searchDisplay = (ArrayList) searchDisplay + .stream().filter(result -> result.getDate().toInstant() + .atZone(ZoneId.systemDefault()).toLocalDate().isAfter(localFromD)) + .collect(Collectors.toList()); + searchDisplay = (ArrayList) searchDisplay + .stream().filter(result -> result.getDate().toInstant() + .atZone(ZoneId.systemDefault()).toLocalDate().isBefore(localUntilD)) + .collect(Collectors.toList()); + } + // Filter for time intervals + if (!(localFromT == null || localUntilT == null)) { + searchDisplay = (ArrayList) searchDisplay + .stream().filter(result -> result.getDate().toInstant() + .atZone(ZoneId.systemDefault()).toLocalTime().isAfter(localFromT)) + .collect(Collectors.toList()); + searchDisplay = (ArrayList) searchDisplay + .stream().filter(result -> result.getDate().toInstant() + .atZone(ZoneId.systemDefault()).toLocalTime().isBefore(localUntilT)) + .collect(Collectors.toList()); + } + // Filter for comments + if (!localComments.isEmpty()) { + searchDisplay = (ArrayList) searchDisplay.stream() + .filter(result -> result.getComment().equals(localComments)) + .collect(Collectors.toList()); + } + refreshSearch(searchInner, searchDisplay, searchInnerCol, selectedList); + } else { + invalidInputAlert(); + } + } + }); + grid.add(launchSearch, 5, 3); + + // Manager Import Export Section + grid.add(new Label("Import orders to order list"), 2, 5); + Button importOrders = new Button("Import Orders"); + importOrders.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent exporter) { + fileChooser.setTitle("Open Resource File"); + // Set extension filter + FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter("Text delimited files", + "*.txt", "*.csv"); + fileChooser.getExtensionFilters().add(extFilter); + // Using login button simply because showOpenDialog + // requires a stage input + file = fileChooser.showOpenDialog(login.getScene().getWindow()); + if (file != null) { + BufferedReader csvReader = null; + String line = ""; + String delimiter = ","; + try { + csvReader = new BufferedReader(new FileReader(file)); + while ((line = csvReader.readLine()) != null) { + String[] orderProperties = line.split(delimiter); + String impName = orderProperties[0]; + Double impPrice = Double.parseDouble(orderProperties[1]); + int impQnty = Integer.parseInt(orderProperties[2]); + String impTbl = orderProperties[3]; + Double impTotal = Double.parseDouble(orderProperties[4]); + String impComment = orderProperties[5]; + Date impDate = dateFormat.parse(orderProperties[6]); + Order impOrder = new Order(impName, impPrice, impQnty, impTbl, impComment, impDate); + + orderLog.add(impOrder); + displayList.add(0, impOrder); + } + refreshSearch(searchInner, displayList, searchInnerCol, selectedList); + Alert alert = new Alert(AlertType.INFORMATION); + alert.setTitle("Import Success"); + alert.setHeaderText("Import Success"); + alert.setContentText("Orders successfully imported!"); + alert.showAndWait(); + userLogger.log(Level.FINE, currentUser.getUserName() + + " imported order from an external list to order log."); + } catch (IOException e) { + invalidInputAlert(); + } catch (ParseException p) { + invalidInputAlert(); + } catch (Exception ex) { + Alert alert = new Alert(AlertType.ERROR); + alert.setTitle("Import Error"); + alert.setHeaderText("Import Error"); + alert.setContentText( + "Import failed. Check if file content has the appropriate format. If yes and the error remains, consult the error log."); + alert.showAndWait(); + logger.log(Level.WARNING, "Import failed due to " + ex); + } finally { + + if (csvReader != null) { + try { + csvReader.close(); + } catch (IOException ex) { + logger.log(Level.SEVERE, "" + ex); + } + } + } + } + } + }); + + grid.add(importOrders, 2, 6); + grid.add(new Label("Export selected orders as CSV"), 5, 5); + Button exportOrders = new Button("Export Orders"); + exportOrders.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent exporter) { + if (selectedList.size() > 0) { + // Call toCsvRow for every object in list and + // collect in String + String ordersAsCsv = selectedList.stream().map(Order::toCsvRow) + .collect(Collectors.joining(System.getProperty("line.separator"))); + FileWriter csvFw = null; + BufferedWriter csvWriter = null; + try { + csvFw = new FileWriter(csvPath); + csvWriter = new BufferedWriter(csvFw); + csvWriter.write(ordersAsCsv); + + Alert alert = new Alert(AlertType.INFORMATION); + alert.setTitle("Export success"); + alert.setHeaderText("Export success"); + alert.setContentText("Selected orders successfully exported!"); + + alert.showAndWait(); + + } catch (IOException ex) { + logger.log(Level.SEVERE, "" + ex); + } finally { + try { + if (csvWriter != null) + csvWriter.close(); + if (csvFw != null) + csvFw.close(); + } catch (IOException e) { + logger.log(Level.SEVERE, "" + e); + } + } + } else { + Alert alert = new Alert(AlertType.ERROR); + alert.setTitle("Invalid Selection"); + alert.setHeaderText("Invalid Selection"); + alert.setContentText("No selected orders registered. Please select orders to be exported."); + alert.showAndWait(); + } + } + }); + grid.add(exportOrders, 5, 6); + + ButtonType saveButton = new ButtonType("Done", ButtonData.OK_DONE); + dialog.getDialogPane().getButtonTypes().addAll(saveButton); + dialog.getDialogPane().setContent(grid); + Optional result = dialog.showAndWait(); + if (result.isPresent() && result.get() == saveButton) { + try { + // Creates new order log + FileOutputStream fileOut = new FileOutputStream(orderLogPath); + ObjectOutputStream out = new ObjectOutputStream(fileOut); + out.writeObject(orderLog); + out.close(); + fileOut.close(); + } catch (IOException logX2) { + logger.log(Level.WARNING, "" + logX2); + } + } + } + }); + + vMenu.getChildren().addAll(allOrders, account); + + // Manager menu section, only available if user is admin type + if (currentUser.getUserRights()) { + vMenu.setPrefSize(vMenuWidth, paneHeight - vManagerHeight); + vManager = new VBox(15); + vManager.setPadding(new Insets(25)); + // vManager.setStyle("-fx-background-color: #a0522d;"); + vManager.setAlignment(Pos.TOP_CENTER); + vManager.setPrefSize(vMenuWidth, vManagerHeight - 10); + vManager.setLayoutY(paneHeight - vManagerHeight + 10); + + manageUsers = new Button("Manage Users"); + manageUsers.setPrefSize(btnWidth, btnHeight); + manageUsers.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent useravt) { + Dialog dialog = new Dialog(); + dialog.setTitle("Manage Users"); + dialog.setHeaderText("Choose any of the actions below"); + + GridPane grid = new GridPane(); + grid.setHgap(10); + grid.setVgap(10); + + TextField userName = new TextField(); + ObservableList userTypes = FXCollections.observableArrayList("Standard", "Admin"); + + final ComboBox userSelect = new ComboBox(userTypes); + userSelect.getSelectionModel().selectFirst(); + + GridPane userInner = new GridPane(); + Format.innergrid(userInner); + int userInnerCol = 3; + for (int i = 0; i < userInnerCol; i++) { + ColumnConstraints column = new ColumnConstraints(100); + userInner.getColumnConstraints().add(column); + } + // ArrayList localList = new + // ArrayList(usersList); + refreshUsers(userInner, usersList); + ScrollPane userInnerScrl = new ScrollPane(); + userInnerScrl.setVbarPolicy(ScrollBarPolicy.ALWAYS); + userInnerScrl.setPrefHeight(150); + userInnerScrl.setContent(userInner); + + Button addUser = new Button("Add"); + addUser.setTooltip(new Tooltip("Default password for new user is empty")); + addUser.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent userat) { + if (userName.getText().equals("")) { + invalidInputAlert(); + } else { + String name = userName.getText(); + boolean doubleEntry = false; + // Check if user exists already + for (int j = 0; j < usersList.size(); j++) { + if (usersList.get(j).getUserName().equals(name)) { + doubleEntry = true; + Alert alert = new Alert(AlertType.ERROR); + alert.setTitle("Invalid Input Error"); + alert.setHeaderText("Double Entry Error"); + alert.setContentText("This user already exists! No new user created."); + alert.showAndWait(); + break; + } + } + if (!doubleEntry) { + boolean type; + if (userSelect.getValue().equals("Admin")) { + type = true; + } else { + type = false; + } + User user = new User(name, "", type); + usersList.add(user); + refreshUsers(userInner, usersList); + try { + FileOutputStream fileOut = new FileOutputStream(userPath); + ObjectOutputStream out = new ObjectOutputStream(fileOut); + out.writeObject(usersList); + userLogger.log(Level.FINE, "Added new user " + userName.getText() + " of type " + + userSelect.getValue() + " to the system."); + out.close(); + fileOut.close(); + } catch (IOException i) { + logger.log(Level.SEVERE, "" + i); + } + } + } + } + }); + + grid.add(new Label("User Name"), 0, 0); + grid.add(new Label("User Type"), 1, 0); + grid.add(userName, 0, 1); + grid.add(userSelect, 1, 1); + grid.add(addUser, 2, 1); + grid.add(new Label("Existing users"), 0, 2); + grid.add(userInnerScrl, 0, 3, 3, 1); + + ButtonType saveButton = new ButtonType("Done", ButtonData.OK_DONE); + dialog.getDialogPane().getButtonTypes().addAll(saveButton); + dialog.getDialogPane().setContent(grid); + dialog.showAndWait(); + } + }); + addMenubook = new Button("Menubook"); + addMenubook.setPrefSize(btnWidth, btnHeight); + addMenubook.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent at) { + Dialog dialog = new Dialog(); + dialog.setTitle("Menubook Manager"); + dialog.setHeaderText("Make changes to menubook and click save"); + + GridPane grid = new GridPane(); + grid.setHgap(10); + grid.setVgap(10); + + TextField mnuName = new TextField(); + TextField mnuPrice = new TextField(); + Button addMnu = new Button("Add"); + ArrayList localList = new ArrayList(menubook); + addMnu.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent a) { + if (mnuName.getText().equals("") || mnuPrice.getText().equals("")) { + invalidInputAlert(); + } else { + String name = mnuName.getText(); + boolean doubleEntry = false; + // Check if menu exists already + for (int j = 0; j < menubook.size(); j++) { + if (menubook.get(j).getName().equals(name)) { + doubleEntry = true; + Alert alert = new Alert(AlertType.ERROR); + alert.setTitle("Invalid Input Error"); + alert.setHeaderText("Double Entry Error"); + alert.setContentText( + "The item you entered already exists in the menubook. No new item entered."); + alert.showAndWait(); + break; + } + } + if (!doubleEntry) { + try { + // Check if price has more than 2 + // decimals + String numberText = mnuPrice.getText(); + int integerPlaces = numberText.indexOf('.'); + int decimalPlaces; + if (integerPlaces >= 0) { + decimalPlaces = numberText.length() - integerPlaces - 1; + } else { + decimalPlaces = 0; + } + // Check if price is an actual double + Double price = Double.parseDouble(mnuPrice.getText()); + if (price < 0 || decimalPlaces > 2) { + throw new NumberFormatException(); + } + Order newOrder = new Order(name, price); + localList.add(newOrder); + + // Overwrite existing menubook with + // changes + menubook.clear(); + for (int i = 0; i < localList.size(); i++) { + menubook.add(localList.get(i)); + } + // Serialize menubook + try { + FileOutputStream fileOut = new FileOutputStream(menuPath); + ObjectOutputStream out = new ObjectOutputStream(fileOut); + out.writeObject(menubook); + out.close(); + fileOut.close(); + userLogger.log(Level.FINE, + "Added new menu " + mnuName.getText() + " into the system."); + Alert alert = new Alert(AlertType.INFORMATION); + alert.setTitle("Order item added"); + alert.setHeaderText("Order item added"); + alert.setContentText( + "Order item has been successfully added into the menubook and can now be used."); + alert.showAndWait(); + } catch (IOException i) { + logger.log(Level.SEVERE, "" + i); + } + } catch (NumberFormatException n) { + invalidInputAlert(); + } + } + } + } + }); + + Button browseBtn = new Button("Check out existing menubook"); + browseBtn.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent browseat) { + Dialog dialog = new Dialog(); + dialog.setTitle("Menubook"); + dialog.setHeaderText("The following items are in the current menubook"); + + GridPane grid = new GridPane(); + grid.setHgap(10); + grid.setVgap(10); + + TextArea mnuArea = new TextArea(); + mnuArea.setEditable(false); + DecimalFormatSymbols formatSymbols = new DecimalFormatSymbols(Locale.ENGLISH); + DecimalFormat df = new DecimalFormat("##0.00", formatSymbols); + for (int i = 0; i < menubook.size(); i++) { + Order localOrder = menubook.get(i); + mnuArea.appendText("Name: " + localOrder.getName() + ", Price: " + + df.format(localOrder.getPrice()) + "\n"); + } + grid.add(mnuArea, 0, 1); + + ButtonType done = new ButtonType("Done", ButtonData.OK_DONE); + dialog.getDialogPane().getButtonTypes().addAll(done); + + dialog.getDialogPane().setContent(grid); + + Optional result = dialog.showAndWait(); + } + }); + + grid.add(new Label("Menu Name"), 0, 0); + grid.add(new Label("Menu Price"), 1, 0); + grid.add(mnuName, 0, 1); + grid.add(mnuPrice, 1, 1); + grid.add(addMnu, 2, 1); + grid.add(browseBtn, 0, 2); + + // Set the button types. + ButtonType saveButton = new ButtonType("Done", ButtonData.OK_DONE); + dialog.getDialogPane().getButtonTypes().addAll(saveButton); + + dialog.getDialogPane().setContent(grid); + dialog.showAndWait(); + } + }); + + vManager.getChildren().addAll(manageUsers, addMenubook); + root.getChildren().add(vManager); + } + + // Main screen graphical section + tblPane = new Pane(); + tblPane.setPadding(new Insets(5)); + tblPane.setStyle("-fx-background-image: url('main_area.jpg');"); + // tblPane.setStyle("-fx-background-color: #d2b48c;"); + tblPane.setLayoutX(vMenuWidth + 10); + tblPane.setPrefSize(paneWidth - tblPane.getLayoutX(), paneHeight); + + boolean previousTables; + // Load currently occupied tables from currentTables, if any + try { + FileInputStream fileIn = new FileInputStream(tablePath); + ObjectInputStream in = new ObjectInputStream(fileIn); + currentTables = (ArrayList) in.readObject(); + in.close(); + fileIn.close(); + previousTables = true; + } catch (Exception x) { + previousTables = false; + } + + // if no previous tables exist, create dummy tables + // else load previous tables + // Format.table(Table lbl, String text, double posX, double posY, int + // width, int height) + if (previousTables) { + for (int i = 0; i < currentTables.size(); i++) { + lbl = currentTables.get(i); + String n = lbl.getName(); + double x = lbl.getX(), y = lbl.getY(); + Format.table(lbl, n, x, y, tblWidth, tblHeight); + handleTable(lbl); + tblPane.getChildren().add(lbl); + } + } + + double posX, posY = 20; + double mainPaneWidth = paneWidth - tblPane.getLayoutX(); + int tblPadding = 40; + int maxPosLine = 5; + int maxTbls = 15; + + for (int i = 0; i < maxTbls; i++) { + String check = "Table" + (i + 1); + boolean exists = false; + for (int j = 0; j < currentTables.size(); j++) { + if (currentTables.get(j).getName().equals(check)) { + exists = true; + break; + } + } + if (!exists) { + lbl = new Table("Table" + (i + 1)); + posX = (tblPadding + (i % maxPosLine) * (tblWidth + tblPadding)); + posY = tblPadding + (i / maxPosLine) * (tblPadding + tblHeight + tblPadding); + Format.table(lbl, ("Table" + (i + 1)), posX, posY, tblWidth, tblHeight); + handleTable(lbl); + tblPane.getChildren().add(lbl); + } + } + + tblScrlPane = new ScrollPane(); + tblScrlPane.setLayoutX(vMenuWidth + 10); + tblScrlPane.setPrefSize(paneWidth - tblScrlPane.getLayoutX(), paneHeight); + tblScrlPane.setContent(tblPane); + root.getChildren().addAll(vMenu, tblScrlPane); + root.setStyle("-fx-background-image: url('main_area.jpg');"); + // create a new scene with root and set the stage + Scene scene = new Scene(root, paneWidth, paneHeight); + // Align center of scene with window center + Rectangle2D screenBounds = Screen.getPrimary().getVisualBounds(); + stage.setX((screenBounds.getWidth() - paneWidth) / 2); + stage.setY((screenBounds.getHeight() - paneHeight) / 2); + stage.setScene(scene); + stage.show(); + + // (De-)Serialize menubook + try { + FileInputStream fileIn = new FileInputStream(menuPath); + ObjectInputStream in = new ObjectInputStream(fileIn); + menubook = (ArrayList) in.readObject(); + in.close(); + fileIn.close(); + } catch (Exception x) { + Alert alert = new Alert(AlertType.WARNING); + alert.setTitle("Warning"); + alert.setHeaderText("No menubook available"); + alert.setContentText( + "No available menubook has been found. Load menu items or create menu items before using order functionalities."); + alert.showAndWait(); + } + + // (De-)Serialize order log + try { + FileInputStream fileIn = new FileInputStream(orderLogPath); + ObjectInputStream in = new ObjectInputStream(fileIn); + orderLog = (ArrayList) in.readObject(); + in.close(); + fileIn.close(); + } catch (Exception logX) { + logger.log(Level.INFO, "Order log created as no previous log found."); + try { + // Creates new order log + FileOutputStream fileOut = new FileOutputStream(orderLogPath); + ObjectOutputStream out = new ObjectOutputStream(fileOut); + out.writeObject(orderLog); + out.close(); + fileOut.close(); + } catch (IOException logX2) { + logger.log(Level.WARNING, "" + logX2); + } + } + // Confirm ending session and saving current Tables to a file + scene.getWindow().setOnCloseRequest(new EventHandler() { + public void handle(WindowEvent ev) { + Alert alert = new Alert(AlertType.CONFIRMATION); + alert.setTitle("Please confirm"); + alert.setHeaderText("Confirm end of session"); + alert.setContentText("Are you sure you want to log out?"); + + Optional result = alert.showAndWait(); + if (result.get() == ButtonType.OK) { + if (!(currentTables.isEmpty())) { + serialize(currentTables); + } + try { + // Creates new order log + FileOutputStream fileOut = new FileOutputStream(orderLogPath); + ObjectOutputStream out = new ObjectOutputStream(fileOut); + out.writeObject(orderLog); + out.close(); + fileOut.close(); + } catch (IOException logX2) { + logger.log(Level.WARNING, "" + logX2); + } + userLogger.log(Level.FINE, currentUser.getUserName() + " has logged out."); + fhUser.close(); + fhLog.close(); + // Let Window Closer if OK + } else { + ev.consume(); + } + } + + }); + + } + + /** + * Add table handlers. + * + * @param lbl + * the lbl + */ + // Table constructor section + private void handleTable(Table lbl) { + lbl.setOnMousePressed(tablePressedHandler); + lbl.setOnMouseClicked(tableMenuHandler); + lbl.setTooltip(new Tooltip("Click on table to add order")); + } + + /** The current tables. */ + // Serialization section + private ArrayList
currentTables = new ArrayList
(); + + /** The table path. */ + private final String tablePath = "res/current_tables.ser"; + + /** + * Serialize. + * + * @param currentTables + * the current tables + */ + private void serialize(ArrayList
currentTables) { + try { + FileOutputStream fileOut = new FileOutputStream(tablePath); + ObjectOutputStream out = new ObjectOutputStream(fileOut); + out.writeObject(currentTables); + out.close(); + fileOut.close(); + // Message box "Serialized data is saved in tablePath" + } catch (IOException i) { + logger.log(Level.SEVERE, "" + i); + } + } + + /** The src scene Y. */ + // Table icon movement section + double srcSceneX, srcSceneY; + + /** The src translate Y. */ + double srcTranslateX, srcTranslateY; + + /** The table pressed handler. */ + // get original data + EventHandler tablePressedHandler = new EventHandler() { + @Override + public void handle(MouseEvent evt) { + srcSceneX = evt.getSceneX(); + srcSceneY = evt.getSceneY(); + srcTranslateX = ((Table) evt.getSource()).getTranslateX(); + srcTranslateY = ((Table) evt.getSource()).getTranslateY(); + } + }; + + /** The table menu handler. */ + // Menu Adding Section + EventHandler tableMenuHandler = new EventHandler() { + public void handle(MouseEvent evt) { + if (evt.getButton().equals(MouseButton.PRIMARY)) { + + if (evt.getClickCount() == 1) { + Table selectedTbl = ((Table) evt.getSource()); + // Create the custom dialog. + Dialog dialog = new Dialog(); + dialog.setTitle("Table Menu"); + dialog.setHeaderText(selectedTbl.getText() + " Menu"); + + GridPane grid = new GridPane(); + grid.setHgap(10); + grid.setVgap(10); + + int rowNum = 0, lblRow = 0; + + // Num of people + TextField people = new TextField(); + people.setPromptText("Number of people"); + + // Innergrid to display ordered items + ArrayList localList = new ArrayList(selectedTbl.getOrders()); + // initializing innergrid before addPane so EventListener + // can refresh innergrid + GridPane innergrid = new GridPane(); + Format.innergrid(innergrid); + innergrid.setPrefWidth(600); + innergrid.setPadding(new Insets(0)); + // Setting columns width + String[] innerColumns = { "Menu Name", "Price", "Qnty", "Total", "Comments", "Time added", + "Cancel Order" }; + ColumnConstraints col1 = new ColumnConstraints(); + col1.setPercentWidth(25); + innergrid.getColumnConstraints().add(col1); + ColumnConstraints col2 = new ColumnConstraints(); + col2.setPercentWidth(5); + innergrid.getColumnConstraints().add(col2); + ColumnConstraints col3 = new ColumnConstraints(); + col3.setPercentWidth(5); + innergrid.getColumnConstraints().add(col3); + ColumnConstraints col4 = new ColumnConstraints(); + col4.setPercentWidth(10); + innergrid.getColumnConstraints().add(col4); + ColumnConstraints col5 = new ColumnConstraints(); + col5.setPercentWidth(20); + innergrid.getColumnConstraints().add(col5); + ColumnConstraints col6 = new ColumnConstraints(); + col6.setPercentWidth(20); + innergrid.getColumnConstraints().add(col6); + ColumnConstraints col7 = new ColumnConstraints(); + col7.setPercentWidth(15); + innergrid.getColumnConstraints().add(col7); + + // Populating columns + for (int i = 0; i < innerColumns.length; i++) { + Label menuLbl = new Label(innerColumns[i]); + innergrid.add(menuLbl, i, 0); + } + + // Put innergrid in ScrollPane + ScrollPane innerScrlPane = new ScrollPane(); + innerScrlPane.setVbarPolicy(ScrollBarPolicy.ALWAYS); + innerScrlPane.setPrefHeight(150); + innerScrlPane.setContent(innergrid); + + // Amount due + Label amount = new Label(); + + // Add Orders section + GridPane addPane = new GridPane(); + String[] addColumns = { "Menu Name", "Quantity", "Comments", "Browse Menu", "Add Order" }; + // Populating columns + for (int i = 0; i < addColumns.length; i++) { + Label menuLbl = new Label(addColumns[i]); + addPane.add(menuLbl, i, 0); + } + addPane.prefWidth(600); + addPane.setHgap(10); + TextField addMenuName = new TextField(); + addMenuName.setPrefWidth(200); + addPane.add(addMenuName, 0, 1); + TextField addMenuQnty = new TextField(); + addMenuQnty.setText("1"); + addMenuQnty.setPrefWidth(40); + addPane.add(addMenuQnty, 1, 1); + TextField addMenuComment = new TextField(); + addMenuComment.setPrefWidth(150); + addPane.add(addMenuComment, 2, 1); + Button addBrowseBtn = new Button("Browse"); + addBrowseBtn.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent browseat) { + Dialog dialog = new Dialog(); + dialog.setTitle("Menubook"); + dialog.setHeaderText("The following items are in the current menubook"); + + GridPane grid = new GridPane(); + grid.setHgap(10); + grid.setVgap(10); + + TextArea mnuArea = new TextArea(); + mnuArea.setEditable(false); + for (int i = 0; i < menubook.size(); i++) { + Order localOrder = menubook.get(i); + mnuArea.appendText( + "Name: " + localOrder.getName() + ", Price: " + localOrder.getPrice() + "\n"); + } + grid.add(mnuArea, 0, 1); + + ButtonType done = new ButtonType("Done", ButtonData.OK_DONE); + dialog.getDialogPane().getButtonTypes().addAll(done); + + dialog.getDialogPane().setContent(grid); + + Optional result = dialog.showAndWait(); + } + }); + addBrowseBtn.setPrefWidth(80); + addPane.add(addBrowseBtn, 3, 1); + Button addMenuBtn = new Button("Add Menu"); + addMenuBtn.setPrefWidth(80); + addMenuBtn.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent at) { + if (addMenuName.getText().equals("") || addMenuQnty.getText().equals("")) { + invalidInputAlert(); + } else { + // Match text of menubook with entered text, add + // order if match + String mnuName = addMenuName.getText(); + boolean matchFound = false; + for (int i = 0; i < menubook.size(); i++) { + if (mnuName.equals(menubook.get(i).getName())) { + try { + int qnty = Integer.parseInt(addMenuQnty.getText()); + if (qnty < 0) { + throw new NumberFormatException(); + } + String cmt = addMenuComment.getText(); + String srcTbl = selectedTbl.getName(); + Order tblOrder = new Order(menubook.get(i), qnty, cmt, srcTbl); + localList.add(tblOrder); + matchFound = true; + refreshOrders(innergrid, localList, innerColumns, amount); + } catch (NumberFormatException n) { + break; + } + break; + } + } + if (!matchFound) { + invalidInputAlert(); + } + } + } + }); + addPane.add(addMenuBtn, 4, 1); + + // Order List + // Loops through each order at table and fills label with + // each order information + refreshOrders(innergrid, localList, innerColumns, amount); + + Separator separator1 = new Separator(); + + grid.add(new Label("Number of people: "), 0, lblRow++); + grid.add(people, 1, rowNum++); + grid.add(new Label("Add orders: "), 0, lblRow++); + grid.add(addPane, 1, rowNum++); + grid.add(new Label("Current orders: "), 0, lblRow++); + grid.add(innerScrlPane, 1, rowNum++); + lblRow++; + grid.add(separator1, 1, rowNum++); + grid.add(new Label("Total Amount Due"), 0, lblRow++); + grid.add(amount, 1, rowNum); + + // If table exists already, load text information + if (currentTables.contains(selectedTbl)) { + int srcIndex = currentTables.indexOf(selectedTbl); + Table srcTable = currentTables.get(srcIndex); + people.setText(srcTable.getPeople()); + } + + // Set the button types. + ButtonType saveButton = new ButtonType("Save", ButtonData.OK_DONE); + ButtonType bill = new ButtonType("Pay", ButtonData.OK_DONE); + dialog.getDialogPane().getButtonTypes().addAll(saveButton, bill, ButtonType.CANCEL); + dialog.getDialogPane().setContent(grid); + Optional result = dialog.showAndWait(); + if (result.get() == saveButton) { + // Update Table order list + selectedTbl.setOrders(localList); + // If table exists already, override existing table + if (currentTables.contains(selectedTbl)) { + currentTables.remove(selectedTbl); + } + selectedTbl.setPeople(people.getText()); + currentTables.add(selectedTbl); + userLogger.log(Level.FINE, "Saved changes made at " + selectedTbl.getName()); + + } else if (result.get() == bill) { + for (int i = 0; i < localList.size(); i++) { + orderLog.add(localList.get(i)); + } + selectedTbl.clear(); + currentTables.remove(selectedTbl); + userLogger.log(Level.FINE, "Received payment of table. Orders logged and table cleared."); + } + } + } + } + }; + + /** + * Refresh users. + * + * @param innergrid + * the innergrid + * @param userList + * the user list + */ + private void refreshUsers(GridPane innergrid, ArrayList userList) { + innergrid.getChildren().clear(); + String[] labels = { "Username", "Type", "Activity", "Options" }; + for (int i = 0; i < labels.length; i++) { + Label lbl = new Label(labels[i]); + innergrid.add(lbl, i, 0); + } + for (int i = 1; i <= userList.size(); i++) { + User u = userList.get(i - 1); + String uName = u.getUserName(); + boolean uAdmin = u.getUserRights(); + Label usName = new Label(); + usName.setText(uName); + innergrid.add(usName, 0, i); + Label usType = new Label(); + if (uAdmin) { + usType.setText("Admin"); + } else { + usType.setText("Standard"); + } + innergrid.add(usType, 1, i); + Button viewLog = new Button("View Log"); + viewLog.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent view) { + Dialog dialog = new Dialog(); + dialog.setTitle("User Activity log"); + dialog.setHeaderText("Selected activity log"); + + GridPane grid = new GridPane(); + grid.setHgap(10); + grid.setVgap(10); + + TextArea logArea = new TextArea(); + logArea.setEditable(false); + grid.add(logArea, 0, 1); + int row = innergrid.getRowIndex((Button) view.getSource()); + Label toView = (Label) getNodeByIndex(innergrid, 0, row); + String localPath = ("res/" + toView.getText() + "_activity.log"); + try { + Scanner fileIn = new Scanner(new File(localPath)); + while (fileIn.hasNextLine()) { + logArea.appendText(fileIn.nextLine() + "\n"); + } + fileIn.close(); + } catch (IOException i) { + logger.log(Level.WARNING, + "No activity log for user has been found. User might have deleted his/her log or has never logged in. \n Opening activity log failed due to: \n " + + i); + } + + ButtonType done = new ButtonType("Done", ButtonData.OK_DONE); + dialog.getDialogPane().getButtonTypes().addAll(done); + + dialog.getDialogPane().setContent(grid); + + Optional result = dialog.showAndWait(); + } + }); + innergrid.add(viewLog, 2, i); + // Disable delete button for root admin (the first user) + if (i > 1) { + Button deleteUser = new Button("Delete"); + deleteUser.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent userdlt) { + // Confirm before deletion of user + Alert alert = new Alert(AlertType.CONFIRMATION); + alert.setTitle("Confirm User Deletion"); + alert.setHeaderText("Confirm User Deletion"); + alert.setContentText("Are you sure you want to delete this user?"); + + Optional result = alert.showAndWait(); + if (result.get() == ButtonType.OK) { + @SuppressWarnings("static-access") + int row = innergrid.getRowIndex((Button) userdlt.getSource()); + Label toDelete = (Label) getNodeByIndex(innergrid, 0, row); + String toDeleteName = toDelete.getText(); + for (int n = 0; n < userList.size(); n++) { + String userName = userList.get(n).getUserName(); + if (userName.equals(toDeleteName)) { + userList.remove(n); + userLogger.log(Level.FINE, toDeleteName + " has been deleted from the system."); + break; + } + } + refreshUsers(innergrid, userList); + } + } + }); + innergrid.add(deleteUser, 3, i); + } + } + } + + /** + * Refresh search. + * + * @param innergrid + * the innergrid + * @param ordersList + * the orders list + * @param labels + * the labels + * @param selectedList + * the selected list + */ + private void refreshSearch(GridPane innergrid, ArrayList ordersList, String[] labels, + ArrayList selectedList) { + innergrid.getChildren().clear(); + for (int i = 0; i < labels.length; i++) { + Label menuLbl = new Label(labels[i]); + innergrid.add(menuLbl, i, 0); + } + // { "Table No.", "Order Name", "Price", "Quantity", "Total", "Order + // Datetime", "Comments" } + DecimalFormatSymbols formatSymbols = new DecimalFormatSymbols(Locale.ENGLISH); + DecimalFormat df = new DecimalFormat("##0.00", formatSymbols); + for (int i = 1; i <= ordersList.size(); i++) { + int localCol = 0; + Order mn = ordersList.get(i - 1); + String mnTbl = mn.getSrcTbl(); + String mnName = mn.getName(); + Double mnPrice = mn.getPrice(); + int mnQnty = mn.getQnty(); + Date mnDate = mn.getDate(); + String mnComment = mn.getComment(); + Label menuTbl = new Label(); + menuTbl.setText(mnTbl); + innergrid.add(menuTbl, localCol++, i); + Label menuName = new Label(); + menuName.setText(mnName); + innergrid.add(menuName, localCol++, i); + Label price = new Label(); + price.setText("" + df.format(mnPrice)); + innergrid.add(price, localCol++, i); + Label qnty = new Label(); + qnty.setText("" + mnQnty); + innergrid.add(qnty, localCol++, i); + Label lineTotal = new Label(); + lineTotal.setText("" + df.format(mnPrice * mnQnty)); + innergrid.add(lineTotal, localCol++, i); + Label timeAdded = new Label(); + timeAdded.setText(dateFormat.format(mnDate)); + innergrid.add(timeAdded, localCol++, i); + Label menuComment = new Label(); + menuComment.setText(mnComment); + innergrid.add(menuComment, localCol++, i); + } + if (currentUser.getUserRights()) { + Label menuLbl = new Label("Select"); + innergrid.add(menuLbl, labels.length, 0); + for (int i = 1; i <= ordersList.size(); i++) { + CheckBox checkBox = new CheckBox(); + checkBox.selectedProperty().addListener(new ChangeListener() { + public void changed(ObservableValue ov, Boolean old_val, Boolean new_val) { + // gets row of checkbox selected + int row = innergrid.getRowIndex(checkBox); + int cols = labels.length; + Node[] toExportNodes = getRowNodesByIndex(innergrid, row, cols); + String[] toExport = new String[toExportNodes.length]; + for (int j = 0; j < toExportNodes.length; j++) { + Label l = (Label) toExportNodes[j]; + String s = l.getText(); + toExport[j] = s; + } + // Create new order here + try { + String expTbl = toExport[0]; + String expName = toExport[1]; + Double expPrice = Double.parseDouble(toExport[2]); + int expQnty = Integer.parseInt(toExport[3]); + Date expDate = dateFormat.parse(toExport[5]); + String expComment = toExport[6]; + Order expOrder = new Order(expName, expPrice, expQnty, expTbl, expComment, expDate); + selectedList.add(expOrder); + } catch (ParseException p) { + logger.log(Level.SEVERE, "" + p); + } + checkBox.setDisable(true); + } + }); + innergrid.add(checkBox, 7, i); + } + } + } + + /** + * Refresh orders. + * + * @param innergrid + * the innergrid + * @param ordersList + * the orders list + * @param labels + * the labels + * @param amount + * the amount + */ + private void refreshOrders(GridPane innergrid, ArrayList ordersList, String[] labels, Label amount) { + innergrid.getChildren().clear(); + double netAmount = 0.0; + // Recreating labels + for (int i = 0; i < labels.length; i++) { + Label menuLbl = new Label(labels[i]); + innergrid.add(menuLbl, i, 0); + } + DecimalFormatSymbols formatSymbols = new DecimalFormatSymbols(Locale.ENGLISH); + DecimalFormat df = new DecimalFormat("##0.00", formatSymbols); + for (int i = 1; i <= ordersList.size(); i++) { + int localCol = 0; + Order mn = ordersList.get(i - 1); + String mnName = mn.getName(); + Double mnPrice = mn.getPrice(); + int mnQnty = mn.getQnty(); + Date mnDate = mn.getDate(); + String mnComment = mn.getComment(); + Label menuName = new Label(); + menuName.setText(mnName); + innergrid.add(menuName, localCol++, i); + Label price = new Label(); + price.setText("" + df.format(mnPrice)); + innergrid.add(price, localCol++, i); + Label qnty = new Label(); + qnty.setText("" + mnQnty); + innergrid.add(qnty, localCol++, i); + Label lineTotal = new Label(); + lineTotal.setText("" + df.format(mnPrice * mnQnty)); + innergrid.add(lineTotal, localCol++, i); + Label menuComment = new Label(); + menuComment.setText(mnComment); + innergrid.add(menuComment, localCol++, i); + Label timeAdded = new Label(); + timeAdded.setText(dateFormat.format(mnDate)); + innergrid.add(timeAdded, localCol++, i); + Button deleteOrder = new Button("Delete Order"); + deleteOrder.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent avt) { + // Confirm before deletion of order + Alert alert = new Alert(AlertType.CONFIRMATION); + alert.setTitle("Confirm Order Deletion"); + alert.setHeaderText("Confirm Order Deletion"); + alert.setContentText("Are you sure you want to delete this order?"); + + Optional result = alert.showAndWait(); + if (result.get() == ButtonType.OK) { + @SuppressWarnings("static-access") + int row = innergrid.getRowIndex((Button) avt.getSource()); + Label toDelete = (Label) getNodeByIndex(innergrid, 0, row); + String toDeleteName = toDelete.getText(); + for (int n = 0; n < ordersList.size(); n++) { + String orderName = ordersList.get(n).getName(); + if (orderName.equals(toDeleteName)) { + ordersList.remove(n); + break; + } + } + refreshOrders(innergrid, ordersList, labels, amount); + } + } + }); + innergrid.add(deleteOrder, localCol++, i); + netAmount += (mnPrice * mnQnty); + } + amount.setText("" + df.format(netAmount)); + } + + /** + * Gets the node by index. + * + * @param grid + * the grid + * @param col + * the col + * @param row + * the row + * @return the node by index + */ + private Node getNodeByIndex(GridPane grid, int col, int row) { + for (Node node : grid.getChildren()) { + if (GridPane.getColumnIndex(node) == col && GridPane.getRowIndex(node) == row) { + return node; + } + } + return null; + } + + /** + * Gets the row nodes by index. + * + * @param grid + * the grid + * @param row + * the row + * @param colNum + * the col num + * @return the row nodes by index + */ + private Node[] getRowNodesByIndex(GridPane grid, int row, int colNum) { + Node[] nodes = new Node[colNum]; + int colCount = 0; + for (Node node : grid.getChildren()) { + if (GridPane.getColumnIndex(node) == colCount && GridPane.getRowIndex(node) == row) { + nodes[colCount] = node; + colCount++; + } + if (colCount == colNum) { + return nodes; + } + } + return null; + } + + /** + * Invalid input alert. + */ + private void invalidInputAlert() { + Alert alert = new Alert(AlertType.ERROR); + alert.setTitle("Invalid Input"); + alert.setHeaderText("Invalid Input"); + alert.setContentText("Please enter a valid item. Fields cannot be all empty."); + alert.showAndWait(); + } +} diff --git a/Billing-system/src/billingsystem/Order.java b/Billing-system/src/billingsystem/Order.java new file mode 100644 index 00000000..d3277932 --- /dev/null +++ b/Billing-system/src/billingsystem/Order.java @@ -0,0 +1,170 @@ +package billingsystem; + +import java.io.Serializable; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * + * @author Jason Li + * @version 1.0 + * @since 19.12.2016 + * + * + * + * The Class Order. + */ +public class Order implements Serializable { + + /** The name. */ + private String name; + + /** + * Gets the name. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Sets the name. + * + * @param name2 the new name + */ + public void setName(String name2) { + this.name = name2; + } + + /** The price. */ + private double price; + + /** + * Gets the price. + * + * @return the price + */ + public double getPrice() { + return price; + } + + /** + * Sets the price. + * + * @param price2 the new price + */ + public void setPrice(double price2) { + this.price = price2; + } + + /** The quantity. */ + private int quantity; + + /** + * Gets the order quantity. + * + * @return the order quantity + */ + public int getQnty() { + return quantity; + } + + /** The date. */ + private Date date; + + /** + * Gets the date. + * + * @return the date + */ + public Date getDate() { + return date; + } + + /** The comment. */ + private String comment; + + /** + * Gets the comment. + * + * @return the comment + */ + public String getComment() { + return comment; + } + + /** The source table. */ + private String sourceTable; + + /** + * Gets the source table. + * + * @return the source table + */ + public String getSrcTbl() { + return sourceTable; + } + + /** + * Return each order as a comma delimited row for csv output. + * + * @return the string + */ + public String toCsvRow() { + DateFormat dateFormat = new SimpleDateFormat("HH:mm dd/MM/yyyy"); + return Stream.of(name, ("" + price), ("" + quantity), ("" + sourceTable), ("" + price*quantity), comment, ("" + dateFormat.format(date))) + .collect(Collectors.joining(",")); + } + + /** + * Instantiates a new order. + * + * @param copyOrder the copy order + * @param qnty the order quantity + * @param comment the comment + * @param sourceTable the source table + */ + public Order(Order copyOrder, int qnty, String comment, String sourceTable) { + this.name = copyOrder.name; + this.price = copyOrder.price; + this.quantity = qnty; + this.comment = comment; + this.sourceTable = sourceTable; + this.date = new Date(); + } + + /** + * Instantiates a new order. + * + * @param name the name + * @param price the price + */ + public Order(String name, double price) { + this.name = name; + this.price = price; + } + + + /** + * Instantiates a new order. + * + * @param name the name + * @param price the price + * @param qnty the qnty + * @param srcTable the src table + * @param comment the comment + * @param date the date + */ + public Order(String name, double price, int qnty, String srcTable, String comment, Date date) { + this.name = name; + this.price = price; + this.quantity = qnty; + this.comment = comment; + this.sourceTable = srcTable; + this.date = date; + } +} diff --git a/Billing-system/src/billingsystem/Table.java b/Billing-system/src/billingsystem/Table.java new file mode 100644 index 00000000..bcfeeb88 --- /dev/null +++ b/Billing-system/src/billingsystem/Table.java @@ -0,0 +1,145 @@ +package billingsystem; + +import java.util.ArrayList; + +import javafx.scene.control.Label; + +/** + * + * @author Jason Li + * @version 1.0 + * @since 19.12.2016 + * + * + * + * The Class Table. + */ +public class Table extends Label implements java.io.Serializable { + + /** The tbl name. */ + private String tblName; + + /** The people. */ + private String people; + + /** The orders. */ + ArrayList orders = new ArrayList(); + + /** The pos X. */ + private double posX; + + /** The pos Y. */ + private double posY; + + /** + * Gets the name. + * + * @return the name + */ + public String getName() { + return tblName; + } + + /** + * Gets the orders. + * + * @return the orders + */ + public ArrayList getOrders() { + return orders; + } + + /** + * Set new X and Y. + * + * @param x the x-position + * @param y the y-position + */ + public void setXY(double x, double y) { + this.posX = x; + this.posY = y; + } + + /** + * Gets the x-position. + * + * @return the x + */ + public double getX() { + return posX; + } + + /** + * Gets the y-position. + * + * @return the y + */ + public double getY() { + return posY; + } + + /** + * Sets the number of people at the table. + * + * @param people - Number of people + */ + public void setPeople(String people) { + this.people = people; + } + + /** + * Gets the number of people at the table. + * + * @return people - Number of people + */ + public String getPeople() { + return people; + } + + /** + * Adds the order. + * + * @param order item the order item + */ + public void addOrder(Order orderItem) { + orders.add(orderItem); + } + + /** + * Sets the orders. + * + * @param set new orders + */ + public void setOrders(ArrayList setOrders) { + this.orders = setOrders; + } + + /** + * Clear table + */ + public void clear() { + this.people = ""; + this.orders.clear();; + } + + /** + * Instantiates a new table. + * + * @param tblName the table name + */ + public Table(String tblName) { + this.tblName = tblName; + } + + /** + * Instantiates a new table. + * + * @param copyTable - the table to copy + */ + public Table(Table copyTable) { + this.tblName = copyTable.tblName; + this.posX = copyTable.posX; + this.posY = copyTable.posY; + } + +} diff --git a/Billing-system/src/billingsystem/User.java b/Billing-system/src/billingsystem/User.java new file mode 100644 index 00000000..dd0d6c5d --- /dev/null +++ b/Billing-system/src/billingsystem/User.java @@ -0,0 +1,80 @@ +/* + * + */ +package billingsystem; + +import java.io.Serializable; + +/** + * + * + * + * @author Jason Li + * @version 1.0 + * @since 19.12.2016 + * + * + * + * The Class User. + */ +@SuppressWarnings("serial") +public class User implements Serializable { + + /** The user name. */ + private String userName; + + /** The password. */ + private String password; + + /** The admin rights. */ + private boolean adminRights; + + /** + * Instantiates a new user. + * + * @param userName the user name + * @param password the password + * @param adminRights the admin rights + */ + public User(String userName, String password, boolean adminRights) { + this.userName = userName; + this.password = password; + this.adminRights = adminRights; + } + + /** + * Gets the user name. + * + * @return the user name + */ + public String getUserName() { + return userName; + } + + /** + * Gets the user password. + * + * @return the user password + */ + public String getUserPassword() { + return password; + } + + /** + * Sets the password. + * + * @param password the new password + */ + public void setPassword(String password) { + this.password = password; + } + + /** + * Gets the user rights. + * + * @return the user rights + */ + public boolean getUserRights() { + return adminRights; + } +} diff --git a/Billing-system/src/billingsystem/login.css b/Billing-system/src/billingsystem/login.css new file mode 100644 index 00000000..537feecb --- /dev/null +++ b/Billing-system/src/billingsystem/login.css @@ -0,0 +1,3 @@ +#pane { + -fx-background-image:url('login.jpg'); +} \ No newline at end of file diff --git a/Billing-system/src/billingsystem/login.jpg b/Billing-system/src/billingsystem/login.jpg new file mode 100644 index 00000000..7d2fe852 Binary files /dev/null and b/Billing-system/src/billingsystem/login.jpg differ diff --git a/Billing-system/src/systemstyle/Format.java b/Billing-system/src/systemstyle/Format.java new file mode 100644 index 00000000..9834720b --- /dev/null +++ b/Billing-system/src/systemstyle/Format.java @@ -0,0 +1,48 @@ +package systemstyle; + +import billingsystem.Table; +import javafx.event.EventHandler; +import javafx.geometry.Insets; +import javafx.geometry.Pos; +import javafx.scene.Cursor; +import javafx.scene.input.MouseEvent; +import javafx.scene.layout.GridPane; + +/** + * The Class Format manages the styling of the system. + */ +public class Format { + + /** + * Formats the innergrid. + * + * @param innergrid the inner gridpane + */ + public static void innergrid(GridPane innergrid) { + innergrid.setVgap(10); + innergrid.setMinHeight(150); + innergrid.setStyle("-fx-border-color: #A9A9A9;"); + innergrid.setPadding(new Insets(10)); + } + + /** + * Formats the table. + * + * @param lbl the table label + * @param text the table text + * @param posX the table x-position + * @param posY the table y-position + * @param width the table width + * @param height the table height + */ + public static void table(Table lbl, String text, double posX, double posY, int width, int height) { + lbl.setText(text); + lbl.setLayoutX(posX); + lbl.setLayoutY(posY); + lbl.setXY(posX, posY); + lbl.setAlignment(Pos.CENTER); + lbl.setPrefSize(width, height); + lbl.setStyle("-fx-background-color: #3F250B; -fx-text-fill: a9a9a9; -fx-font-weight: bold;"); + lbl.setCursor(Cursor.HAND); + } +} diff --git a/BinaryDecimalConverto/convertor.java b/BinaryDecimalConverto/convertor.java new file mode 100644 index 00000000..21522b61 --- /dev/null +++ b/BinaryDecimalConverto/convertor.java @@ -0,0 +1,33 @@ +import java.util.Scanner; + +public class BinaryDecimalConverter { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + + System.out.println("Binary to Decimal and Decimal to Binary Converter"); + System.out.print("Enter 1 to convert Binary to Decimal or 2 to convert Decimal to Binary: "); + int choice = scanner.nextInt(); + + if (choice == 1) { + System.out.print("Enter a binary number: "); + String binaryInput = scanner.next(); + int decimalResult = binaryToDecimal(binaryInput); + System.out.println("Decimal result: " + decimalResult); + } else if (choice == 2) { + System.out.print("Enter a decimal number: "); + int decimalInput = scanner.nextInt(); + String binaryResult = decimalToBinary(decimalInput); + System.out.println("Binary result: " + binaryResult); + } else { + System.out.println("Invalid choice. Please enter 1 for Binary to Decimal or 2 for Decimal to Binary."); + } + } + + public static int binaryToDecimal(String binary) { + return Integer.parseInt(binary, 2); + } + + public static String decimalToBinary(int decimal) { + return Integer.toBinaryString(decimal); + } +} diff --git a/BinaryDecimalConverto/readme.md b/BinaryDecimalConverto/readme.md new file mode 100644 index 00000000..064806c7 --- /dev/null +++ b/BinaryDecimalConverto/readme.md @@ -0,0 +1,20 @@ +# Binary to Decimal and Decimal to Binary Converter + +This is a simple Java program that allows you to convert between Binary and Decimal numbers. + +## How to Use + +1. Compile and run `BinaryDecimalConverter.java`. +2. Choose option 1 to convert Binary to Decimal or option 2 to convert Decimal to Binary. +3. Follow the on-screen instructions to enter the number for conversion. + +## Features + +- Converts Binary to Decimal and Decimal to Binary. +- Simple command-line interface for ease of use. + +## Technologies Used + +- Java + +Feel free to modify the code or integrate it into other Java applications as needed. diff --git a/Binary_Search.java b/Binary_Search.java new file mode 100644 index 00000000..fbebca0c --- /dev/null +++ b/Binary_Search.java @@ -0,0 +1,40 @@ +public class Main{ + + public static int binarySearch(int array[], int left, int right, int item){ + + if (right >= left){ + + // calculation of new mid + int mid = left + (right - left)/2; + + // returns position where found + if (array[mid] == item) + return mid+1; + + // goes to recursive calls in left half + if (array[mid] > item) + return binarySearch(array, left, mid-1, item); + + // goes to recursive calls in right half + else + return binarySearch(array, mid+1, right, item); + } + // if element is not found we return -1 + else + return -1; + } + public static void main(String args[]){ + + int[ ] array = {10, 20, 30, 40, 50, 60, 70, 80}; + int item = 70; + int size = array.length; + + int position = binarySearch(array, 0, size-1, item); + + if(position == -1) + System.out.println("Element not found"); + else + System.out.println("The value " + item + " found at position: " + position); + + } +} diff --git a/Bino.java b/Bino.java new file mode 100644 index 00000000..d2b8d9d3 --- /dev/null +++ b/Bino.java @@ -0,0 +1,52 @@ +import java.util.Scanner; + +class Bino { + int p, m, e, w; + int comb; + Scanner sc = new Scanner(System.in); + + Bino() { + p = 0; + m = 0; + } + + void input() { + System.out.println("Enter the first number (p): "); + p = sc.nextInt(); + System.out.println("Enter the second number (m): "); + m = sc.nextInt(); + System.out.println("Enter the highest power (w): "); + w = sc.nextInt(); + System.out.println("Enter the lowest power (e): "); + e = sc.nextInt(); + } + + int fact(int x) { + int s = 1; + for (int i = 1; i <= x; i++) { + s = s * i; + } + return s; + } + + int compute() { + int a = fact(p); + int b = fact(m); + int k = fact(p - m); + comb = a / (b * k); + return comb; + } + + void bmial() { + int d = compute(); + System.out.print(d + " * " + Math.pow(p, w) + " * " + Math.pow(m, e)); + w--; + e++; + } + + public static void main(String[] args) { + Bino ob = new Bino(); + ob.input(); + ob.bmial(); + } +} diff --git a/BlogBackend-main/README.md b/BlogBackend-main/README.md new file mode 100644 index 00000000..64d90883 --- /dev/null +++ b/BlogBackend-main/README.md @@ -0,0 +1 @@ +# BlogBackend diff --git a/BlogBackend-main/blog-api-com/images/68319588-f3d6-4a3c-9888-e4886d6ae896.jpg b/BlogBackend-main/blog-api-com/images/68319588-f3d6-4a3c-9888-e4886d6ae896.jpg new file mode 100644 index 00000000..c4b1ae33 Binary files /dev/null and b/BlogBackend-main/blog-api-com/images/68319588-f3d6-4a3c-9888-e4886d6ae896.jpg differ diff --git a/BlogBackend-main/blog-api-com/pom.xml b/BlogBackend-main/blog-api-com/pom.xml new file mode 100644 index 00000000..d8f75a46 --- /dev/null +++ b/BlogBackend-main/blog-api-com/pom.xml @@ -0,0 +1,85 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.7.1 + + + com.suraj.blog + blogging-app-apis + 0.0.1-SNAPSHOT + demo + Backend api application + + 11 + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-devtools + runtime + true + + + mysql + mysql-connector-java + runtime + + + org.projectlombok + lombok + true + + + + org.modelmapper + modelmapper + 3.1.0 + + + + + org.springframework.boot + spring-boot-starter-validation + + + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + + + + + + diff --git a/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/BlogApplication.java b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/BlogApplication.java new file mode 100644 index 00000000..d7c49f11 --- /dev/null +++ b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/BlogApplication.java @@ -0,0 +1,19 @@ +package com.suraj.blog; + +import org.modelmapper.ModelMapper; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; + +@SpringBootApplication +public class BlogApplication { + + public static void main(String[] args) { + SpringApplication.run(BlogApplication.class, args); + } + + @Bean + public ModelMapper modelMapper() { + return new ModelMapper(); + } +} diff --git a/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/config/AppConstant.java b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/config/AppConstant.java new file mode 100644 index 00000000..c204eeef --- /dev/null +++ b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/config/AppConstant.java @@ -0,0 +1,8 @@ +package com.suraj.blog.config; + +public class AppConstant { + public static final String PAGE_NUMBER = "0"; + public static final String PAGE_SIZE = "5"; + public static final String SORT_BY = "postId"; + public static final String SORT_DIR = "A"; +} diff --git a/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/config/RestURIConstant.java b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/config/RestURIConstant.java new file mode 100644 index 00000000..a5db4e90 --- /dev/null +++ b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/config/RestURIConstant.java @@ -0,0 +1,7 @@ +package com.suraj.blog.config; + + + +public class RestURIConstant { + +} diff --git a/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/controller/CategoryController.java b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/controller/CategoryController.java new file mode 100644 index 00000000..3f4cb747 --- /dev/null +++ b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/controller/CategoryController.java @@ -0,0 +1,62 @@ +package com.suraj.blog.controller; + +import java.util.List; + +import javax.validation.Valid; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.suraj.blog.payload.ApiResponse; +import com.suraj.blog.payload.CategoryDTO; +import com.suraj.blog.service.CategoryService; + +@RestController +@RequestMapping("/api/categories/") +public class CategoryController { + + @Autowired + private CategoryService categoryService; + + @PostMapping("/") + public ResponseEntity createCategory(@Valid @RequestBody CategoryDTO categoryDTO) { + CategoryDTO newCategory = this.categoryService.createCategory(categoryDTO); + return new ResponseEntity(newCategory, HttpStatus.CREATED); + } + + @PutMapping("/{catId}") + public ResponseEntity updateCategory(@Valid @RequestBody CategoryDTO categoryDTO, + @PathVariable Integer catId) { + CategoryDTO newCategory = this.categoryService.updateCategory(categoryDTO, catId); + return new ResponseEntity(newCategory, HttpStatus.OK); + } + + @DeleteMapping("/{catId}") + public ResponseEntity deleteCategory(@PathVariable Integer catId) { + this.categoryService.delterCategory(catId); + return new ResponseEntity(new ApiResponse("Category Deleted Successfully !!", true), + HttpStatus.OK); + } + + @GetMapping("/{catId}") + public ResponseEntity getCategory(@PathVariable Integer catId) { + CategoryDTO category = this.categoryService.getCategory(catId); + return new ResponseEntity(category, HttpStatus.OK); + } + + @GetMapping("/") + public ResponseEntity> getAllCategory(){ + List dtos = this.categoryService.getAllCategory(); + return new ResponseEntity>(dtos, HttpStatus.OK); + } + + +} diff --git a/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/controller/CommentController.java b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/controller/CommentController.java new file mode 100644 index 00000000..2f775355 --- /dev/null +++ b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/controller/CommentController.java @@ -0,0 +1,34 @@ +package com.suraj.blog.controller; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.suraj.blog.payload.ApiResponse; +import com.suraj.blog.payload.CommentDto; +import com.suraj.blog.service.CommentService; + +@RestController +@RequestMapping("/api") +public class CommentController { + + @Autowired + private CommentService commentService ; + + @PostMapping("/post/{postId}/comments") + public ResponseEntity createComment(@RequestBody CommentDto comment, @PathVariable Integer postId){ + CommentDto createdComment = this.commentService.createComment(comment, postId); + return new ResponseEntity(createdComment, HttpStatus.CREATED); + } + + @DeleteMapping("/comments/{commentId}") + public ResponseEntity deleteComment(@PathVariable Integer commentId){ + this.commentService.deleteComment(commentId); + return new ResponseEntity(new ApiResponse("Comment Deleted Succesfully!", true), HttpStatus.OK); + } +} diff --git a/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/controller/PostContoller.java b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/controller/PostContoller.java new file mode 100644 index 00000000..4bd4831b --- /dev/null +++ b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/controller/PostContoller.java @@ -0,0 +1,129 @@ +package com.suraj.blog.controller; + +import java.io.IOException; +import java.io.InputStream; +import java.util.List; + +import javax.servlet.http.HttpServletResponse; + +import org.hibernate.engine.jdbc.StreamUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +import com.suraj.blog.config.AppConstant; +import com.suraj.blog.payload.ApiResponse; +import com.suraj.blog.payload.PostDto; +import com.suraj.blog.service.FileService; +import com.suraj.blog.service.PostService; + +@RestController +@RequestMapping("/api/") +public class PostContoller { + + @Autowired + private PostService postService; + + @Autowired + private FileService fileService; + + @Value("${project.image}") + private String path; + + @PostMapping("/user/{userId}/category/{categoryId}/posts") + public ResponseEntity createPost(@RequestBody PostDto postDto, @PathVariable Integer userId, + @PathVariable Integer categoryId) { + + PostDto createPost = this.postService.createPost(postDto, userId, categoryId); + return new ResponseEntity(createPost, HttpStatus.CREATED); + } + + @PutMapping("/user/{userId}/category/{categoryId}/posts") + public ResponseEntity updatePost(@RequestBody PostDto postDto, @PathVariable Integer postId) { + + PostDto updatePost = this.postService.updatePost(postDto, postId); + return new ResponseEntity(updatePost, HttpStatus.CREATED); + } + + @GetMapping("/user/{userId}/posts") + public ResponseEntity> getPostByUser(@PathVariable Integer userId) { + List posts = this.postService.getPostByUser(userId); + return new ResponseEntity>(posts, HttpStatus.OK); + } + + @GetMapping("/category/{categoryId}/posts") + public ResponseEntity> getPostByCategory(@PathVariable Integer categoryId) { + List posts = this.postService.getPostByCategory(categoryId); + return new ResponseEntity>(posts, HttpStatus.OK); + } + + @GetMapping("/posts/{postId}") + public ResponseEntity getPostById(@PathVariable Integer postId) { + PostDto post = this.postService.getPostById(postId); + return new ResponseEntity(post, HttpStatus.OK); + } + + @GetMapping("/posts") + public ResponseEntity> getAllPosts( + @RequestParam(value = "pageNumber", defaultValue = AppConstant.PAGE_NUMBER, required = false) Integer pageNumber, + @RequestParam(value = "pageSize", defaultValue = AppConstant.PAGE_SIZE, required = false ) Integer pageSize, + @RequestParam(value = "sortBy", defaultValue = AppConstant.SORT_BY , required = false)String sortBy, + @RequestParam(value = "sortDir", defaultValue = AppConstant.SORT_DIR, required = false) String sortDir) { + List posts = this.postService.getAllPost(pageNumber, pageSize, sortBy, sortDir); + return new ResponseEntity<>(posts, HttpStatus.OK); + } + + @DeleteMapping("/posts/{postId}") + public ResponseEntity deletePost(@PathVariable Integer postId) { + this.postService.deletePost(postId); + return new ResponseEntity(new ApiResponse("Post Deleted Successfully", true), HttpStatus.OK); + } + + + //search method + @GetMapping("/posts/search/{keyword}") + public ResponseEntity> searchPostByTitle(@PathVariable("keyword") String keyword){ + List posts = this.postService.searchPosts(keyword); + return new ResponseEntity>(posts, HttpStatus.OK); + } + + //post image upload + @PostMapping("/post/image/upload/{postId}") + public ResponseEntity uploadPostImage( + @RequestParam("image" )MultipartFile image , + @PathVariable Integer postId + ) throws IOException{ + + PostDto postDto = this.postService.getPostById(postId); + String fileName = this.fileService.uploadImage(path, image); + + postDto.setImageName(fileName); + PostDto updatedPost = this.postService.updatePost(postDto, postId); + return new ResponseEntity(updatedPost, HttpStatus.OK); + } + + + //method to serve file + @GetMapping(value = "post/image/{imageName}", produces = MediaType.IMAGE_JPEG_VALUE) + public void downloadImage( + @PathVariable("imageName")String imageName, + HttpServletResponse response) throws IOException{ + InputStream resourse = this.fileService.getResource(path, imageName); + response.setContentType(MediaType.IMAGE_JPEG_VALUE); + StreamUtils.copy(resourse, response.getOutputStream()); + } + + +} diff --git a/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/controller/UserController.java b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/controller/UserController.java new file mode 100644 index 00000000..c1960afa --- /dev/null +++ b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/controller/UserController.java @@ -0,0 +1,62 @@ +package com.suraj.blog.controller; + +import java.util.List; + +import javax.validation.Valid; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.suraj.blog.payload.ApiResponse; +import com.suraj.blog.payload.UserDTO; +import com.suraj.blog.service.UserService; + +@RestController +@RequestMapping("/api/users") +public class UserController { + + @Autowired + private UserService userService; + + @GetMapping("/") + public ResponseEntity> getAllUsers(){ + return ResponseEntity.ok(this.userService.getAllUsers()); + } + + @GetMapping("/{userId}") + public ResponseEntity getUser(@PathVariable Integer userId){ + return ResponseEntity.ok(this.userService.getUserById(userId)); + } + + @PostMapping("/") + public ResponseEntity createUser(@Valid @RequestBody UserDTO userDto){ + UserDTO createdUser = this.userService.createUser(userDto); + return new ResponseEntity<>(createdUser, HttpStatus.CREATED); + } + + @PutMapping("/{userId}") + public ResponseEntity updateUser(@Valid @RequestBody UserDTO userDTO, @PathVariable Integer userId){ + + UserDTO updatedUser = this.userService.updateUser(userDTO, userId); + + return ResponseEntity.ok(updatedUser); + } + + + @DeleteMapping("/{userId}") + public ResponseEntity deleteUser(@PathVariable Integer userId){ + this.userService.deleteUser(userId); + return new ResponseEntity(new ApiResponse("User Deleted Successfully", true) , HttpStatus.OK); + } + + +} diff --git a/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/dao/CategoryRepo.java b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/dao/CategoryRepo.java new file mode 100644 index 00000000..e0b03d64 --- /dev/null +++ b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/dao/CategoryRepo.java @@ -0,0 +1,9 @@ +package com.suraj.blog.dao; + +import org.springframework.data.jpa.repository.JpaRepository; + +import com.suraj.blog.entity.Category; + +public interface CategoryRepo extends JpaRepository { + +} diff --git a/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/dao/CommentRepo.java b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/dao/CommentRepo.java new file mode 100644 index 00000000..86952555 --- /dev/null +++ b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/dao/CommentRepo.java @@ -0,0 +1,9 @@ +package com.suraj.blog.dao; + +import org.springframework.data.jpa.repository.JpaRepository; + +import com.suraj.blog.entity.Comment; + +public interface CommentRepo extends JpaRepository{ + +} diff --git a/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/dao/PostRepo.java b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/dao/PostRepo.java new file mode 100644 index 00000000..366293bc --- /dev/null +++ b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/dao/PostRepo.java @@ -0,0 +1,17 @@ +package com.suraj.blog.dao; + +import java.util.List; + +import org.springframework.data.jpa.repository.JpaRepository; + +import com.suraj.blog.entity.Category; +import com.suraj.blog.entity.Post; +import com.suraj.blog.entity.User; + +public interface PostRepo extends JpaRepository { + List findByUser(User user); + + List findByCategory(Category category); + + List findByTitleContaining(String title); +} diff --git a/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/dao/UserRepo.java b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/dao/UserRepo.java new file mode 100644 index 00000000..87efcfe9 --- /dev/null +++ b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/dao/UserRepo.java @@ -0,0 +1,9 @@ +package com.suraj.blog.dao; + +import org.springframework.data.jpa.repository.JpaRepository; + +import com.suraj.blog.entity.User; + +public interface UserRepo extends JpaRepository { + +} diff --git a/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/entity/Category.java b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/entity/Category.java new file mode 100644 index 00000000..d164d6f2 --- /dev/null +++ b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/entity/Category.java @@ -0,0 +1,38 @@ +package com.suraj.blog.entity; + +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Entity +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class Category { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer categoryId; + @Column(name = "title", length = 100, nullable =false) + private String categoryTitle; + @Column(name = "description") + private String categoryDescription; + + @OneToMany(mappedBy = "category" , cascade = CascadeType.ALL, fetch = FetchType.LAZY) + private List posts = new ArrayList<>(); + +} diff --git a/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/entity/Comment.java b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/entity/Comment.java new file mode 100644 index 00000000..27ed9663 --- /dev/null +++ b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/entity/Comment.java @@ -0,0 +1,33 @@ +package com.suraj.blog.entity; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + + +@Entity +@Table(name = "comments") +@Getter +@Setter +@NoArgsConstructor +public class Comment { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private int id; + + private String content; + + @ManyToOne + private Post post; + + + +} diff --git a/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/entity/Post.java b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/entity/Post.java new file mode 100644 index 00000000..1f4a3225 --- /dev/null +++ b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/entity/Post.java @@ -0,0 +1,49 @@ +package com.suraj.blog.entity; + +import java.util.Date; +import java.util.HashSet; +import java.util.Set; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Entity +@Getter +@Setter +@NoArgsConstructor +public class Post { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer postId; + @Column(name="post_title", nullable = false, length = 100) + private String title; + + @Column(length = 10000) + private String content; + + private String imageName; + private Date addedDate; + + @ManyToOne + @JoinColumn(name = "categoryId") + private Category category; + + @ManyToOne + private User user; + + @OneToMany(mappedBy = "post", cascade = CascadeType.ALL) + private Set comments = new HashSet(); + +} diff --git a/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/entity/User.java b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/entity/User.java new file mode 100644 index 00000000..9c558d8a --- /dev/null +++ b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/entity/User.java @@ -0,0 +1,40 @@ +package com.suraj.blog.entity; + +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; + + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Entity +@Table(name = "users") +@Getter +@Setter +@NoArgsConstructor +public class User { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private int id; + @Column(nullable = false, length =100) + private String name; + private String email; + private String password; + private String about; + + @OneToMany(mappedBy = "user" , cascade = CascadeType.ALL, fetch = FetchType.LAZY) + private List posts = new ArrayList<>(); + +} diff --git a/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/exceptions/GlobalExceptionHandler.java b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/exceptions/GlobalExceptionHandler.java new file mode 100644 index 00000000..1e859e46 --- /dev/null +++ b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/exceptions/GlobalExceptionHandler.java @@ -0,0 +1,37 @@ +package com.suraj.blog.exceptions; + +import java.util.HashMap; +import java.util.Map; + +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.FieldError; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestControllerAdvice; + +import com.suraj.blog.payload.ApiResponse; + +@RestControllerAdvice +public class GlobalExceptionHandler { + + @ExceptionHandler(ResourceNotFoundException.class) + public ResponseEntity resourceNotFoundExHandler(ResourceNotFoundException ex){ + String message = ex.getMessage(); + ApiResponse apiResponse = new ApiResponse(message, false); + return new ResponseEntity(apiResponse, HttpStatus.NOT_FOUND); + } + + @ExceptionHandler(MethodArgumentNotValidException.class) + public ResponseEntity> methodArgsNotValidExHandler(MethodArgumentNotValidException ex){ + Map response = new HashMap<>(); + + ex.getBindingResult().getAllErrors().forEach((error)-> { + String fieldName=((FieldError)error).getField(); + String message = error.getDefaultMessage(); + response.put(fieldName, message); + }); + + return new ResponseEntity>(response, HttpStatus.BAD_REQUEST); + } +} diff --git a/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/exceptions/ResourceNotFoundException.java b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/exceptions/ResourceNotFoundException.java new file mode 100644 index 00000000..a59e72c9 --- /dev/null +++ b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/exceptions/ResourceNotFoundException.java @@ -0,0 +1,21 @@ +package com.suraj.blog.exceptions; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class ResourceNotFoundException extends RuntimeException{ + + String resourceName; + String fieldName; + long fieldValue; + public ResourceNotFoundException(String resourceName, String fieldName, long fieldValue) { + super(String.format("%s not found with %s : %s", resourceName, fieldName, fieldValue)); + this.resourceName = resourceName; + this.fieldName = fieldName; + this.fieldValue = fieldValue; + } + + +} diff --git a/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/payload/ApiResponse.java b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/payload/ApiResponse.java new file mode 100644 index 00000000..b924e614 --- /dev/null +++ b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/payload/ApiResponse.java @@ -0,0 +1,15 @@ +package com.suraj.blog.payload; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class ApiResponse { + private String message; + private boolean success; +} diff --git a/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/payload/CategoryDTO.java b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/payload/CategoryDTO.java new file mode 100644 index 00000000..32ee399f --- /dev/null +++ b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/payload/CategoryDTO.java @@ -0,0 +1,23 @@ +package com.suraj.blog.payload; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@NoArgsConstructor +@Getter +@Setter +public class CategoryDTO { + + private Integer categoryId; + @NotBlank + @Size(min=4, message = "Title cannot be less than 4!!") + private String categoryTitle; + + @NotBlank + @Size(min = 10, message = "Description cannot be less than 10 characters !!!") + private String categoryDescription; +} diff --git a/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/payload/CommentDto.java b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/payload/CommentDto.java new file mode 100644 index 00000000..79f15bee --- /dev/null +++ b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/payload/CommentDto.java @@ -0,0 +1,13 @@ +package com.suraj.blog.payload; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class CommentDto { + + private int id; + + private String content; +} diff --git a/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/payload/PostDto.java b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/payload/PostDto.java new file mode 100644 index 00000000..9e5f6caf --- /dev/null +++ b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/payload/PostDto.java @@ -0,0 +1,26 @@ +package com.suraj.blog.payload; + +import java.util.HashSet; +import java.util.Set; + +import com.suraj.blog.entity.Comment; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +public class PostDto { + + private Integer postId; + private String title; + private String content; + private String imageName; + private String addedDate; + private CategoryDTO category; + private UserDTO user; + private Set comments=new HashSet<>(); + +} diff --git a/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/payload/UserDTO.java b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/payload/UserDTO.java new file mode 100644 index 00000000..2c18b55b --- /dev/null +++ b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/payload/UserDTO.java @@ -0,0 +1,27 @@ +package com.suraj.blog.payload; + +import javax.validation.constraints.Email; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@NoArgsConstructor +@Getter +@Setter +public class UserDTO { + private int id; + @NotEmpty + @Size(min=4, message = "User name should be min of 4 characters !!") + private String name; + @Email(message = "Please enter valid Email address !!") + private String email; + @NotEmpty + @Size(min=8, max=20, message = "Please Enter password between 8 to 20 chracters !!") + private String password; + @NotEmpty + private String about; +} diff --git a/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/service/CategoryService.java b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/service/CategoryService.java new file mode 100644 index 00000000..7e515501 --- /dev/null +++ b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/service/CategoryService.java @@ -0,0 +1,20 @@ +package com.suraj.blog.service; + +import java.util.List; + +import com.suraj.blog.payload.CategoryDTO; + +public interface CategoryService { + + CategoryDTO createCategory(CategoryDTO categoryDTO); + + CategoryDTO updateCategory(CategoryDTO categoryDTO, Integer catId); + + void delterCategory(Integer categoryId); + + CategoryDTO getCategory(Integer categoryId); + + List getAllCategory(); + + +} diff --git a/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/service/CommentService.java b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/service/CommentService.java new file mode 100644 index 00000000..88c86bf7 --- /dev/null +++ b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/service/CommentService.java @@ -0,0 +1,10 @@ +package com.suraj.blog.service; + +import com.suraj.blog.payload.CommentDto; + +public interface CommentService { + + CommentDto createComment(CommentDto commentDto, Integer postId); + + void deleteComment(Integer commentId); +} diff --git a/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/service/FileService.java b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/service/FileService.java new file mode 100644 index 00000000..e35c9bc8 --- /dev/null +++ b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/service/FileService.java @@ -0,0 +1,14 @@ +package com.suraj.blog.service; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; + +import org.springframework.web.multipart.MultipartFile; + +public interface FileService { + + String uploadImage(String path, MultipartFile file) throws IOException; + + InputStream getResource(String path, String fileName) throws FileNotFoundException; +} diff --git a/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/service/PostService.java b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/service/PostService.java new file mode 100644 index 00000000..00cef3af --- /dev/null +++ b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/service/PostService.java @@ -0,0 +1,25 @@ +package com.suraj.blog.service; + +import java.util.List; + +import com.suraj.blog.entity.Post; +import com.suraj.blog.payload.PostDto; + +public interface PostService { + + PostDto createPost(PostDto postDto, Integer userId, Integer categoryId); + + PostDto updatePost(PostDto postDto, Integer postId); + + void deletePost(Integer postId); + + List getAllPost(Integer pageNumber, Integer pageSize, String sortBy, String sortDir); + + PostDto getPostById(Integer postId); + + List getPostByCategory(Integer categoryId); + + List getPostByUser(Integer userId); + + List searchPosts(String Keyword); +} diff --git a/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/service/UserService.java b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/service/UserService.java new file mode 100644 index 00000000..970a1021 --- /dev/null +++ b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/service/UserService.java @@ -0,0 +1,13 @@ +package com.suraj.blog.service; + +import java.util.List; + +import com.suraj.blog.payload.UserDTO; + +public interface UserService { + UserDTO createUser(UserDTO userDTO); + UserDTO updateUser(UserDTO userDTO, Integer userID); + UserDTO getUserById(Integer userId); + List getAllUsers(); + void deleteUser(Integer userId); +} diff --git a/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/service/impl/CategoryServiceImpl.java b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/service/impl/CategoryServiceImpl.java new file mode 100644 index 00000000..c701bbe0 --- /dev/null +++ b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/service/impl/CategoryServiceImpl.java @@ -0,0 +1,74 @@ +package com.suraj.blog.service.impl; + +import java.util.List; +import java.util.stream.Collectors; + +import org.modelmapper.ModelMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.suraj.blog.dao.CategoryRepo; +import com.suraj.blog.entity.Category; +import com.suraj.blog.exceptions.ResourceNotFoundException; +import com.suraj.blog.payload.CategoryDTO; +import com.suraj.blog.service.CategoryService; + +@Service +public class CategoryServiceImpl implements CategoryService { + + @Autowired + private CategoryRepo categoryRepo; + + @Autowired + private ModelMapper modelMapper; + + @Override + public CategoryDTO createCategory(CategoryDTO categoryDTO) { + Category category = categoryDtoToEntityt(categoryDTO); + this.categoryRepo.save(category); + CategoryDTO newCategoryDTO = categoryEntityToDto(category); + return newCategoryDTO; + } + + + + @Override + public CategoryDTO updateCategory(CategoryDTO categoryDTO, Integer catId) { + Category category = this.categoryRepo.findById(catId).orElseThrow(()->new ResourceNotFoundException("Category", "categoryId", catId)); + category.setCategoryTitle(categoryDTO.getCategoryTitle()); + category.setCategoryDescription(categoryDTO.getCategoryDescription()); + + Category updatedCategory = this.categoryRepo.save(category); + + return this.categoryEntityToDto(updatedCategory); + } + + @Override + public void delterCategory(Integer catId) { + Category category = this.categoryRepo.findById(catId).orElseThrow(()->new ResourceNotFoundException("Category", "categoryId", catId)); + this.categoryRepo.delete(category); + } + + @Override + public CategoryDTO getCategory(Integer catId) { + Category category = this.categoryRepo.findById(catId).orElseThrow(()->new ResourceNotFoundException("Category", "categoryId", catId)); + return this.categoryEntityToDto(category); + } + + @Override + public List getAllCategory() { + List categories = this.categoryRepo.findAll(); + List categoryDTOs = categories.stream().map(cat -> this.categoryEntityToDto(cat)).collect(Collectors.toList()); + return categoryDTOs; + } + + public Category categoryDtoToEntityt(CategoryDTO categoryDTO) { + return this.modelMapper.map(categoryDTO, Category.class); + } + + public CategoryDTO categoryEntityToDto(Category category) { + return this.modelMapper.map(category, CategoryDTO.class); + } + + +} diff --git a/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/service/impl/CommentServiceImpl.java b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/service/impl/CommentServiceImpl.java new file mode 100644 index 00000000..7fa51d4e --- /dev/null +++ b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/service/impl/CommentServiceImpl.java @@ -0,0 +1,43 @@ +package com.suraj.blog.service.impl; + +import org.modelmapper.ModelMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.suraj.blog.dao.CommentRepo; +import com.suraj.blog.dao.PostRepo; +import com.suraj.blog.entity.Comment; +import com.suraj.blog.entity.Post; +import com.suraj.blog.exceptions.ResourceNotFoundException; +import com.suraj.blog.payload.CommentDto; +import com.suraj.blog.payload.PostDto; +import com.suraj.blog.service.CommentService; + +@Service +public class CommentServiceImpl implements CommentService{ + + @Autowired + private PostRepo postRepo; + @Autowired + private CommentRepo commentRepo; + @Autowired + private ModelMapper modelMapper; + + + @Override + public CommentDto createComment(CommentDto commentDto, Integer postId) { + Post post = this.postRepo.findById(postId).orElseThrow(()->new ResourceNotFoundException("Post", "post Id", postId)); + Comment comment = this.modelMapper.map(commentDto, Comment.class); + comment.setPost(post); + Comment savedComment = this.commentRepo.save(comment); + return this.modelMapper.map(savedComment, CommentDto.class); + } + + + @Override + public void deleteComment(Integer commentId) { + Comment comment = this.commentRepo.findById(commentId).orElseThrow(()-> new ResourceNotFoundException("comment", "comment Id", commentId)); + this.commentRepo.delete(comment); + } + +} diff --git a/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/service/impl/FileServiceImpl.java b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/service/impl/FileServiceImpl.java new file mode 100644 index 00000000..e2e1e2d0 --- /dev/null +++ b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/service/impl/FileServiceImpl.java @@ -0,0 +1,52 @@ +package com.suraj.blog.service.impl; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.UUID; + +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; + +import com.suraj.blog.service.FileService; + +@Service +public class FileServiceImpl implements FileService{ + + @Override + public String uploadImage(String path, MultipartFile file) throws IOException { + + //file name + String name = file.getOriginalFilename(); + String randomId = UUID.randomUUID().toString(); + String fileName1= randomId.concat(name.substring(name.lastIndexOf("."))); + + //fullpath + String filePath = path + File.separator + fileName1; + + //create folder if not created + File f = new File(path); + if(!f.exists()) { + f.mkdir(); + } + + //file copy + Files.copy(file.getInputStream(), Paths.get(filePath)); + return fileName1; + } + + @Override + public InputStream getResource(String path, String fileName) throws FileNotFoundException { + + String fullPath = path + File.separator + fileName; + InputStream is = new FileInputStream(fullPath); + + return is; + } + + +} diff --git a/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/service/impl/PostServiceImpl.java b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/service/impl/PostServiceImpl.java new file mode 100644 index 00000000..37acebf8 --- /dev/null +++ b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/service/impl/PostServiceImpl.java @@ -0,0 +1,143 @@ +package com.suraj.blog.service.impl; + +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + +import org.modelmapper.ModelMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Sort; +import org.springframework.stereotype.Service; + +import com.suraj.blog.dao.CategoryRepo; +import com.suraj.blog.dao.PostRepo; +import com.suraj.blog.dao.UserRepo; +import com.suraj.blog.entity.Category; +import com.suraj.blog.entity.Post; +import com.suraj.blog.entity.User; +import com.suraj.blog.exceptions.ResourceNotFoundException; +import com.suraj.blog.payload.PostDto; +import com.suraj.blog.service.PostService; + +@Service +public class PostServiceImpl implements PostService { + + @Autowired + private PostRepo postRepo; + + @Autowired + private UserRepo userRepo; + + @Autowired + private CategoryRepo categoryRepo; + + @Autowired + private ModelMapper modelMapper; + + @Override + public PostDto createPost(PostDto postDto, Integer userId, Integer categoryId) { + User user = this.userRepo.findById(userId) + .orElseThrow(() -> new ResourceNotFoundException("User", "userId", userId)); + + Category category = this.categoryRepo.findById(categoryId) + .orElseThrow(() -> new ResourceNotFoundException("Category", "categoryId", categoryId)); + + Post post = postDtoToEntity(postDto); + post.setImageName("default.png"); + post.setAddedDate(new Date()); + + post.setUser(user); + post.setCategory(category); + + Post newPost = this.postRepo.save(post); + + return postEntityToDto(newPost); + } + + @Override + public PostDto updatePost(PostDto postDto, Integer postId) { + Post post = this.postRepo.findById(postId) + .orElseThrow(() -> new ResourceNotFoundException("Post", "post id", postId)); + post.setTitle(postDto.getTitle()); + post.setContent(postDto.getContent()); + post.setImageName(postDto.getImageName()); + Post updatedPost = this.postRepo.save(post); + return postEntityToDto(updatedPost); + } + + + @Override + public void deletePost(Integer postId) { + Post post = this.postRepo.findById(postId) + .orElseThrow(() -> new ResourceNotFoundException("Post", "post id", postId)); + this.postRepo.delete(post); + + } + + @Override + public List getAllPost(Integer pageNumber, Integer pageSize, String sortBy, String sortDir) { + Sort sort = null; + if(sortDir.equalsIgnoreCase("a")) { + sort = Sort.by(sortBy).ascending(); + }else { + sort = Sort.by(sortBy).descending(); + } + + Pageable p = PageRequest.of(pageNumber, pageSize, sort); + Page page = this.postRepo.findAll(p); + List posts = page.getContent(); + List postDtos = posts.stream().map(post -> this.modelMapper.map(post, PostDto.class)) + .collect(Collectors.toList()); + return postDtos; + } + + @Override + public PostDto getPostById(Integer postId) { + Post post = this.postRepo.findById(postId) + .orElseThrow(() -> new ResourceNotFoundException("Post", "post id", postId)); + PostDto postDto = postEntityToDto(post); + return postDto; + } + + @Override + public List getPostByCategory(Integer categoryId) { + Category category = this.categoryRepo.findById(categoryId) + .orElseThrow(() -> new ResourceNotFoundException("Category", "categoryId", categoryId)); + List posts = this.postRepo.findByCategory(category); + List postDtos = posts.stream().map(post -> this.modelMapper.map(post, PostDto.class)) + .collect(Collectors.toList()); + return postDtos; + } + + @Override + public List getPostByUser(Integer userId) { + User user = this.userRepo.findById(userId) + .orElseThrow(() -> new ResourceNotFoundException("User", "userId", userId)); + List posts = this.postRepo.findByUser(user); + + List postDtos = posts.stream().map(post -> this.modelMapper.map(post, PostDto.class)) + .collect(Collectors.toList()); + + return postDtos; + } + + @Override + public List searchPosts(String Keyword) { + List posts = this.postRepo.findByTitleContaining(Keyword); + List postDtos = posts.stream().map(post->postEntityToDto(post)).collect(Collectors.toList()); + return postDtos; + } + + public Post postDtoToEntity(PostDto postDto) { + Post post = this.modelMapper.map(postDto, Post.class); + return post; + } + + public PostDto postEntityToDto(Post post) { + PostDto postDto = this.modelMapper.map(post, PostDto.class); + return postDto; + } +} diff --git a/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/service/impl/UserServiceImpl.java b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/service/impl/UserServiceImpl.java new file mode 100644 index 00000000..3beccab7 --- /dev/null +++ b/BlogBackend-main/blog-api-com/src/main/java/com/suraj/blog/service/impl/UserServiceImpl.java @@ -0,0 +1,82 @@ +package com.suraj.blog.service.impl; + +import java.util.List; +import java.util.stream.Collectors; + +import org.modelmapper.ModelMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.suraj.blog.payload.UserDTO; +import com.suraj.blog.service.UserService; +import com.suraj.blog.dao.UserRepo; +import com.suraj.blog.entity.User; +import com.suraj.blog.exceptions.ResourceNotFoundException; + +@Service +public class UserServiceImpl implements UserService { + + @Autowired + private UserRepo userRepo; + + @Autowired + ModelMapper modelMapper; + + @Override + public UserDTO createUser(UserDTO userDTO) { + User user = this.dtoToUser(userDTO); + User savedUser = this.userRepo.save(user); + return this.usertoUserDTO(savedUser); + + } + + @Override + public UserDTO updateUser(UserDTO userDTO, Integer userId) { + User user = this.userRepo.findById(userId) + .orElseThrow(() -> new ResourceNotFoundException("User", "id", userId)); + user.setEmail(userDTO.getEmail()); + user.setName(userDTO.getName()); + user.setAbout(userDTO.getAbout()); + user.setPassword(userDTO.getPassword()); + + User updatedUser = this.userRepo.save(user); + + UserDTO userDTO1 = this.usertoUserDTO(updatedUser); + return userDTO1; + } + + @Override + public UserDTO getUserById(Integer userId) { + User user = this.userRepo.findById(userId) + .orElseThrow(() -> new ResourceNotFoundException("User", "ID", userId)); + return this.usertoUserDTO(user); + } + + @Override + public List getAllUsers() { + List users = this.userRepo.findAll(); + List userDTOs = users.stream().map(user -> this.usertoUserDTO(user)).collect(Collectors.toList()); + + return userDTOs; + } + + @Override + public void deleteUser(Integer userId) { + User user = this.userRepo.findById(userId) + .orElseThrow(() -> new ResourceNotFoundException("User", "id", userId)); + this.userRepo.delete(user); + } + + private User dtoToUser(UserDTO userDTO) { + + User user = this.modelMapper.map(userDTO, User.class); + return user; + + } + + private UserDTO usertoUserDTO(User user) { + UserDTO userDTO = this.modelMapper.map(user, UserDTO.class); + return userDTO; + } + +} diff --git a/BlogBackend-main/blog-api-com/src/main/resources/application.properties b/BlogBackend-main/blog-api-com/src/main/resources/application.properties new file mode 100644 index 00000000..53bda75c --- /dev/null +++ b/BlogBackend-main/blog-api-com/src/main/resources/application.properties @@ -0,0 +1,16 @@ +server.port = 9090 + +#Database Configuration +spring.datasource.url=jdbc:mysql://localhost:3306/blog_app_apis +spring.datasource.username=root +spring.datasource.password=root + +spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL8Dialect + +spring.jpa.hibernate.ddl-auto=update +spring.jpa.show-sql=true + +spring.servlet.multipart.max-file-size= 10MB +spring.servlet.multipart.max-request-size = 10MB + +project.image = images/ \ No newline at end of file diff --git a/BlogBackend-main/blog-api-com/src/test/java/com/suraj/blog/DemoApplicationTests.java b/BlogBackend-main/blog-api-com/src/test/java/com/suraj/blog/DemoApplicationTests.java new file mode 100644 index 00000000..31c8963b --- /dev/null +++ b/BlogBackend-main/blog-api-com/src/test/java/com/suraj/blog/DemoApplicationTests.java @@ -0,0 +1,13 @@ +package com.suraj.blog; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class DemoApplicationTests { + + @Test + void contextLoads() { + } + +} diff --git a/BlogBackend-main/blog-api-com/target/classes/application.properties b/BlogBackend-main/blog-api-com/target/classes/application.properties new file mode 100644 index 00000000..53bda75c --- /dev/null +++ b/BlogBackend-main/blog-api-com/target/classes/application.properties @@ -0,0 +1,16 @@ +server.port = 9090 + +#Database Configuration +spring.datasource.url=jdbc:mysql://localhost:3306/blog_app_apis +spring.datasource.username=root +spring.datasource.password=root + +spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL8Dialect + +spring.jpa.hibernate.ddl-auto=update +spring.jpa.show-sql=true + +spring.servlet.multipart.max-file-size= 10MB +spring.servlet.multipart.max-request-size = 10MB + +project.image = images/ \ No newline at end of file diff --git a/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/BlogApplication.class b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/BlogApplication.class new file mode 100644 index 00000000..3162d97f Binary files /dev/null and b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/BlogApplication.class differ diff --git a/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/config/AppConstant.class b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/config/AppConstant.class new file mode 100644 index 00000000..afa9beda Binary files /dev/null and b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/config/AppConstant.class differ diff --git a/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/config/RestURIConstant.class b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/config/RestURIConstant.class new file mode 100644 index 00000000..2c576d81 Binary files /dev/null and b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/config/RestURIConstant.class differ diff --git a/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/controller/CategoryController.class b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/controller/CategoryController.class new file mode 100644 index 00000000..baa0aa3c Binary files /dev/null and b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/controller/CategoryController.class differ diff --git a/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/controller/CommentController.class b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/controller/CommentController.class new file mode 100644 index 00000000..7bdf9f52 Binary files /dev/null and b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/controller/CommentController.class differ diff --git a/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/controller/PostContoller.class b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/controller/PostContoller.class new file mode 100644 index 00000000..62392216 Binary files /dev/null and b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/controller/PostContoller.class differ diff --git a/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/controller/UserController.class b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/controller/UserController.class new file mode 100644 index 00000000..d18b68a9 Binary files /dev/null and b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/controller/UserController.class differ diff --git a/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/dao/CategoryRepo.class b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/dao/CategoryRepo.class new file mode 100644 index 00000000..22b9a2b3 Binary files /dev/null and b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/dao/CategoryRepo.class differ diff --git a/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/dao/CommentRepo.class b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/dao/CommentRepo.class new file mode 100644 index 00000000..383af67a Binary files /dev/null and b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/dao/CommentRepo.class differ diff --git a/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/dao/PostRepo.class b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/dao/PostRepo.class new file mode 100644 index 00000000..f9b2ad84 Binary files /dev/null and b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/dao/PostRepo.class differ diff --git a/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/dao/UserRepo.class b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/dao/UserRepo.class new file mode 100644 index 00000000..b20ad90b Binary files /dev/null and b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/dao/UserRepo.class differ diff --git a/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/entity/Category.class b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/entity/Category.class new file mode 100644 index 00000000..d378b3c4 Binary files /dev/null and b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/entity/Category.class differ diff --git a/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/entity/Comment.class b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/entity/Comment.class new file mode 100644 index 00000000..73275dec Binary files /dev/null and b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/entity/Comment.class differ diff --git a/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/entity/Post.class b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/entity/Post.class new file mode 100644 index 00000000..52f1708f Binary files /dev/null and b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/entity/Post.class differ diff --git a/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/entity/User.class b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/entity/User.class new file mode 100644 index 00000000..62ea5781 Binary files /dev/null and b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/entity/User.class differ diff --git a/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/exceptions/GlobalExceptionHandler.class b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/exceptions/GlobalExceptionHandler.class new file mode 100644 index 00000000..0773b7c9 Binary files /dev/null and b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/exceptions/GlobalExceptionHandler.class differ diff --git a/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/exceptions/ResourceNotFoundException.class b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/exceptions/ResourceNotFoundException.class new file mode 100644 index 00000000..14147ae8 Binary files /dev/null and b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/exceptions/ResourceNotFoundException.class differ diff --git a/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/payload/ApiResponse.class b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/payload/ApiResponse.class new file mode 100644 index 00000000..fe9a83ad Binary files /dev/null and b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/payload/ApiResponse.class differ diff --git a/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/payload/CategoryDTO.class b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/payload/CategoryDTO.class new file mode 100644 index 00000000..f9983719 Binary files /dev/null and b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/payload/CategoryDTO.class differ diff --git a/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/payload/CommentDto.class b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/payload/CommentDto.class new file mode 100644 index 00000000..eaba5148 Binary files /dev/null and b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/payload/CommentDto.class differ diff --git a/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/payload/PostDto.class b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/payload/PostDto.class new file mode 100644 index 00000000..fb2a42c3 Binary files /dev/null and b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/payload/PostDto.class differ diff --git a/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/payload/UserDTO.class b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/payload/UserDTO.class new file mode 100644 index 00000000..9c41d366 Binary files /dev/null and b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/payload/UserDTO.class differ diff --git a/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/service/CategoryService.class b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/service/CategoryService.class new file mode 100644 index 00000000..d4f05fe7 Binary files /dev/null and b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/service/CategoryService.class differ diff --git a/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/service/CommentService.class b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/service/CommentService.class new file mode 100644 index 00000000..d494ab1b Binary files /dev/null and b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/service/CommentService.class differ diff --git a/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/service/FileService.class b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/service/FileService.class new file mode 100644 index 00000000..a0a3f008 Binary files /dev/null and b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/service/FileService.class differ diff --git a/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/service/PostService.class b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/service/PostService.class new file mode 100644 index 00000000..12eccbec Binary files /dev/null and b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/service/PostService.class differ diff --git a/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/service/UserService.class b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/service/UserService.class new file mode 100644 index 00000000..6eb24778 Binary files /dev/null and b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/service/UserService.class differ diff --git a/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/service/impl/CategoryServiceImpl.class b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/service/impl/CategoryServiceImpl.class new file mode 100644 index 00000000..57fee5ed Binary files /dev/null and b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/service/impl/CategoryServiceImpl.class differ diff --git a/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/service/impl/CommentServiceImpl.class b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/service/impl/CommentServiceImpl.class new file mode 100644 index 00000000..ed27179c Binary files /dev/null and b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/service/impl/CommentServiceImpl.class differ diff --git a/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/service/impl/FileServiceImpl.class b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/service/impl/FileServiceImpl.class new file mode 100644 index 00000000..c60f15ff Binary files /dev/null and b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/service/impl/FileServiceImpl.class differ diff --git a/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/service/impl/PostServiceImpl.class b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/service/impl/PostServiceImpl.class new file mode 100644 index 00000000..1d4c3e05 Binary files /dev/null and b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/service/impl/PostServiceImpl.class differ diff --git a/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/service/impl/UserServiceImpl.class b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/service/impl/UserServiceImpl.class new file mode 100644 index 00000000..077d7d7e Binary files /dev/null and b/BlogBackend-main/blog-api-com/target/classes/com/suraj/blog/service/impl/UserServiceImpl.class differ diff --git a/BlogBackend-main/blog-api-com/target/test-classes/com/suraj/blog/DemoApplicationTests.class b/BlogBackend-main/blog-api-com/target/test-classes/com/suraj/blog/DemoApplicationTests.class new file mode 100644 index 00000000..cb724fcb Binary files /dev/null and b/BlogBackend-main/blog-api-com/target/test-classes/com/suraj/blog/DemoApplicationTests.class differ diff --git a/BluetoothChatApp b/BluetoothChatApp new file mode 160000 index 00000000..4e154d2d --- /dev/null +++ b/BluetoothChatApp @@ -0,0 +1 @@ +Subproject commit 4e154d2dd7f3710eb0ea04f991897899bcefac8e diff --git a/Board.java b/Board.java new file mode 100644 index 00000000..2f9fbaf8 --- /dev/null +++ b/Board.java @@ -0,0 +1,246 @@ +package com.zetcode; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.Toolkit; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import javax.swing.ImageIcon; +import javax.swing.JPanel; +import javax.swing.Timer; + +public class Board extends JPanel implements ActionListener { + + private final int B_WIDTH = 300; + private final int B_HEIGHT = 300; + private final int DOT_SIZE = 10; + private final int ALL_DOTS = 900; + private final int RAND_POS = 29; + private final int DELAY = 140; + + private final int x[] = new int[ALL_DOTS]; + private final int y[] = new int[ALL_DOTS]; + + private int dots; + private int apple_x; + private int apple_y; + + private boolean leftDirection = false; + private boolean rightDirection = true; + private boolean upDirection = false; + private boolean downDirection = false; + private boolean inGame = true; + + private Timer timer; + private Image ball; + private Image apple; + private Image head; + + public Board() { + + initBoard(); + } + + private void initBoard() { + + addKeyListener(new TAdapter()); + setBackground(Color.black); + setFocusable(true); + + setPreferredSize(new Dimension(B_WIDTH, B_HEIGHT)); + loadImages(); + initGame(); + } + + private void loadImages() { + + ImageIcon iid = new ImageIcon("src/resources/dot.png"); + ball = iid.getImage(); + + ImageIcon iia = new ImageIcon("src/resources/apple.png"); + apple = iia.getImage(); + + ImageIcon iih = new ImageIcon("src/resources/head.png"); + head = iih.getImage(); + } + + private void initGame() { + + dots = 3; + + for (int z = 0; z < dots; z++) { + x[z] = 50 - z * 10; + y[z] = 50; + } + + locateApple(); + + timer = new Timer(DELAY, this); + timer.start(); + } + + @Override + public void paintComponent(Graphics g) { + super.paintComponent(g); + + doDrawing(g); + } + + private void doDrawing(Graphics g) { + + if (inGame) { + + g.drawImage(apple, apple_x, apple_y, this); + + for (int z = 0; z < dots; z++) { + if (z == 0) { + g.drawImage(head, x[z], y[z], this); + } else { + g.drawImage(ball, x[z], y[z], this); + } + } + + Toolkit.getDefaultToolkit().sync(); + + } else { + + gameOver(g); + } + } + + private void gameOver(Graphics g) { + + String msg = "Game Over"; + Font small = new Font("Helvetica", Font.BOLD, 14); + FontMetrics metr = getFontMetrics(small); + + g.setColor(Color.white); + g.setFont(small); + g.drawString(msg, (B_WIDTH - metr.stringWidth(msg)) / 2, B_HEIGHT / 2); + } + + private void checkApple() { + + if ((x[0] == apple_x) && (y[0] == apple_y)) { + + dots++; + locateApple(); + } + } + + private void move() { + + for (int z = dots; z > 0; z--) { + x[z] = x[(z - 1)]; + y[z] = y[(z - 1)]; + } + + if (leftDirection) { + x[0] -= DOT_SIZE; + } + + if (rightDirection) { + x[0] += DOT_SIZE; + } + + if (upDirection) { + y[0] -= DOT_SIZE; + } + + if (downDirection) { + y[0] += DOT_SIZE; + } + } + + private void checkCollision() { + + for (int z = dots; z > 0; z--) { + + if ((z > 4) && (x[0] == x[z]) && (y[0] == y[z])) { + inGame = false; + } + } + + if (y[0] >= B_HEIGHT) { + inGame = false; + } + + if (y[0] < 0) { + inGame = false; + } + + if (x[0] >= B_WIDTH) { + inGame = false; + } + + if (x[0] < 0) { + inGame = false; + } + + if (!inGame) { + timer.stop(); + } + } + + private void locateApple() { + + int r = (int) (Math.random() * RAND_POS); + apple_x = ((r * DOT_SIZE)); + + r = (int) (Math.random() * RAND_POS); + apple_y = ((r * DOT_SIZE)); + } + + @Override + public void actionPerformed(ActionEvent e) { + + if (inGame) { + + checkApple(); + checkCollision(); + move(); + } + + repaint(); + } + + private class TAdapter extends KeyAdapter { + + @Override + public void keyPressed(KeyEvent e) { + + int key = e.getKeyCode(); + + if ((key == KeyEvent.VK_LEFT) && (!rightDirection)) { + leftDirection = true; + upDirection = false; + downDirection = false; + } + + if ((key == KeyEvent.VK_RIGHT) && (!leftDirection)) { + rightDirection = true; + upDirection = false; + downDirection = false; + } + + if ((key == KeyEvent.VK_UP) && (!downDirection)) { + upDirection = true; + rightDirection = false; + leftDirection = false; + } + + if ((key == KeyEvent.VK_DOWN) && (!upDirection)) { + downDirection = true; + rightDirection = false; + leftDirection = false; + } + } + } +} + diff --git a/BounceBalls.py b/BounceBalls.py new file mode 100644 index 00000000..795f9eb8 --- /dev/null +++ b/BounceBalls.py @@ -0,0 +1,94 @@ +from tkinter import * # Import tkinter +from random import randint + +# Return a random color string in the form #RRGGBB +def getRandomColor(): + color = "#" + for j in range(6): + color += toHexChar(randint(0, 15)) # Add a random digit + return color + +# Convert an integer to a single hex digit in a character +def toHexChar(hexValue): + if 0 <= hexValue <= 9: + return chr(hexValue + ord('0')) + else: # 10 <= hexValue <= 15 + return chr(hexValue - 10 + ord('A')) + +# Define a Ball class +class Ball: + def __init__(self): + self.x = 0 # Starting center position + self.y = 0 + self.dx = 2 # Move right by default + self.dy = 2 # Move down by default + self.radius = 3 # The radius is fixed + self.color = getRandomColor() # Get random color + +class BounceBalls: + def __init__(self): + self.ballList = [] # Create a list for balls + + window = Tk() # Create a window + window.title("Bouncing Balls") # Set a title + + self.width = 350 # Width of the self.canvas + self.height = 150 # Width of the self.canvas + self.canvas = Canvas(window, bg = "white", + width = self.width, height = self.height) + self.canvas.pack() + + frame = Frame(window) + frame.pack() + btStop = Button(frame, text = "Stop", command = self.stop) + btStop.pack(side = LEFT) + btResume = Button(frame, text = "Resume", + command = self.resume) + btResume.pack(side = LEFT) + btAdd = Button(frame, text = "+", command = self.add) + btAdd.pack(side = LEFT) + btRemove = Button(frame, text = "-", command = self.remove) + btRemove.pack(side = LEFT) + + self.sleepTime = 100 # Set a sleep time + self.isStopped = False + self.animate() + + window.mainloop() # Create an event loop + + def stop(self): # Stop animation + self.isStopped = True + + def resume(self): # Resume animation + self.isStopped = False + self.animate() + + def add(self): # Add a new ball + self.ballList.append(Ball()) + + def remove(self): # Remove the last ball + self.ballList.pop() + + def animate(self): # Move the message + while not self.isStopped: + self.canvas.after(self.sleepTime) # Sleep + self.canvas.update() # Update self.canvas + self.canvas.delete("ball") + + for ball in self.ballList: + self.redisplayBall(ball) + + def redisplayBall(self, ball): + if ball.x > self.width or ball.x < 0: + ball.dx = -ball.dx + + if ball.y > self.height or ball.y < 0: + ball.dy = -ball.dy + + ball.x += ball.dx + ball.y += ball.dy + self.canvas.create_oval(ball.x - ball.radius, + ball.y - ball.radius, ball.x + ball.radius, + ball.y + ball.radius, fill = ball.color, tags = "ball") + +BounceBalls() # Create GUI diff --git a/Brick-Breaker-Game/pom.xml b/Brick-Breaker-Game/pom.xml new file mode 100644 index 00000000..64369fe0 --- /dev/null +++ b/Brick-Breaker-Game/pom.xml @@ -0,0 +1,13 @@ + + + 4.0.0 + com.mycompany + Brick + 1.0-SNAPSHOT + jar + + UTF-8 + 15 + 15 + + \ No newline at end of file diff --git a/Brick-Breaker-Game/src/main/java/com/mycompany/brick/GamePlay.java b/Brick-Breaker-Game/src/main/java/com/mycompany/brick/GamePlay.java new file mode 100644 index 00000000..a95373e2 --- /dev/null +++ b/Brick-Breaker-Game/src/main/java/com/mycompany/brick/GamePlay.java @@ -0,0 +1,213 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.mycompany.brick; + +import javax.swing.JPanel; +import javax.swing.Timer; +import java.awt.Graphics2D; +import java.awt.Rectangle; +import java.awt.Graphics; +import java.awt.Color; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; + +/** + * + * @author chinm + */ +public class GamePlay extends JPanel implements KeyListener, ActionListener { + + private boolean play = false; + private int score = 0; + private int totalbricks = 21; + private Timer Timer; + private int delay = 8; + private int playerX = 310; + private int ballposX = 120; + private int ballposY = 350; + private int ballXdir = -1; + private int ballYdir = -2; + private MapGenerator map; + + public GamePlay() { + map = new MapGenerator(3, 7); + addKeyListener(this); + setFocusable(true); + setFocusTraversalKeysEnabled(false); + Timer = new Timer(delay, this); + Timer.start(); + } + + public void paint(Graphics g) { + g.setColor(Color.black); + g.fillRect(1, 1, 692, 592); + + map.draw((Graphics2D) g); + + g.setColor(Color.yellow); + g.fillRect(0, 0, 3, 592); + g.fillRect(0, 0, 692, 3); + g.fillRect(691, 0, 3, 592); + + g.setColor(Color.white); + g.setFont(new Font("serif", Font.BOLD, 25)); + g.drawString("" + score, 590, 30); + + g.setColor(Color.yellow); + g.fillRect(playerX, 550, 100, 8); + + //ball + g.setColor(Color.GREEN); + g.fillOval(ballposX, ballposY, 20, 20); + + if (ballposY > 570) { + play = false; + ballXdir = 0; + ballYdir = 0; + g.setColor(Color.red); + g.setFont(new Font("serif", Font.BOLD, 30)); + g.drawString(" Game Over Score: " + score, 190, 300); + + g.setFont(new Font("serif", Font.BOLD, 30)); + g.drawString(" Press Enter to Restart", 190, 340); + } + if(totalbricks == 0){ + play = false; + ballYdir = -2; + ballXdir = -1; + g.setColor(Color.red); + g.setFont(new Font("serif",Font.BOLD,30)); + g.drawString(" Game Over: "+score,190,300); + + g.setFont(new Font("serif", Font.BOLD, 30)); + g.drawString(" Press Enter to Restart", 190, 340); + + + } + + g.dispose(); + + + } + + @Override + public void actionPerformed(ActionEvent e) { + Timer.start(); + + if (play) { + if (new Rectangle(ballposX, ballposY, 20, 20).intersects(new Rectangle(playerX, 550, 100, 8))) { + ballYdir = -ballYdir; + } + + A: + for (int i = 0; i < map.map.length; i++) { + for (int j = 0; j < map.map[0].length; j++) { + if (map.map[i][j] > 0) { + int brickX = j * map.bricksWidth + 80; + int brickY = i * map.bricksHeight + 50; + int bricksWidth = map.bricksWidth; + int bricksHeight = map.bricksHeight; + + Rectangle rect = new Rectangle(brickX, brickY, bricksWidth, bricksHeight); + Rectangle ballrect = new Rectangle(ballposX, ballposY, 20, 20); + Rectangle brickrect = rect; + + if (ballrect.intersects(brickrect)) { + map.setBricksValue(0, i, j); + totalbricks--; + score += 5; + if (ballposX + 19 <= brickrect.x || ballposX + 1 >= brickrect.x + bricksWidth) { + ballXdir = -ballXdir; + } else { + ballYdir = -ballYdir; + } + break A; + } + } + + + } + } + + + ballposX += ballXdir; + ballposY += ballYdir; + if (ballposX < 0) { + ballXdir = -ballXdir; + } + if (ballposY < 0) { + ballYdir = -ballYdir; + } + if (ballposX > 670) { + ballXdir = -ballXdir; + } + } + repaint(); + } + + @Override + public void keyTyped(KeyEvent e) { + + } + + + @Override + public void keyReleased(KeyEvent e) { + + } + + @Override + public void keyPressed(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_RIGHT) { + if (playerX >= 600) { + playerX = 600; + } else { + moveRight(); + } + } + if (e.getKeyCode() == KeyEvent.VK_LEFT) { + if (playerX < 10) { + playerX = 10; + } else { + moveLeft(); + } + } + + if (e.getKeyCode() == KeyEvent.VK_ENTER) { + if (!play) { + ballposX = 120; + ballposY = 350; + ballXdir = -1; + ballYdir = -2; + score = 0; + playerX = 310; + totalbricks = 21; + map = new MapGenerator(3, 7); + + repaint(); + } + } + + + } + + public void moveRight () + { + play = true; + playerX += 20; + } + public void moveLeft () + { + play = true; + playerX -= 20; + } + + + +} diff --git a/Brick-Breaker-Game/src/main/java/com/mycompany/brick/MapGenerator.java b/Brick-Breaker-Game/src/main/java/com/mycompany/brick/MapGenerator.java new file mode 100644 index 00000000..1f203c2a --- /dev/null +++ b/Brick-Breaker-Game/src/main/java/com/mycompany/brick/MapGenerator.java @@ -0,0 +1,52 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.mycompany.brick; + +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.Graphics2D; + +/** + * + * @author chinm + */ +public class MapGenerator { + public int map[][]; + public int bricksWidth; + public int bricksHeight; + public MapGenerator(int row , int col){ + map = new int[row][col]; + for (int[] map1 : map) { + for (int j = 0; j < map[0].length; j++) { + map1[j] = 1; + } + } + bricksWidth = 540/col; + bricksHeight = 150/row; + } + public void draw(Graphics2D g) { + for (int i = 0; i < map.length; i++) { + for (int j = 0; j < map[0].length; j++) { + if (map[i][j] > 0) { + g.setColor(Color.red); + g.fillRect(j * bricksWidth + 80, i * bricksHeight + 50, bricksWidth, bricksHeight); + + g.setStroke(new BasicStroke(3)); + g.setColor(Color.black); + g.drawRect(j * bricksWidth + 80, i * bricksHeight + 50, bricksWidth, bricksHeight); + + } + } + + } + } + public void setBricksValue(int value,int row,int col) + { + map[row][col] = value; + + } + +} diff --git a/Brick-Breaker-Game/src/main/java/com/mycompany/brick/MyApp.java b/Brick-Breaker-Game/src/main/java/com/mycompany/brick/MyApp.java new file mode 100644 index 00000000..f3d826e0 --- /dev/null +++ b/Brick-Breaker-Game/src/main/java/com/mycompany/brick/MyApp.java @@ -0,0 +1,26 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.mycompany.brick; + +import javax.swing.JFrame; + +/** + * + * @author chinm + */ +public class MyApp { + public static void main(String[] args) { + JFrame obj = new JFrame(); + GamePlay gameplay = new GamePlay(); + obj.setBounds(10,10,700,600); + obj.setTitle("BrickBreaker"); + obj.setResizable(false); + obj.setVisible(true); + obj.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + obj.add(gameplay); + } + +} diff --git a/Brick-Breaker-Game/target/classes/com/mycompany/brick/GamePlay.class b/Brick-Breaker-Game/target/classes/com/mycompany/brick/GamePlay.class new file mode 100644 index 00000000..c532198d Binary files /dev/null and b/Brick-Breaker-Game/target/classes/com/mycompany/brick/GamePlay.class differ diff --git a/Brick-Breaker-Game/target/classes/com/mycompany/brick/MapGenerator.class b/Brick-Breaker-Game/target/classes/com/mycompany/brick/MapGenerator.class new file mode 100644 index 00000000..5fbb5b15 Binary files /dev/null and b/Brick-Breaker-Game/target/classes/com/mycompany/brick/MapGenerator.class differ diff --git a/Brick-Breaker-Game/target/classes/com/mycompany/brick/MyApp.class b/Brick-Breaker-Game/target/classes/com/mycompany/brick/MyApp.class new file mode 100644 index 00000000..2e211b94 Binary files /dev/null and b/Brick-Breaker-Game/target/classes/com/mycompany/brick/MyApp.class differ diff --git a/Brick-Breaker-Game/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/Brick-Breaker-Game/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 00000000..82fac6fa --- /dev/null +++ b/Brick-Breaker-Game/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,3 @@ +com\mycompany\brick\MapGenerator.class +com\mycompany\brick\MyApp.class +com\mycompany\brick\GamePlay.class diff --git a/Brick-Breaker-Game/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/Brick-Breaker-Game/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 00000000..0f925b0e --- /dev/null +++ b/Brick-Breaker-Game/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,3 @@ +C:\Users\chinm\OneDrive\Documents\NetBeansProjects\Brick\src\main\java\com\mycompany\brick\MyApp.java +C:\Users\chinm\OneDrive\Documents\NetBeansProjects\Brick\src\main\java\com\mycompany\brick\GamePlay.java +C:\Users\chinm\OneDrive\Documents\NetBeansProjects\Brick\src\main\java\com\mycompany\brick\MapGenerator.java diff --git a/Brick-Breaker-Game/target/test-classes/.netbeans_automatic_build b/Brick-Breaker-Game/target/test-classes/.netbeans_automatic_build new file mode 100644 index 00000000..e69de29b diff --git a/Budget Tracker project/.cph/.BudgetTracker.java_16aeda78c6a917d37e3e9161668c0c60.prob b/Budget Tracker project/.cph/.BudgetTracker.java_16aeda78c6a917d37e3e9161668c0c60.prob new file mode 100644 index 00000000..3b117b2b --- /dev/null +++ b/Budget Tracker project/.cph/.BudgetTracker.java_16aeda78c6a917d37e3e9161668c0c60.prob @@ -0,0 +1 @@ +{"name":"Local: BudgetTracker","url":"c:\\Users\\Administrator\\Desktop\\Java-Projects-Collections\\Budget Tracker project\\BudgetTracker.java","tests":[{"id":1696452999127,"input":"","output":""}],"interactive":false,"memoryLimit":1024,"timeLimit":3000,"srcPath":"c:\\Users\\Administrator\\Desktop\\Java-Projects-Collections\\Budget Tracker project\\BudgetTracker.java","group":"local","local":true} \ No newline at end of file diff --git a/Budget Tracker project/BudgetTracker.class b/Budget Tracker project/BudgetTracker.class new file mode 100644 index 00000000..7e5cbd42 Binary files /dev/null and b/Budget Tracker project/BudgetTracker.class differ diff --git a/Budget Tracker project/BudgetTracker.java b/Budget Tracker project/BudgetTracker.java new file mode 100644 index 00000000..144ca617 --- /dev/null +++ b/Budget Tracker project/BudgetTracker.java @@ -0,0 +1,56 @@ +import java.util.Scanner; + +public class BudgetTracker { + private double balance; + + public BudgetTracker() { + balance = 0.0; + } + + public void addIncome(double amount) { + balance += amount; + } + + public void addExpense(double amount) { + balance -= amount; + } + + public double getBalance() { + return balance; + } + + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + BudgetTracker tracker = new BudgetTracker(); + + while (true) { + System.out.println("1. Add Income"); + System.out.println("2. Add Expense"); + System.out.println("3. View Balance"); + System.out.println("4. Exit"); + System.out.print("Enter your choice: "); + int choice = scanner.nextInt(); + + switch (choice) { + case 1: + System.out.print("Enter income amount: "); + double income = scanner.nextDouble(); + tracker.addIncome(income); + break; + case 2: + System.out.print("Enter expense amount: "); + double expense = scanner.nextDouble(); + tracker.addExpense(expense); + break; + case 3: + System.out.println("Current Balance: Rs" + tracker.getBalance()); + break; + case 4: + System.out.println("Exiting... Thank you!"); + return; + default: + System.out.println("Invalid choice. Please try again."); + } + } + } +} \ No newline at end of file diff --git a/Bug3524.java b/Bug3524.java new file mode 100644 index 00000000..f03beca7 --- /dev/null +++ b/Bug3524.java @@ -0,0 +1,11 @@ +import java.util.Scanner; +public class Bug3524 { + public static void main(String[] param) { + System.out.println("2021503524 - Mugundh J B - 09/09/23 - 2.20 pm"); + Scanner in = new Scanner(System.in); + System.out.println("Hello. Please type your name:"); + String name = in.nextLine(); + System.out.println("Hello "+name); + System.out.println ("Have a, nice day!"); + } +} diff --git a/CArray.java b/CArray.java new file mode 100644 index 00000000..91611b0a --- /dev/null +++ b/CArray.java @@ -0,0 +1,60 @@ +import java.util.Scanner; +//This class will calculate the max and min values of the array +class TestArray +{ + + int MAX(int[]Arry) + { + int maxValue= Arry[0]; + + for(int i=1;imaxValue) + { + maxValue=Arry[i]; + } + } + return maxValue;//This method will return the max value present in the array. + } + + int MIN(int[]Arry) + { + int minValue=Arry[0]; + + for(int i=1;i +#include +#include + +typedef struct array +{ + int *AT; + int *BT; + int *WT; + int *TAT; + int *CT; +} Array; + +typedef struct readyQueue +{ + int pid; + int BT; + struct readyQueue *next; +} ReadyQueue; + +Array *userInput(int processNum, int *AT, int *BT, Array *ptr) +{ + + printf("Enter the input in the form of 'Arrival Time(AT)' 'Burst Time(BT)'\n"); + for (int i = 0; i < processNum; i++) + { + scanf("%d %d", &AT[i], &BT[i]); + printf("\n"); + } + ptr->AT = AT; + ptr->BT = BT; + return ptr; +} + +Array *sortAT(int *AT, int *BT, int proccessNum, Array *ptr) +{ + bool swapped = false; + for (int i = 0; i < proccessNum - 1; i++) + { + swapped = false; + for (int j = 0; j < proccessNum - i - 1; j++) + { + if (AT[j] > AT[j + 1]) + { + int temp = AT[j]; + AT[j] = AT[j + 1]; + AT[j + 1] = temp; + temp = BT[j]; + BT[j] = BT[j + 1]; + BT[j + 1] = temp; + swapped = true; + } + } + + if (swapped == false) + { + break; + } + } + + ptr->AT = AT; + ptr->BT = BT; + return ptr; +} + +int *calculateWT(int *WT, int processNum, int *AT, int *BT) +{ + WT[0] = 0; + int currentTime = BT[0] + AT[0]; + for (int i = 1; i < processNum; i++) + { + if (AT[i] > currentTime) + { + currentTime = AT[i]; + } + WT[i] = currentTime - AT[i]; + currentTime += BT[i]; + } + return WT; +} + +int *calculateTAT(int *TAT, int processNum, int *BT, int *WT) +{ + for (int i = 0; i < processNum; i++) + { + TAT[i] = WT[i] + BT[i]; + } + + return TAT; +} + +int *calculateCT(int *CT, int proccessNum, int *AT, int *BT, int *WT) +{ + for (int i = 0; i < proccessNum; i++) + { + CT[i] = AT[i] + WT[i] + BT[i]; + } + + return CT; +} + +void display(int *AT, int *BT, int *WT, int *TAT, int *CT, int proccessNum) +{ + printf("AT\t BT\t WT\t TAT\t CT\n"); + float avgWT = 0; + float avgTAT = 0; + float avgCT = 0; + for (int i = 0; i < proccessNum; i++) + { + avgWT += WT[i]; + avgTAT += TAT[i]; + avgCT += CT[i]; + printf("%d\t %d\t %d\t %d\t %d\n", AT[i], BT[i], WT[i], TAT[i], CT[i]); + } + printf("Average WT: %f\n", avgWT / proccessNum); + printf("Average TAT: %f\n", avgTAT / proccessNum); + printf("Average CT: %f\n", avgCT / proccessNum); +} + +Array *dynAlloc(Array *ptr, int processNum) +{ + ptr = (Array *)malloc(sizeof(Array)); + ptr->AT = (int *)malloc(processNum * sizeof(int)); + ptr->BT = (int *)malloc(processNum * sizeof(int)); + ptr->WT = (int *)malloc(processNum * sizeof(int)); + ptr->TAT = (int *)malloc(processNum * sizeof(int)); + ptr->CT = (int *)malloc(processNum * sizeof(int)); + return ptr; +} + +void FCFSNecessaryFunct(int processNum, int *AT, int *BT, int *WT, int *TAT, int *CT, Array *ptr) +{ + ptr = userInput(processNum, ptr->AT, ptr->BT, ptr); + ptr = sortAT(ptr->AT, ptr->BT, processNum, ptr); + ptr->WT = calculateWT(ptr->WT, processNum, ptr->AT, ptr->BT); + ptr->TAT = calculateTAT(ptr->TAT, processNum, ptr->BT, ptr->WT); + ptr->CT = calculateCT(ptr->CT, processNum, ptr->AT, ptr->BT, ptr->WT); + display(ptr->AT, ptr->BT, ptr->WT, ptr->TAT, ptr->CT, processNum); +} + +void FCFS() +{ + int processNum; + printf("Enter the number of processess to be executed\n"); + scanf("%d", &processNum); + Array *ptr; + ptr = dynAlloc(ptr, processNum); + FCFSNecessaryFunct(processNum, ptr->AT, ptr->BT, ptr->WT, ptr->TAT, ptr->CT, ptr); + free(ptr); +} + +int *fillBT2(int processNum, int *BT, int *BT2) +{ + for (int i = 0; i < processNum; i++) + { + BT2[i] = BT[i]; + } + + return BT2; +} + +int findMin(int processNum, int *BT2, int currentTime, int *AT) +{ + int res = 1; + for (int i = 1; i < processNum; i++) + { + if (BT2[i] <= BT2[res] && BT2[i] != -1 && AT[i] <= currentTime) + { + res = i; + } + else if (BT2[res] == -1) + { + res++; + } + } + return res; +} + +int *sjfTAT(int processNum, int *AT, int *CT, int *TAT) +{ + for (int i = 0; i < processNum; i++) + { + TAT[i] = CT[i] - AT[i]; + } + + return TAT; +} + +int *sjfWT(int processNum, int *BT, int *WT, int *TAT) +{ + for (int i = 0; i < processNum; i++) + { + WT[i] = TAT[i] - BT[i]; + } + + return WT; +} + +int *sjfCT(int processNum, int *BT2, int *AT, int *BT, int *CT) +{ + int currentTime = BT2[0] + AT[0]; + CT[0] = currentTime; + BT2[0] = -1; + for (int i = 1; i < processNum; i++) + { + int index = findMin(processNum, BT2, currentTime, AT); + currentTime += BT2[index]; + CT[index] = currentTime; + BT2[index] = -1; + } + return CT; +} + +void SJF() +{ + int proccessNum; + printf("Enter the number of proccesses\n"); + scanf("%d", &proccessNum); + Array *ptr; + ptr = dynAlloc(ptr, proccessNum); + ptr = userInput(proccessNum, ptr->AT, ptr->BT, ptr); + ptr = sortAT(ptr->AT, ptr->BT, proccessNum, ptr); + int *BT2 = (int *)malloc(proccessNum * sizeof(int)); + BT2 = fillBT2(proccessNum, ptr->BT, BT2); + ptr->CT = sjfCT(proccessNum, BT2, ptr->AT, ptr->BT, ptr->CT); + ptr->TAT = sjfTAT(proccessNum, ptr->AT, ptr->CT, ptr->TAT); + ptr->WT = sjfWT(proccessNum, ptr->BT, ptr->WT, ptr->TAT); + display(ptr->AT, ptr->BT, ptr->WT, ptr->TAT, ptr->CT, proccessNum); + free(ptr); +} + +ReadyQueue *enqueue(ReadyQueue *ptr, int data, int pid) +{ + ReadyQueue *newNode = (ReadyQueue *)malloc(sizeof(ReadyQueue)); + newNode->BT = data; + newNode->pid = pid; + newNode->next = NULL; + + if (ptr == NULL) + { + return newNode; + } + else if (data == 0) + { + free(newNode); + return ptr; + } + else + { + ReadyQueue *current = ptr; + while (current->next != NULL) + { + current = current->next; + } + + current->next = newNode; + + return ptr; + } +} + +ReadyQueue *fillList(int *BT, ReadyQueue *list, int processNum) +{ + + for (int i = 0; i < processNum; i++) + { + int pid = i + 1; + list = enqueue(list, BT[i], pid); + } + return list; +} + +ReadyQueue *dequeue(ReadyQueue *ptr) +{ + if (ptr == NULL) + { + return NULL; + } + + ReadyQueue *temp = ptr; + ptr = ptr->next; + free(temp); + return ptr; +} + +int *rrCT(int *CT, int processNum, ReadyQueue *ptr, int TQ, int AT0) +{ + int currentTime = AT0; + while (ptr != NULL) + { + ReadyQueue *temp = ptr; + if (temp->BT > TQ) + { + temp->BT -= TQ; + currentTime += TQ; + ptr = enqueue(temp, temp->BT, temp->pid); + } + else if (temp->BT == 0) + { + CT[temp->pid - 1] = currentTime; + } + else if (temp->BT <= TQ) + { + CT[temp->pid - 1] = currentTime + temp->BT; + currentTime += temp->BT; + } + ptr = dequeue(ptr); + } + + return CT; +} + +int *rrWT(int *WT, int *BT, int *AT, int *CT, int processNum) +{ + for (int i = 0; i < processNum; i++) + { + WT[i] = CT[i] - BT[i] - AT[i]; + } + + return WT; +} + +int *rrTAT(int *BT, int *WT, int *TAT, int processNum) +{ + for (int i = 0; i < processNum; i++) + { + TAT[i] = BT[i] + WT[i]; + } + + return TAT; +} + +void RR() +{ + int TQ, processNum; + printf("Enter the time quantum for each process and the number of processess\n"); + scanf("%d %d", &TQ, &processNum); + Array *ptr; + ptr = dynAlloc(ptr, processNum); + ptr = userInput(processNum, ptr->AT, ptr->BT, ptr); + ptr = sortAT(ptr->AT, ptr->BT, processNum, ptr); + ReadyQueue *rrListFront = (ReadyQueue *)malloc(sizeof(ReadyQueue)); + rrListFront->BT = 0; + rrListFront->pid = 0; + rrListFront->next = NULL; + rrListFront = fillList(ptr->BT, rrListFront, processNum); + ptr->CT = rrCT(ptr->CT, processNum, rrListFront, TQ, ptr->AT[0]); + ptr->WT = rrWT(ptr->WT, ptr->BT, ptr->AT, ptr->CT, processNum); + ptr->TAT = rrTAT(ptr->BT, ptr->WT, ptr->TAT, processNum); + display(ptr->AT, ptr->BT, ptr->WT, ptr->TAT, ptr->CT, processNum); + free(ptr); +} + +int maxAT(int *AT, int processNum) +{ + int res = 0; + for (int i = 1; i < processNum; i++) + { + if (AT[res] < AT[i]) + { + res = i; + } + } + + return AT[res]; +} + +ReadyQueue *leastTime(ReadyQueue *ptr, int currentTime, int *AT, int processNum, int MAX_AT) +{ + ReadyQueue *temp = ptr; + ReadyQueue *res = ptr; + ReadyQueue *temp2 = ptr; + temp2 = temp2->next; + temp = temp->next; + int BT = ptr->BT; + if (currentTime < MAX_AT) + { + for (int i = ptr->pid; i < processNum; i++) + { + if (AT[i] == currentTime && BT > temp->BT) + { + BT = temp->BT; + res = temp; + } + else if (AT[i] > currentTime) + + { + break; + } + temp = temp->next; + } + } + else + { + while (temp != NULL) + { + if (BT > temp->BT) + { + BT = temp->BT; + res = temp; + } + temp = temp->next; + } + } + while (temp2 != NULL) + { + if (AT[temp2->pid - 1] <= currentTime) + { + if (temp2->BT < res->BT) + { + res = temp2; + } + else if (temp2->BT == res->BT && temp2->pid < res->pid) + { + res = temp2; + } + } + temp2 = temp2->next; + } + return res; +} + +ReadyQueue *addFront(ReadyQueue *temp, ReadyQueue *ptr) +{ + if (temp == ptr) + { + return ptr; + } + + ReadyQueue *prev = NULL; + ReadyQueue *current = ptr; + while (current != NULL && current != temp) + { + prev = current; + current = current->next; + } + + if (current == temp) + { + if (prev != NULL) + { + prev->next = temp->next; + } + else + { + ptr = temp->next; + } + + temp->next = ptr; + ptr = temp; + } + + return ptr; +} + +int *strfCT(int *CT, ReadyQueue *ptr, int *AT, int processNum) +{ + + int currentTime = AT[0]; + int MAX_AT = maxAT(AT, processNum); + int i = 0; + while (ptr != NULL) + { + int BT = ptr->BT; + int pid = ptr->pid; + ReadyQueue *temp = ptr; + ReadyQueue *head = ptr; + if (ptr->BT != 0) + { + temp = leastTime(ptr, currentTime, AT, processNum, MAX_AT); + } + if (currentTime > MAX_AT && ptr->BT < temp->BT) + { + CT[ptr->pid - 1] = currentTime + ptr->BT; + ptr = dequeue(ptr); + } + else if (temp->BT == ptr->BT && temp->pid < ptr->pid) + { + ptr = dequeue(ptr); + ptr = enqueue(ptr, BT, pid); + ptr = addFront(temp, ptr); + } + else if (ptr->next == NULL) + { + CT[ptr->pid - 1] = currentTime + ptr->BT; + ptr = dequeue(ptr); + } + else if (ptr->BT == 0) + { + CT[ptr->pid - 1] = currentTime; + ptr = dequeue(ptr); + } + else if (temp->BT < ptr->BT) + { + ptr = dequeue(ptr); + ptr = enqueue(ptr, BT, pid); + ptr = addFront(temp, ptr); + } + else if (temp->BT == ptr->BT) + { + currentTime++; + ptr->BT--; + } + } + return CT; +} + +int *strfWT(int *AT, int *BT, int *CT, int *WT, int processNum) +{ + for (int i = 0; i < processNum; i++) + { + WT[i] = CT[i] - BT[i] - AT[i]; + } + + return WT; +} + +int *strfTAT(int *BT, int *WT, int *TAT, int processNum) +{ + for (int i = 0; i < processNum; i++) + { + TAT[i] = BT[i] + WT[i]; + } + + return TAT; +} + +void STRF() +{ + int processNum; + printf("Enter the number of processess\n"); + scanf("%d", &processNum); + Array *ptr; + ptr = dynAlloc(ptr, processNum); + ptr = userInput(processNum, ptr->AT, ptr->BT, ptr); + ptr = sortAT(ptr->AT, ptr->BT, processNum, ptr); + ReadyQueue *queue = (ReadyQueue *)malloc(sizeof(ReadyQueue)); + queue = NULL; + queue = fillList(ptr->BT, queue, processNum); + ptr->CT = strfCT(ptr->CT, queue, ptr->AT, processNum); + printf("CT = %d\n", ptr->CT[0]); + ptr->WT = strfWT(ptr->AT, ptr->BT, ptr->CT, ptr->WT, processNum); + ptr->TAT = strfTAT(ptr->BT, ptr->WT, ptr->TAT, processNum); + display(ptr->AT, ptr->BT, ptr->WT, ptr->TAT, ptr->CT, processNum); + free(ptr); +} + +typedef struct array2 +{ + int *AT; + int *BT; + int *WT; + int *TAT; + int *CT; + int *priority; +} Array2; + +typedef struct queue +{ + int BT; + int pid; + int prority; + struct queue *next; +} queue; + +Array2 *dynAlloc2(Array2 *ptr, int processNum) +{ + ptr = (Array2 *)malloc(sizeof(Array2)); + ptr->AT = (int *)malloc(processNum * sizeof(int)); + ptr->BT = (int *)malloc(processNum * sizeof(int)); + ptr->WT = (int *)malloc(processNum * sizeof(int)); + ptr->TAT = (int *)malloc(processNum * sizeof(int)); + ptr->CT = (int *)malloc(processNum * sizeof(int)); + ptr->priority = (int *)malloc(processNum * sizeof(int)); + return ptr; +} + +Array2 *userinputPR(Array2 *ptr, int *AT, int *BT, int *priority, int processNum) +{ + printf("Enter the input in the form of 'Priority' 'Arrival Time(AT)' 'Burst Time(BT)'\n"); + for (int i = 0; i < processNum; i++) + { + scanf("%d %d %d", &priority[i], &AT[i], &BT[i]); + printf("\n"); + } + ptr->AT = AT; + ptr->BT = BT; + ptr->priority = priority; + return ptr; +} + +Array2 *sortATPR(int *AT, int *BT, int *priority, int proccessNum, Array2 *ptr) +{ + bool swapped = false; + for (int i = 0; i < proccessNum - 1; i++) + { + swapped = false; + for (int j = 0; j < proccessNum - i - 1; j++) + { + if (AT[j] > AT[j + 1]) + { + int temp = AT[j]; + AT[j] = AT[j + 1]; + AT[j + 1] = temp; + temp = BT[j]; + BT[j] = BT[j + 1]; + BT[j + 1] = temp; + temp = priority[j]; + priority[j] = priority[j + 1]; + priority[j + 1] = temp; + swapped = true; + } + } + + if (swapped == false) + { + break; + } + } + + ptr->AT = AT; + ptr->BT = BT; + ptr->priority = priority; + return ptr; +} + +queue *enqueuePR(queue *ptr, int data, int pid, int priority) +{ + queue *newNode = (queue *)malloc(sizeof(queue)); + newNode->BT = data; + newNode->pid = pid; + newNode->prority = priority; + newNode->next = NULL; + + if (ptr == NULL) + { + return newNode; + } + else if (data == 0) + { + free(newNode); + return ptr; + } + else + { + queue *current = ptr; + while (current->next != NULL) + { + current = current->next; + } + + current->next = newNode; + + return ptr; + } +} + +queue *dequeuePR(queue *ptr) +{ + if (ptr == NULL) + { + return NULL; + } + + queue *temp = ptr; + ptr = ptr->next; + free(temp); + return ptr; +} + +queue *fillListPR(int *BT, int *priority, queue *list, int processNum) +{ + + for (int i = 0; i < processNum; i++) + { + int pid = i + 1; + list = enqueuePR(list, BT[i], pid, priority[i]); + } + return list; +} + +queue *addFrontPR(queue *temp, queue *ptr) +{ + if (temp == ptr) + { + return ptr; + } + + queue *prev = NULL; + queue *current = ptr; + while (current != NULL && current != temp) + { + prev = current; + current = current->next; + } + + if (current == temp) + { + if (prev != NULL) + { + prev->next = temp->next; + } + else + { + ptr = temp->next; + } + + temp->next = ptr; + ptr = temp; + } + + return ptr; +} + +queue *maxPR(queue *ptr, int currentTime, int *AT, int processNum, int MAX_AT) +{ + queue *temp = ptr; + queue *res = ptr; + queue *temp2 = ptr; + temp2 = temp2->next; + temp = temp->next; + int priority = ptr->prority; + if (currentTime < MAX_AT) + { + for (int i = ptr->pid; i < processNum; i++) + { + if (AT[i] == currentTime && priority > temp->prority) + { + priority = temp->prority; + res = temp; + } + else if (AT[i] > currentTime) + + { + break; + } + temp = temp->next; + } + } + else + { + while (temp != NULL) + { + if (priority > temp->prority) + { + priority = temp->prority; + res = temp; + } + temp = temp->next; + } + } + while (temp2 != NULL) + { + if (AT[temp2->pid - 1] <= currentTime) + { + if (temp2->prority < res->prority) + { + res = temp2; + } + else if (temp2->prority == res->prority && temp2->pid < res->pid) + { + res = temp2; + } + } + temp2 = temp2->next; + } + return res; +} + +int *prCT(int *CT, int *AT, queue *ptr, int processNum) +{ + int currentTime = AT[0]; + int MAX_AT = maxAT(AT, processNum); + int i = 0; + while (ptr != NULL) + { + int BT = ptr->BT; + int pid = ptr->pid; + int priority = ptr->prority; + queue *temp = ptr; + if (ptr->BT != 0) + { + temp = maxPR(ptr, currentTime, AT, processNum, MAX_AT); + } + if (currentTime >= MAX_AT && ptr == temp) + { + CT[ptr->pid - 1] = currentTime + ptr->BT; + currentTime += ptr->BT; + ptr = dequeuePR(ptr); + } + else if (temp->prority == ptr->prority && temp->pid < ptr->pid) + { + ptr = dequeuePR(ptr); + ptr = enqueuePR(ptr, BT, pid, priority); + ptr = addFrontPR(temp, ptr); + } + else if (ptr->next == NULL) + { + CT[ptr->pid - 1] = currentTime + ptr->BT; + currentTime += ptr->BT; + ptr = dequeuePR(ptr); + } + else if (ptr->BT == 0) + { + CT[ptr->pid - 1] = currentTime; + currentTime += ptr->BT; + ptr = dequeuePR(ptr); + } + else if (temp->prority < ptr->prority) + { + ptr = dequeuePR(ptr); + ptr = enqueuePR(ptr, BT, pid, priority); + ptr = addFrontPR(temp, ptr); + } + else if (temp->prority == ptr->prority) + { + currentTime++; + ptr->BT--; + } + } + return CT; +} + +int *prWT(int *AT, int *BT, int *CT, int *WT, int processNum) +{ + for (int i = 0; i < processNum; i++) + { + WT[i] = CT[i] - BT[i] - AT[i]; + } + + return WT; +} + +int *prTAT(int *BT, int *WT, int *TAT, int processNum) +{ + for (int i = 0; i < processNum; i++) + { + TAT[i] = BT[i] + WT[i]; + } + + return TAT; +} + +void PR() +{ + int processNum; + printf("Enter the number of proccesses\n"); + scanf("%d", &processNum); + Array2 *ptr = dynAlloc2(ptr, processNum); + ptr = userinputPR(ptr, ptr->AT, ptr->BT, ptr->priority, processNum); + ptr = sortATPR(ptr->AT, ptr->BT, ptr->priority, processNum, ptr); + queue *queue1 = (queue *)malloc(sizeof(queue)); + queue1 = NULL; + queue1 = fillListPR(ptr->BT, ptr->priority, queue1, processNum); + ptr->CT = prCT(ptr->CT, ptr->AT, queue1, processNum); + ptr->WT = prWT(ptr->AT, ptr->BT, ptr->CT, ptr->WT, processNum); + ptr->TAT = prTAT(ptr->BT, ptr->WT, ptr->TAT, processNum); + display(ptr->AT, ptr->BT, ptr->WT, ptr->TAT, ptr->CT, processNum); + free(ptr); +} + +int *nonPRCT(int *CT, int *AT, queue *ptr, int processNum) +{ + int currentTime = AT[0]; + int MAX_AT = maxAT(AT, processNum); + while (ptr != NULL) + { + int BT = ptr->BT; + int pid = ptr->pid; + int priority = ptr->prority; + queue *temp = ptr; + queue *head = ptr; + if (ptr->BT != 0) + { + temp = maxPR(ptr, currentTime, AT, processNum, MAX_AT); + } + if (ptr == temp) + { + CT[ptr->pid - 1] = currentTime + ptr->BT; + currentTime += ptr->BT; + ptr = dequeuePR(ptr); + } + else if (currentTime >= MAX_AT && ptr == temp) + { + CT[ptr->pid - 1] = currentTime + ptr->BT; + currentTime += ptr->BT; + ptr = dequeuePR(ptr); + } + else if (temp->prority < ptr->prority) + { + CT[ptr->pid - 1] = currentTime + ptr->BT; + currentTime += ptr->BT; + ptr = dequeuePR(ptr); + ptr = addFrontPR(temp, ptr); + } + else if (temp->prority == ptr->prority && temp->pid < ptr->pid) + { + CT[ptr->pid - 1] = currentTime + ptr->BT; + currentTime += ptr->BT; + ptr = dequeuePR(ptr); + ptr = addFrontPR(temp, ptr); + } + } + + return CT; +} + +void nonPR() +{ + int processNum; + printf("Enter the number of processess\n"); + scanf("%d", &processNum); + Array2 *ptr; + ptr = dynAlloc2(ptr, processNum); + ptr = userinputPR(ptr, ptr->AT, ptr->BT, ptr->priority, processNum); + ptr = sortATPR(ptr->AT, ptr->BT, ptr->priority, processNum, ptr); + queue *queue1 = (queue *)malloc(sizeof(queue)); + queue1 = NULL; + queue1 = fillListPR(ptr->BT, ptr->priority, queue1, processNum); + ptr->CT = nonPRCT(ptr->CT, ptr->AT, queue1, processNum); + ptr->WT = prWT(ptr->AT, ptr->BT, ptr->CT, ptr->WT, processNum); + ptr->TAT = prTAT(ptr->BT, ptr->WT, ptr->TAT, processNum); + display(ptr->AT, ptr->BT, ptr->WT, ptr->TAT, ptr->CT, processNum); + free(ptr); +} + +void main() +{ + int choice; + char option; + while (choice != 6) + { + printf("Choose the CPU scheduling\n 1.FCFS\n 2.SJF\n 3.RR\n 4.STRF\n 5.PR\n 6.Exit\n"); + scanf("%d", &choice); + + switch (choice) + { + case 1: + FCFS(); + break; + + case 2: + SJF(); + break; + + case 3: + RR(); + break; + + case 4: + STRF(); + break; + + case 5: + printf("Do you want to continue with preemptive Y or N? \n"); + scanf("%c", &option); + scanf("%c", &option); + if (option == 'Y') + { + PR(); + } + else if (option == 'N') + { + nonPR(); + } + break; + + case 6: + break; + + default: + break; + } + } +} diff --git a/Calc.java b/Calc.java new file mode 100644 index 00000000..7c6e8c7b --- /dev/null +++ b/Calc.java @@ -0,0 +1,75 @@ +// Java program for simple calculator + +import java.io.*; +import java.lang.*; +import java.lang.Math; +import java.util.Scanner; +public class BasicCalculator { + + public static void main(String[] args) + { + // stores two numbers + double num1, num2; + + // Take input from the user + Scanner sc = new Scanner(System.in); + + System.out.println("Enter the numbers"); + + // take the inputs + num1 = sc.nextDouble(); + + num2 = sc.nextDouble(); + + System.out.println("Enter the operator (+,-,*,/)"); + + char op = sc.next().charAt(0); + + double o = 0; + + switch (op) { + + // case to add two numbers + case '+': + + o = num1 + num2; + + break; + + // case to subtract two numbers + case '-': + + o = num1 - num2; + + break; + + // case to multiply two numbers + case '*': + + o = num1 * num2; + + break; + + // case to divide two numbers + case '/': + + o = num1 / num2; + + break; + + default: + + System.out.println("You enter wrong input"); + + break; + } + + System.out.println("The final result:"); + + System.out.println(); + + // print the final result + System.out.println(num1 + " " + op + " " + num2 + + " = " + o); + } +} diff --git a/Calculator using Java/.idea/.gitignore b/Calculator using Java/.idea/.gitignore new file mode 100644 index 00000000..26d33521 --- /dev/null +++ b/Calculator using Java/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/Calculator using Java/.idea/misc.xml b/Calculator using Java/.idea/misc.xml new file mode 100644 index 00000000..639900d1 --- /dev/null +++ b/Calculator using Java/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Calculator using Java/.idea/modules.xml b/Calculator using Java/.idea/modules.xml new file mode 100644 index 00000000..5e5fbe23 --- /dev/null +++ b/Calculator using Java/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Calculator using Java/.idea/vcs.xml b/Calculator using Java/.idea/vcs.xml new file mode 100644 index 00000000..6c0b8635 --- /dev/null +++ b/Calculator using Java/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Calculator using Java/Calc.java b/Calculator using Java/Calc.java new file mode 100644 index 00000000..f495f631 --- /dev/null +++ b/Calculator using Java/Calc.java @@ -0,0 +1,170 @@ +package simplejavacalculator; + +import static java.lang.Double.NaN; +import static java.lang.Math.log10; +import static java.lang.Math.pow; + + + + +public class Calculator { + + public enum BiOperatorModes { + + normal, add, minus, multiply, divide , xpowerofy + + } + + public enum MonoOperatorModes { + + square, squareRoot, oneDividedBy, cos, sin, tan ,log , rate, abs + + } + + private double num1, num2; + + private BiOperatorModes mode = BiOperatorModes.normal; + + private double calculateBiImpl() { + + if (mode == BiOperatorModes.normal) { + + return num2; + + } + + if (mode == BiOperatorModes.add) { + + if (num2 != 0) { + + return num1 + num2; + + } + + return num1; + + } + + if (mode == BiOperatorModes.minus) { + + return num1 - num2; + + } + + if (mode == BiOperatorModes.multiply) { + + return num1 * num2; + + } + + if (mode == BiOperatorModes.divide) { + + return num1 / num2; + + } + + if (mode == BiOperatorModes.xpowerofy) { + + return pow(num1,num2); + + } + + // never reach + + throw new Error(); + + } + + public Double calculateBi(BiOperatorModes newMode, Double num) { + + if (mode == BiOperatorModes.normal) { + + num2 = 0.0; + + num1 = num; + + mode = newMode; + + return NaN; + + } else { + + num2 = num; + + num1 = calculateBiImpl(); + + mode = newMode; + + return num1; + + } + + } + + public Double calculateEqual(Double num) { + + return calculateBi(BiOperatorModes.normal, num); + + } + + public Double reset() { + + num2 = 0.0; + + num1 = 0.0; + + mode = BiOperatorModes.normal; + + return NaN; + + } + + public Double calculateMono(MonoOperatorModes newMode, Double num) { + + if (newMode == MonoOperatorModes.square) { + + return num * num; + + } + + if (newMode == MonoOperatorModes.squareRoot) { + + return Math.sqrt(num); + + } + + if (newMode == MonoOperatorModes.oneDividedBy) { + + return 1 / num; + + } + + if (newMode == MonoOperatorModes.cos) { + + return Math.cos(Math.toRadians(num)); + + } + + if (newMode == MonoOperatorModes.sin) { + + return Math.sin(Math.toRadians(num)); + + } + + if (newMode == MonoOperatorModes.tan) { + if (num == 0 || num % 180 == 0) { + return 0.0; + } + if (num % 90 == 0 && num % 180 != 0) { + return NaN; + } + return Math.tan(Math.toRadians(num)); + } + + if (newMode == MonoOperatorModes.log) { + return log10(num); + } + + if (newMode == MonoOperatorModes.rate) { + return num / 100; + } diff --git a/Calculator using Java/Calculator using Java.iml b/Calculator using Java/Calculator using Java.iml new file mode 100644 index 00000000..6aed9d6e --- /dev/null +++ b/Calculator using Java/Calculator using Java.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Calculator using Java/Calculator.java b/Calculator using Java/Calculator.java new file mode 100644 index 00000000..bff77a17 --- /dev/null +++ b/Calculator using Java/Calculator.java @@ -0,0 +1,182 @@ +package simplejavacalculator; + +import static java.lang.Double.NaN; +import static java.lang.Math.log10; +import static java.lang.Math.pow; + + + + +public class Calculator { + + public enum BiOperatorModes { + + normal, add, minus, multiply, divide , xpowerofy + + } + + public enum MonoOperatorModes { + + square, squareRoot, oneDividedBy, cos, sin, tan ,log , rate, abs + + } + + private double num1, num2; + + private BiOperatorModes mode = BiOperatorModes.normal; + + private double calculateBiImpl() { + + if (mode == BiOperatorModes.normal) { + + return num2; + + } + + if (mode == BiOperatorModes.add) { + + if (num2 != 0) { + + return num1 + num2; + + } + + return num1; + + } + + if (mode == BiOperatorModes.minus) { + + return num1 - num2; + + } + + if (mode == BiOperatorModes.multiply) { + + return num1 * num2; + + } + + if (mode == BiOperatorModes.divide) { + + return num1 / num2; + + } + + if (mode == BiOperatorModes.xpowerofy) { + + return pow(num1,num2); + + } + + // never reach + + throw new Error(); + + } + + public Double calculateBi(BiOperatorModes newMode, Double num) { + + if (mode == BiOperatorModes.normal) { + + num2 = 0.0; + + num1 = num; + + mode = newMode; + + return NaN; + + } else { + + num2 = num; + + num1 = calculateBiImpl(); + + mode = newMode; + + return num1; + + } + + } + + public Double calculateEqual(Double num) { + + return calculateBi(BiOperatorModes.normal, num); + + } + + public Double reset() { + + num2 = 0.0; + + num1 = 0.0; + + mode = BiOperatorModes.normal; + + return NaN; + + } + + public Double calculateMono(MonoOperatorModes newMode, Double num) { + + if (newMode == MonoOperatorModes.square) { + + return num * num; + + } + + if (newMode == MonoOperatorModes.squareRoot) { + + return Math.sqrt(num); + + } + + if (newMode == MonoOperatorModes.oneDividedBy) { + + return 1 / num; + + } + + if (newMode == MonoOperatorModes.cos) { + + return Math.cos(Math.toRadians(num)); + + } + + if (newMode == MonoOperatorModes.sin) { + + return Math.sin(Math.toRadians(num)); + + } + + if (newMode == MonoOperatorModes.tan) { + + if (num == 0 || num % 180 == 0) { + + return 0.0; + + } + + if (num % 90 == 0 && num % 180 != 0) { + + return NaN; + + } + + return Math.tan(Math.toRadians(num)); + + } + + if (newMode == MonoOperatorModes.log) { + + return log10(num); + + } + + if (newMode == MonoOperatorModes.rate) { + + return num / 100; + + } diff --git a/Calculator using Java/newfile b/Calculator using Java/newfile new file mode 100644 index 00000000..d1998aba --- /dev/null +++ b/Calculator using Java/newfile @@ -0,0 +1,74 @@ +//Digital Clock mini project + + + +import javax.swing.*; +import java.awt.*; +import java.text.SimpleDateFormat; +import java.util.Calendar; + +public class Clock extends JFrame { + + Calendar calendar; + SimpleDateFormat timeFormat; + SimpleDateFormat dayFormat; + SimpleDateFormat dateFormat; + + JLabel timeLabel; + JLabel dayLabel; + JLabel dateLabel; + String time; + String day; + String date; + Clock() { + this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + this.setTitle("Digital Clock"); + this.setLayout(new FlowLayout()); + this.setSize(350, 220); + this.setResizable(false); + + timeFormat = new SimpleDateFormat("hh:mm:ss a"); + dayFormat=new SimpleDateFormat("EEEE"); + dateFormat=new SimpleDateFormat("dd MMMMM, yyyy"); + timeLabel = new JLabel(); + timeLabel.setFont(new Font("SANS_SERIF", Font.PLAIN, 59)); + timeLabel.setBackground(Color.BLACK); + timeLabel.setForeground(Color.WHITE); + timeLabel.setOpaque(true); + dayLabel=new JLabel(); + dayLabel.setFont(new Font("Ink Free",Font.BOLD,34)); + + dateLabel=new JLabel(); + dateLabel.setFont(new Font("Ink Free",Font.BOLD,30)); + + + this.add(timeLabel); + this.add(dayLabel); + this.add(dateLabel); + this.setVisible(true); + + setTimer(); + } + + public void setTimer() { + while (true) { + time = timeFormat.format(Calendar.getInstance().getTime()); + timeLabel.setText(time); + + day = dayFormat.format(Calendar.getInstance().getTime()); + dayLabel.setText(day); + + date = dateFormat.format(Calendar.getInstance().getTime()); + dateLabel.setText(date); + + try { + Thread.sleep(1000); + } catch (Exception e) { + e.getStackTrace(); + } + } + } + public static void main(String[] args) { + new Clock(); + } +} diff --git a/Calculator-OOPS/Add.java b/Calculator-OOPS/Add.java new file mode 100644 index 00000000..aa44f5f8 --- /dev/null +++ b/Calculator-OOPS/Add.java @@ -0,0 +1,11 @@ +public class Add implements Operate{ + @Override + public Double getResult(Double... numbers){ + Double sum = 0.0; + + for(Double num: numbers){ + sum += num; + } + return sum; + } +} diff --git a/Calculator-OOPS/Calculator.java b/Calculator-OOPS/Calculator.java new file mode 100644 index 00000000..3c7b3f6d --- /dev/null +++ b/Calculator-OOPS/Calculator.java @@ -0,0 +1,50 @@ +import java.util.Arrays; +import java.util.LinkedList; +import java.util.Objects; +import java.util.Queue; + +public class Calculator { + public static void main(String[] args){ + final String inputExp = ReadInput.read(); + + Queue operations; + Queue numbers; + + String[] numbersArr = inputExp.split("[-+*/%]"); +// String[] operArr = inputExp.split("[0-9]+"); + String[] operArr = inputExp.split("\\d+"); + numbers = new LinkedList<>(Arrays.asList(numbersArr)); + operations = new LinkedList<>(Arrays.asList(operArr)); + + Double res = Double.parseDouble(Objects.requireNonNull(numbers.poll())); + + while(!numbers.isEmpty()){ + String opr = operations.poll(); + + Operate operate; + switch(Objects.requireNonNull(opr)){ + case "+": + operate = new Add(); + break; + case "-": + operate = new Sub(); + break; + case "*": + operate = new Multiply(); + break; + case "/": + operate = new Divide(); + break; + case "%": + operate = new Modulus(); + break; + default: + continue; + } + Double num = Double.parseDouble(Objects.requireNonNull(numbers.poll())); + res = operate.getResult(res, num); + } + + System.out.println(res); + } +} \ No newline at end of file diff --git a/Calculator-OOPS/Divide.java b/Calculator-OOPS/Divide.java new file mode 100644 index 00000000..d7e00dd8 --- /dev/null +++ b/Calculator-OOPS/Divide.java @@ -0,0 +1,11 @@ +public class Divide implements Operate { + @Override + public Double getResult(Double... numbers){ + Double div = numbers[0]; + + for(int i=1;i< numbers.length;i++){ + div /= numbers[i]; + } + return div; + } +} diff --git a/Calculator-OOPS/Modulus.java b/Calculator-OOPS/Modulus.java new file mode 100644 index 00000000..0edf4197 --- /dev/null +++ b/Calculator-OOPS/Modulus.java @@ -0,0 +1,11 @@ +public class Modulus implements Operate{ + @Override + public Double getResult(Double... numbers){ + Double mod = numbers[0]; + + for (int i = 1; i < numbers.length; i++) { + mod %= numbers[i]; + } + return mod; + } +} diff --git a/Calculator-OOPS/Multiply.java b/Calculator-OOPS/Multiply.java new file mode 100644 index 00000000..b5f1981a --- /dev/null +++ b/Calculator-OOPS/Multiply.java @@ -0,0 +1,12 @@ +public class Multiply implements Operate { + @Override + public Double getResult(Double... numbers){ + Double mul = 1.0; + + for(Double num: numbers){ + mul *= num; + } + return mul; + } + +} diff --git a/Calculator-OOPS/Operate.java b/Calculator-OOPS/Operate.java new file mode 100644 index 00000000..35f62bd8 --- /dev/null +++ b/Calculator-OOPS/Operate.java @@ -0,0 +1,3 @@ +public interface Operate { + Double getResult(Double... numbers); +} diff --git a/Calculator-OOPS/ReadInput.java b/Calculator-OOPS/ReadInput.java new file mode 100644 index 00000000..9452bb2b --- /dev/null +++ b/Calculator-OOPS/ReadInput.java @@ -0,0 +1,13 @@ +import java.util.Scanner; + +public class ReadInput { + public static String read(){ + Scanner scanner = new Scanner(System.in); + + System.out.println("Input Expression Example: 4*3/2"); + String inputLine = scanner.nextLine(); + + scanner.close(); + return inputLine; + } +} \ No newline at end of file diff --git a/Calculator-OOPS/Sub.java b/Calculator-OOPS/Sub.java new file mode 100644 index 00000000..64842120 --- /dev/null +++ b/Calculator-OOPS/Sub.java @@ -0,0 +1,11 @@ +public class Sub implements Operate{ + @Override + public Double getResult(Double... numbers){ + Double sub = numbers[0]; + + for(int i=1;i< numbers.length;i++){ + sub -= numbers[i]; + } + return sub; + } +} diff --git a/Calculator-project/.DS_Store b/Calculator-project/.DS_Store new file mode 100644 index 00000000..beb3ab12 Binary files /dev/null and b/Calculator-project/.DS_Store differ diff --git a/Calculator-project/.classpath b/Calculator-project/.classpath new file mode 100644 index 00000000..a8965644 --- /dev/null +++ b/Calculator-project/.classpath @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Calculator-project/.gitignore b/Calculator-project/.gitignore new file mode 100644 index 00000000..7667d29a --- /dev/null +++ b/Calculator-project/.gitignore @@ -0,0 +1,7 @@ +# Intellij +.idea/ +out/ +*.iml + +# Maven +target/ \ No newline at end of file diff --git a/Calculator-project/.project b/Calculator-project/.project new file mode 100644 index 00000000..70fea0ab --- /dev/null +++ b/Calculator-project/.project @@ -0,0 +1,34 @@ + + + Calculator + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + + + 1665915642182 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + + diff --git a/Calculator-project/.settings/org.eclipse.jdt.apt.core.prefs b/Calculator-project/.settings/org.eclipse.jdt.apt.core.prefs new file mode 100644 index 00000000..d4313d4b --- /dev/null +++ b/Calculator-project/.settings/org.eclipse.jdt.apt.core.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.apt.aptEnabled=false diff --git a/Calculator-project/.settings/org.eclipse.jdt.core.prefs b/Calculator-project/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..1b6e1ef2 --- /dev/null +++ b/Calculator-project/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,9 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.processAnnotations=disabled +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/Calculator-project/.settings/org.eclipse.m2e.core.prefs b/Calculator-project/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 00000000..f897a7f1 --- /dev/null +++ b/Calculator-project/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/Calculator-project/LICENSE b/Calculator-project/LICENSE new file mode 100644 index 00000000..879af7cc --- /dev/null +++ b/Calculator-project/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Houari Zegai + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Calculator-project/README.md b/Calculator-project/README.md new file mode 100644 index 00000000..eaaef01e --- /dev/null +++ b/Calculator-project/README.md @@ -0,0 +1,28 @@ +# Calculator App +A very basic calculator application created with Java **Swing**. + +[![License MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) + +## Thank You! +Please ⭐️ this repo and share it with others + +### Screenshots +Scientific / Dark | Standard / Colored +:------------------:|:------------------- +![Calculator - screenshot](screenshots/dark.PNG) | ![Calculator - screenshot](screenshots/colored.PNG) + +### Requirements 🔧 +* Java version 8 or higher. + +### Installation 🔌 +1. Press the **Fork** button (top right the page) to save copy of this project on your account. + +2. Download the repository files (project) from the download section or clone this project by typing in the bash the following command: + + git clone https://github.com/HouariZegai/Calculator.git +3. Imported it in Intellij IDEA or any other Java IDE. +4. Run the application :D + +### Contributing 💡 +If you want to contribute to this project and make it better with new ideas, your pull request is very welcomed. +If you find any issue just put it in the repository issue section, thank you. diff --git a/Calculator-project/pom.xml b/Calculator-project/pom.xml new file mode 100644 index 00000000..738bf59c --- /dev/null +++ b/Calculator-project/pom.xml @@ -0,0 +1,24 @@ + + + 4.0.0 + + com.houari + Calculator + 1.0-SNAPSHOT + + + 8 + 8 + + + + + org.junit.jupiter + junit-jupiter-api + 5.7.0 + test + + + \ No newline at end of file diff --git a/Calculator-project/screenshots/colored.PNG b/Calculator-project/screenshots/colored.PNG new file mode 100644 index 00000000..a30cba6d Binary files /dev/null and b/Calculator-project/screenshots/colored.PNG differ diff --git a/Calculator-project/screenshots/dark.PNG b/Calculator-project/screenshots/dark.PNG new file mode 100644 index 00000000..c4765a71 Binary files /dev/null and b/Calculator-project/screenshots/dark.PNG differ diff --git a/Calculator-project/screenshots/simple.PNG b/Calculator-project/screenshots/simple.PNG new file mode 100644 index 00000000..db749b39 Binary files /dev/null and b/Calculator-project/screenshots/simple.PNG differ diff --git a/Calculator-project/src/.DS_Store b/Calculator-project/src/.DS_Store new file mode 100644 index 00000000..6fbb4b54 Binary files /dev/null and b/Calculator-project/src/.DS_Store differ diff --git a/Calculator-project/src/main/.DS_Store b/Calculator-project/src/main/.DS_Store new file mode 100644 index 00000000..a5860c78 Binary files /dev/null and b/Calculator-project/src/main/.DS_Store differ diff --git a/Calculator-project/src/main/java/.DS_Store b/Calculator-project/src/main/java/.DS_Store new file mode 100644 index 00000000..fea48306 Binary files /dev/null and b/Calculator-project/src/main/java/.DS_Store differ diff --git a/Calculator-project/src/main/java/com/.DS_Store b/Calculator-project/src/main/java/com/.DS_Store new file mode 100644 index 00000000..cbdbe99a Binary files /dev/null and b/Calculator-project/src/main/java/com/.DS_Store differ diff --git a/Calculator-project/src/main/java/com/houarizegai/.DS_Store b/Calculator-project/src/main/java/com/houarizegai/.DS_Store new file mode 100644 index 00000000..0260a203 Binary files /dev/null and b/Calculator-project/src/main/java/com/houarizegai/.DS_Store differ diff --git a/Calculator-project/src/main/java/com/houarizegai/calculator/Calculator.java b/Calculator-project/src/main/java/com/houarizegai/calculator/Calculator.java new file mode 100644 index 00000000..6017df90 --- /dev/null +++ b/Calculator-project/src/main/java/com/houarizegai/calculator/Calculator.java @@ -0,0 +1,626 @@ +package com.houarizegai.calculator; + +import java.awt.Cursor; +import java.awt.Font; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.util.function.Consumer; +import java.util.regex.Pattern; +import java.awt.Color; +import javax.swing.*; +import java.lang.Math; + +public class Calculator { + + private static final int WINDOW_WIDTH = 410; + private static final int WINDOW_HEIGHT = 600; + private static final int BUTTON_WIDTH = 80; + private static final int BUTTON_HEIGHT = 70; + private static final int MARGIN_X = 20; + private static final int MARGIN_Y = 60; + + private JFrame window; // Main window + private JComboBox comboCalcType, comboTheme; + private JTextField inText; // Input + private JButton btnC, btnBack, btnMod, btnDiv, btnMul, btnSub, btnAdd, + btn0, btn1, btn2, btn3, btn4, btn5, btn6, btn7, btn8, btn9, + btnPoint, btnEqual, btnRoot, btnPower, btnLog; + + private char opt = ' '; // Save the operator + private boolean go = true; // For calculate with Opt != (=) + private boolean addWrite = true; // Connect numbers in display + private double val = 0; // Save the value typed for calculation + + /* + Mx Calculator: + X = Row + Y = Column + + +-------------------+ + | +-----------+ | y[0] + | | | | + | +-----------+ | + | | + | C <- % / | y[1] + | 7 8 9 * | y[2] + | 4 5 6 - | y[3] + | 1 2 3 + | y[4] + | . 0 = | y[5] + +-------------------+ + x[0] x[1] x[2] x[3] + + */ + + /* + +-------------------+ + | +-----------+ | y[0] + | | | | + | +-----------+ | + | | + | 0 1 1 3 | y[1] + | 4 5 6 7 | y[2] + | 8 9 10 11 | y[3] + | 12 13 14 15 | y[4] + | 16 17 18 | y[5] + +-------------------+ + x[0] x[1] x[2] x[3] + + */ + + public Calculator() { + window = new JFrame("Calculator"); + window.setSize(WINDOW_WIDTH, WINDOW_HEIGHT); + window.setLocationRelativeTo(null); // Move window to center + + comboTheme = initCombo(new String[]{"Simple", "Colored", "DarkTheme"}, 230, 30, "Theme", themeSwitchEventConsumer); + + comboCalcType = initCombo(new String[]{"Standard", "Scientific"}, 20, 30, "Calculator type", calcTypeSwitchEventConsumer); + + int[] x = {MARGIN_X, MARGIN_X + 90, 200, 290, 380}; + int[] y = {MARGIN_Y, MARGIN_Y + 100, MARGIN_Y + 180, MARGIN_Y + 260, MARGIN_Y + 340, MARGIN_Y + 420}; + + inText = new JTextField("0"); + inText.setBounds(x[0], y[0], 350, 70); + inText.setEditable(false); + inText.setBackground(Color.WHITE); + inText.setFont(new Font("Comic Sans MS", Font.PLAIN, 33)); + window.add(inText); + + btnC = initBtn("C", x[0], y[1], event -> { + repaintFont(); + inText.setText("0"); + opt = ' '; + val = 0; + }); + + btnBack = initBtn("<-", x[1], y[1], event -> { + repaintFont(); + String str = inText.getText(); + StringBuilder str2 = new StringBuilder(); + for (int i = 0; i < (str.length() - 1); i++) { + str2.append(str.charAt(i)); + } + if (str2.toString().equals("")) { + inText.setText("0"); + } else { + inText.setText(str2.toString()); + } + }); + + btnMod = initBtn("%", x[2], y[1], event -> { + repaintFont(); + if (Pattern.matches("([-]?\\d+[.]\\d*)|(\\d+)", inText.getText())) + if (go) { + val = calc(val, inText.getText(), opt); + if (Pattern.matches("[-]?[\\d]+[.][0]*", String.valueOf(val))) { + inText.setText(String.valueOf((int) val)); + } else { + inText.setText(String.valueOf(val)); + } + opt = '%'; + go = false; + addWrite = false; + } + }); + + btnDiv = initBtn("/", x[3], y[1], event -> { + repaintFont(); + if (Pattern.matches("([-]?\\d+[.]\\d*)|(\\d+)", inText.getText())) + if (go) { + val = calc(val, inText.getText(), opt); + if (Pattern.matches("[-]?[\\d]+[.][0]*", String.valueOf(val))) { + inText.setText(String.valueOf((int) val)); + } else { + inText.setText(String.valueOf(val)); + } + opt = '/'; + go = false; + addWrite = false; + } else { + opt = '/'; + } + }); + + btn7 = initBtn("7", x[0], y[2], event -> { + repaintFont(); + if (addWrite) { + if (Pattern.matches("[0]*", inText.getText())) { + inText.setText("7"); + } else { + inText.setText(inText.getText() + "7"); + } + } else { + inText.setText("7"); + addWrite = true; + } + go = true; + }); + + btn8 = initBtn("8", x[1], y[2], event -> { + repaintFont(); + if (addWrite) { + if (Pattern.matches("[0]*", inText.getText())) { + inText.setText("8"); + } else { + inText.setText(inText.getText() + "8"); + } + } else { + inText.setText("8"); + addWrite = true; + } + go = true; + }); + + btn9 = initBtn("9", x[2], y[2], event -> { + repaintFont(); + if (addWrite) { + if (Pattern.matches("[0]*", inText.getText())) { + inText.setText("9"); + } else { + inText.setText(inText.getText() + "9"); + } + } else { + inText.setText("9"); + addWrite = true; + } + go = true; + }); + + btnMul = initBtn("*", x[3], y[2], event -> { + repaintFont(); + if (Pattern.matches("([-]?\\d+[.]\\d*)|(\\d+)", inText.getText())) + if (go) { + val = calc(val, inText.getText(), opt); + if (Pattern.matches("[-]?[\\d]+[.][0]*", String.valueOf(val))) { + inText.setText(String.valueOf((int) val)); + } else { + inText.setText(String.valueOf(val)); + } + opt = '*'; + go = false; + addWrite = false; + } else { + opt = '*'; + } + }); + + btn4 = initBtn("4", x[0], y[3], event -> { + repaintFont(); + if (addWrite) { + if (Pattern.matches("[0]*", inText.getText())) { + inText.setText("4"); + } else { + inText.setText(inText.getText() + "4"); + } + } else { + inText.setText("4"); + addWrite = true; + } + go = true; + }); + + btn5 = initBtn("5", x[1], y[3], event -> { + repaintFont(); + if (addWrite) { + if (Pattern.matches("[0]*", inText.getText())) { + inText.setText("5"); + } else { + inText.setText(inText.getText() + "5"); + } + } else { + inText.setText("5"); + addWrite = true; + } + go = true; + }); + + btn6 = initBtn("6", x[2], y[3], event -> { + repaintFont(); + if (addWrite) { + if (Pattern.matches("[0]*", inText.getText())) { + inText.setText("6"); + } else { + inText.setText(inText.getText() + "6"); + } + } else { + inText.setText("6"); + addWrite = true; + } + go = true; + }); + + btnSub = initBtn("-", x[3], y[3], event -> { + repaintFont(); + if (Pattern.matches("([-]?\\d+[.]\\d*)|(\\d+)", inText.getText())) + if (go) { + val = calc(val, inText.getText(), opt); + if (Pattern.matches("[-]?[\\d]+[.][0]*", String.valueOf(val))) { + inText.setText(String.valueOf((int) val)); + } else { + inText.setText(String.valueOf(val)); + } + + opt = '-'; + go = false; + addWrite = false; + } else { + opt = '-'; + } + }); + + btn1 = initBtn("1", x[0], y[4], event -> { + repaintFont(); + if (addWrite) { + if (Pattern.matches("[0]*", inText.getText())) { + inText.setText("1"); + } else { + inText.setText(inText.getText() + "1"); + } + } else { + inText.setText("1"); + addWrite = true; + } + go = true; + }); + + btn2 = initBtn("2", x[1], y[4], event -> { + repaintFont(); + if (addWrite) { + if (Pattern.matches("[0]*", inText.getText())) { + inText.setText("2"); + } else { + inText.setText(inText.getText() + "2"); + } + } else { + inText.setText("2"); + addWrite = true; + } + go = true; + }); + + btn3 = initBtn("3", x[2], y[4], event -> { + repaintFont(); + if (addWrite) { + if (Pattern.matches("[0]*", inText.getText())) { + inText.setText("3"); + } else { + inText.setText(inText.getText() + "3"); + } + } else { + inText.setText("3"); + addWrite = true; + } + go = true; + }); + + btnAdd = initBtn("+", x[3], y[4], event -> { + repaintFont(); + if (Pattern.matches("([-]?\\d+[.]\\d*)|(\\d+)", inText.getText())) + if (go) { + val = calc(val, inText.getText(), opt); + if (Pattern.matches("[-]?[\\d]+[.][0]*", String.valueOf(val))) { + inText.setText(String.valueOf((int) val)); + } else { + inText.setText(String.valueOf(val)); + } + opt = '+'; + go = false; + addWrite = false; + } else { + opt = '+'; + } + }); + + btnPoint = initBtn(".", x[0], y[5], event -> { + repaintFont(); + if (addWrite) { + if (!inText.getText().contains(".")) { + inText.setText(inText.getText() + "."); + } + } else { + inText.setText("0."); + addWrite = true; + } + go = true; + }); + + btn0 = initBtn("0", x[1], y[5], event -> { + repaintFont(); + if (addWrite) { + if (Pattern.matches("[0]*", inText.getText())) { + inText.setText("0"); + } else { + inText.setText(inText.getText() + "0"); + } + } else { + inText.setText("0"); + addWrite = true; + } + go = true; + }); + + btnEqual = initBtn("=", x[2], y[5], event -> { + if (Pattern.matches("([-]?\\d+[.]\\d*)|(\\d+)", inText.getText())) + if (go) { + val = calc(val, inText.getText(), opt); + if (Pattern.matches("[-]?[\\d]+[.][0]*", String.valueOf(val))) { + inText.setText(String.valueOf((int) val)); + } else { + inText.setText(String.valueOf(val)); + } + opt = '='; + addWrite = false; + } + }); + btnEqual.setSize(2 * BUTTON_WIDTH + 10, BUTTON_HEIGHT); + + btnRoot = initBtn("√", x[4], y[1], event -> { + if (Pattern.matches("([-]?\\d+[.]\\d*)|(\\d+)", inText.getText())) + if (go) { + val = Math.sqrt(Double.parseDouble(inText.getText())); + if (Pattern.matches("[-]?[\\d]+[.][0]*", String.valueOf(val))) { + inText.setText(String.valueOf((int) val)); + } else { + inText.setText(String.valueOf(val)); + } + opt = '√'; + addWrite = false; + } + }); + btnRoot.setVisible(false); + + btnPower = initBtn("pow", x[4], y[2], event -> { + repaintFont(); + if (Pattern.matches("([-]?\\d+[.]\\d*)|(\\d+)", inText.getText())) + if (go) { + val = calc(val, inText.getText(), opt); + if (Pattern.matches("[-]?[\\d]+[.][0]*", String.valueOf(val))) { + inText.setText(String.valueOf((int) val)); + } else { + inText.setText(String.valueOf(val)); + } + opt = '^'; + go = false; + addWrite = false; + } else { + opt = '^'; + } + }); + btnPower.setFont(new Font("Comic Sans MS", Font.PLAIN, 24)); + btnPower.setVisible(false); + + btnLog = initBtn("ln", x[4], y[3], event -> { + if (Pattern.matches("([-]?\\d+[.]\\d*)|(\\d+)", inText.getText())) + if (go) { + val = Math.log(Double.parseDouble(inText.getText())); + if (Pattern.matches("[-]?[\\d]+[.][0]*", String.valueOf(val))) { + inText.setText(String.valueOf((int) val)); + } else { + inText.setText(String.valueOf(val)); + } + opt = 'l'; + addWrite = false; + } + }); + btnLog.setVisible(false); + + window.setLayout(null); + window.setResizable(false); + window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Close button clicked? = End The process + window.setVisible(true); + } + + private JComboBox initCombo(String[] items, int x, int y, String toolTip, Consumer consumerEvent) { + JComboBox combo = new JComboBox<>(items); + combo.setBounds(x, y, 140, 25); + combo.setToolTipText(toolTip); + combo.setCursor(new Cursor(Cursor.HAND_CURSOR)); + combo.addItemListener(consumerEvent::accept); + window.add(combo); + + return combo; + } + + private JButton initBtn(String label, int x, int y, ActionListener event) { + JButton btn = new JButton(label); + btn.setBounds(x, y, BUTTON_WIDTH, BUTTON_HEIGHT); + btn.setFont(new Font("Comic Sans MS", Font.PLAIN, 28)); + btn.setCursor(new Cursor(Cursor.HAND_CURSOR)); + btn.addActionListener(event); + btn.setFocusable(false); + window.add(btn); + + return btn; + } + + public double calc(double x, String input, char opt) { + inText.setFont(inText.getFont().deriveFont(Font.PLAIN)); + double y = Double.parseDouble(input); + switch (opt) { + case '+': + return x + y; + case '-': + return x - y; + case '*': + return x * y; + case '/': + return x / y; + case '%': + return x % y; + case '^': + return Math.pow(x, y); + default: + inText.setFont(inText.getFont().deriveFont(Font.PLAIN)); + return y; + } + } + + private void repaintFont() { + inText.setFont(inText.getFont().deriveFont(Font.PLAIN)); + } + + private Consumer calcTypeSwitchEventConsumer = event -> { + if (event.getStateChange() != ItemEvent.SELECTED) return; + + String selectedItem = (String) event.getItem(); + switch (selectedItem) { + case "Standard": + window.setSize(WINDOW_WIDTH, WINDOW_HEIGHT); + btnRoot.setVisible(false); + btnPower.setVisible(false); + btnLog.setVisible(false); + break; + case "Scientific": + window.setSize(WINDOW_WIDTH + 80, WINDOW_HEIGHT); + btnRoot.setVisible(true); + btnPower.setVisible(true); + btnLog.setVisible(true); + break; + } + }; + + private Consumer themeSwitchEventConsumer = event -> { + if (event.getStateChange() != ItemEvent.SELECTED) return; + + String selectedTheme = (String) event.getItem(); + switch (selectedTheme) { + case "Simple": + window.getContentPane().setBackground(null); + btnC.setBackground(null); + btnBack.setBackground(null); + btnMod.setBackground(null); + btnDiv.setBackground(null); + btnMul.setBackground(null); + btnSub.setBackground(null); + btnAdd.setBackground(null); + btnRoot.setBackground(null); + btnLog.setBackground(null); + btnPower.setBackground(null); + btnEqual.setBackground(null); + btn0.setBackground(null); + btn1.setBackground(null); + btn2.setBackground(null); + btn3.setBackground(null); + btn4.setBackground(null); + btn5.setBackground(null); + btn6.setBackground(null); + btn7.setBackground(null); + btn8.setBackground(null); + btn9.setBackground(null); + btnPoint.setBackground(null); + + btnC.setForeground(Color.BLACK); + btnBack.setForeground(Color.BLACK); + btnMod.setForeground(Color.BLACK); + btnDiv.setForeground(Color.BLACK); + btnMul.setForeground(Color.BLACK); + btnSub.setForeground(Color.BLACK); + btnAdd.setForeground(Color.BLACK); + btnEqual.setForeground(Color.BLACK); + btnLog.setForeground(Color.BLACK); + btnPower.setForeground(Color.BLACK); + btnRoot.setForeground(Color.BLACK); + break; + case "Colored": + window.getContentPane().setBackground(null); + btnC.setBackground(Color.RED); + btnBack.setBackground(Color.ORANGE); + btnMod.setBackground(Color.GREEN); + btnDiv.setBackground(Color.PINK); + btnMul.setBackground(Color.PINK); + btnSub.setBackground(Color.PINK); + btnAdd.setBackground(Color.PINK); + btnRoot.setBackground(Color.PINK); + btnLog.setBackground(Color.PINK); + btnPower.setBackground(Color.PINK); + btnEqual.setBackground(Color.BLUE); + btn0.setBackground(Color.WHITE); + btn1.setBackground(Color.WHITE); + btn2.setBackground(Color.WHITE); + btn3.setBackground(Color.WHITE); + btn4.setBackground(Color.WHITE); + btn5.setBackground(Color.WHITE); + btn6.setBackground(Color.WHITE); + btn7.setBackground(Color.WHITE); + btn8.setBackground(Color.WHITE); + btn9.setBackground(Color.WHITE); + btnPoint.setBackground(Color.WHITE); + + btnC.setForeground(new Color(255, 0, 0)); + btnBack.setForeground(new Color(255, 255, 0)); + btnMod.setForeground(new Color(0, 128, 0)); + btnDiv.setForeground(new Color(170, 51, 106)); + btnMul.setForeground(new Color(170, 51, 106)); + btnSub.setForeground(new Color(170, 51, 106)); + btnAdd.setForeground(new Color(170, 51, 106)); + btnEqual.setForeground(new Color(0, 0, 139)); + btnLog.setForeground(new Color(170, 51, 106)); + btnPower.setForeground(new Color(170, 51, 106)); + btnRoot.setForeground(new Color(170, 51, 106)); + break; + case "DarkTheme": + final Color primaryDarkColor = new Color(141, 38, 99); + final Color secondaryDarkColor = new Color(171, 171, 171); + + window.getContentPane().setBackground(new Color(68, 68, 68)); + btn0.setBackground(secondaryDarkColor); + btn1.setBackground(secondaryDarkColor); + btn2.setBackground(secondaryDarkColor); + btn3.setBackground(secondaryDarkColor); + btn4.setBackground(secondaryDarkColor); + btn5.setBackground(secondaryDarkColor); + btn6.setBackground(secondaryDarkColor); + btn7.setBackground(secondaryDarkColor); + btn8.setBackground(secondaryDarkColor); + btn9.setBackground(secondaryDarkColor); + btnPoint.setBackground(secondaryDarkColor); + + btnC.setForeground(secondaryDarkColor); + btnBack.setForeground(secondaryDarkColor); + btnMod.setForeground(secondaryDarkColor); + btnDiv.setForeground(secondaryDarkColor); + btnMul.setForeground(secondaryDarkColor); + btnSub.setForeground(secondaryDarkColor); + btnAdd.setForeground(secondaryDarkColor); + btnEqual.setForeground(secondaryDarkColor); + btnLog.setForeground(secondaryDarkColor); + btnPower.setForeground(secondaryDarkColor); + btnRoot.setForeground(secondaryDarkColor); + btnC.setBackground(primaryDarkColor); + btnBack.setBackground(primaryDarkColor); + btnMod.setBackground(primaryDarkColor); + btnDiv.setBackground(primaryDarkColor); + btnMul.setBackground(primaryDarkColor); + btnSub.setBackground(primaryDarkColor); + btnAdd.setBackground(primaryDarkColor); + btnRoot.setBackground(primaryDarkColor); + btnLog.setBackground(primaryDarkColor); + btnPower.setBackground(primaryDarkColor); + btnEqual.setBackground(primaryDarkColor); + } + }; + + public static void main(String[] args) { + new Calculator(); + } +} \ No newline at end of file diff --git a/Calculator-project/src/test/java/com/houarizegai/calculator/CalculatorTest.java b/Calculator-project/src/test/java/com/houarizegai/calculator/CalculatorTest.java new file mode 100644 index 00000000..7ec01158 --- /dev/null +++ b/Calculator-project/src/test/java/com/houarizegai/calculator/CalculatorTest.java @@ -0,0 +1,36 @@ +package com.houarizegai.calculator; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +class CalculatorTest { + + private Calculator calculator; + + @BeforeEach + void setUp() { // Create object before compilation + calculator = new Calculator(); + } + + /* + * testCalc() test method + */ + @Test + void testCalc() { + double first = 3; + String second = "5"; + + try { + Assertions.assertEquals(8, calculator.calc(first, second, '+')); + Assertions.assertEquals(-2, calculator.calc(first, second, '-')); + Assertions.assertEquals(15, calculator.calc(first, second, '*')); + Assertions.assertEquals(0.6, calculator.calc(first, second, '/')); + Assertions.assertEquals(3d, calculator.calc(first, second, '%')); + Assertions.assertEquals(243, calculator.calc(first, second, '^')); + } catch (Exception e) { + e.printStackTrace(); + } + + } +} diff --git a/Calculator.java b/Calculator.java new file mode 100644 index 00000000..f5d22d55 --- /dev/null +++ b/Calculator.java @@ -0,0 +1,61 @@ +// Java program for simple calculator +import java.io.*; +import java.lang.*; +import java.lang.Math; +import java.util.Scanner; + +// Driver class +public class BasicCalculator { + // main function + public static void main(String[] args) + { + // Stores two numbers + double num1, num2; + + // Take input from the user + Scanner sc = new Scanner(System.in); + + System.out.println("Enter the numbers:"); + + // Take the inputs + num1 = sc.nextDouble(); + num2 = sc.nextDouble(); + + System.out.println("Enter the operator (+,-,*,/):"); + + char op = sc.next().charAt(0); + double o = 0; + + switch (op) { + // case to add two numbers + case '+': + o = num1 + num2; + break; + + // case to subtract two numbers + case '-': + o = num1 - num2; + break; + + // case to multiply two numbers + case '*': + o = num1 * num2; + break; + + // case to divide two numbers + case '/': + o = num1 / num2; + break; + + default: + System.out.println("You enter wrong input"); + } + + System.out.println("The final result:"); + System.out.println(); + + // print the final result + System.out.println(num1 + " " + op + " " + num2 + + " = " + o); + } +} diff --git a/Calculator.py b/Calculator.py new file mode 100644 index 00000000..a6b902e3 --- /dev/null +++ b/Calculator.py @@ -0,0 +1,19 @@ +import sys + +# Check number of strings passed +if len(sys.argv) != 4: + print("Usage: python Calculator.py operand1 operator operand2") + sys.exit() + +# Determine the operator +if sys.argv[2][0] == '+': + result = eval(sys.argv[1]) + eval(sys.argv[3]) +elif sys.argv[2][0] == '-': + result = eval(sys.argv[1]) - eval(sys.argv[3]) +elif sys.argv[2][0] == '*': + result = eval(sys.argv[1]) * eval(sys.argv[3]) +elif sys.argv[2][0] == '/': + result = eval(sys.argv[1]) / eval(sys.argv[3]) + +# Display result +print(sys.argv[1], sys.argv[2], sys.argv[3], "=", result) diff --git a/CalculatorAWT.java b/CalculatorAWT.java new file mode 100644 index 00000000..8913bac8 --- /dev/null +++ b/CalculatorAWT.java @@ -0,0 +1,266 @@ +import java.awt.*; +import java.awt.event.*; +class MyCalc extends WindowAdapter implements ActionListener{ + Frame f; +Label l1; +Button b1,b2,b3,b4,b5,b6,b7,b8,b9,b0; +Button badd,bsub,bmult,bdiv,bmod,bcalc,bclr,bpts,bneg,bback; +double xd; +double num1,num2,check; + +MyCalc(){ + f= new Frame("MY CALCULATOR"); +// INSTANTIATING COMPONENETS +l1=new Label(); +l1.setBackground(Color.LIGHT_GRAY); +l1.setBounds(50,50,260,60); + + +b1=new Button("1"); + b1.setBounds(50,340,50,50); +b2=new Button("2"); + b2.setBounds(120,340,50,50); +b3=new Button("3"); + b3.setBounds(190,340,50,50); +b4=new Button("4"); + b4.setBounds(50,270,50,50); +b5=new Button("5"); + b5.setBounds(120,270,50,50); +b6=new Button("6"); + b6.setBounds(190,270,50,50); +b7=new Button("7"); + b7.setBounds(50,200,50,50); +b8=new Button("8"); + b8.setBounds(120,200,50,50); +b9=new Button("9"); + b9.setBounds(190,200,50,50); +b0=new Button("0"); + b0.setBounds(120,410,50,50); +bneg=new Button("+/-"); + bneg.setBounds(50,410,50,50); +bpts=new Button("."); + bpts.setBounds(190,410,50,50); +bback=new Button("back"); + bback.setBounds(120,130,50,50); + +badd=new Button("+"); + badd.setBounds(260,340,50,50); +bsub=new Button("-"); + bsub.setBounds(260,270,50,50); +bmult=new Button("*"); + bmult.setBounds(260,200,50,50); +bdiv=new Button("/"); + bdiv.setBounds(260,130,50,50); +bmod=new Button("%"); + bmod.setBounds(190,130,50,50); +bcalc=new Button("="); + bcalc.setBounds(245,410,65,50); +bclr=new Button("CE"); + bclr.setBounds(50,130,65,50); + + +b1.addActionListener(this); +b2.addActionListener(this); +b3.addActionListener(this); +b4.addActionListener(this); +b5.addActionListener(this); +b6.addActionListener(this); +b7.addActionListener(this); +b8.addActionListener(this); +b9.addActionListener(this); +b0.addActionListener(this); + +bpts.addActionListener(this); +bneg.addActionListener(this); +bback.addActionListener(this); + +badd.addActionListener(this); +bsub.addActionListener(this); +bmult.addActionListener(this); +bdiv.addActionListener(this); +bmod.addActionListener(this); +bcalc.addActionListener(this); +bclr.addActionListener(this); + +f.addWindowListener(this); +//ADDING TO FRAME +f.add(l1); +f.add(b1); f.add(b2); f.add(b3); f.add(b4); f.add(b5);f.add(b6); f.add(b7); f.add(b8);f.add(b9);f.add(b0); + +f.add(badd); f.add(bsub); f.add(bmod); f.add(bmult); f.add(bdiv); f.add(bmod);f.add(bcalc); + +f.add(bclr); f.add(bpts);f.add(bneg); f.add(bback); + +f.setSize(360,500); +f.setLayout(null); +f.setVisible(true); +} + //FOR CLOSING THE WINDOW +public void windowClosing(WindowEvent e) { + f.dispose(); +} + +public void actionPerformed(ActionEvent e){ + String z,zt; + //NUMBER BUTTON +if(e.getSource()==b1){ + zt=l1.getText(); + z=zt+"1"; + l1.setText(z); +} +if(e.getSource()==b2){ +zt=l1.getText(); +z=zt+"2"; +l1.setText(z); +} +if(e.getSource()==b3){ + zt=l1.getText(); + z=zt+"3"; + l1.setText(z); +} +if(e.getSource()==b4){ + zt=l1.getText(); + z=zt+"4"; + l1.setText(z); +} +if(e.getSource()==b5){ + zt=l1.getText(); + z=zt+"5"; + l1.setText(z); +} +if(e.getSource()==b6){ + zt=l1.getText(); + z=zt+"6"; + l1.setText(z); +} +if(e.getSource()==b7){ + zt=l1.getText(); + z=zt+"7"; + l1.setText(z); +} +if(e.getSource()==b8){ + zt=l1.getText(); + z=zt+"8"; + l1.setText(z); +} +if(e.getSource()==b9){ + zt=l1.getText(); + z=zt+"9"; + l1.setText(z); +} +if(e.getSource()==b0){ + zt=l1.getText(); + z=zt+"0"; + l1.setText(z); +} + +if(e.getSource()==bpts){ //ADD DECIMAL PTS + zt=l1.getText(); + z=zt+"."; + l1.setText(z); +} +if(e.getSource()==bneg){ //FOR NEGATIVE + zt=l1.getText(); + z="-"+zt; + l1.setText(z); +} + +if(e.getSource()==bback){ // FOR BACKSPACE + zt=l1.getText(); + try{ + z=zt.substring(0, zt.length()-1); + }catch(StringIndexOutOfBoundsException f){return;} + l1.setText(z); +} + //AIRTHMETIC BUTTON +if(e.getSource()==badd){ //FOR ADDITION + try{ + num1=Double.parseDouble(l1.getText()); + }catch(NumberFormatException f){ + l1.setText("Invalid Format"); + return; + } + z=""; + l1.setText(z); + check=1; +} +if(e.getSource()==bsub){ //FOR SUBTRACTION + try{ + num1=Double.parseDouble(l1.getText()); + }catch(NumberFormatException f){ + l1.setText("Invalid Format"); + return; + } + z=""; + l1.setText(z); + check=2; +} +if(e.getSource()==bmult){ //FOR MULTIPLICATION + try{ + num1=Double.parseDouble(l1.getText()); + }catch(NumberFormatException f){ + l1.setText("Invalid Format"); + return; + } + z=""; + l1.setText(z); + check=3; +} +if(e.getSource()==bdiv){ //FOR DIVISION + try{ + num1=Double.parseDouble(l1.getText()); + }catch(NumberFormatException f){ + l1.setText("Invalid Format"); + return; + } + z=""; + l1.setText(z); + check=4; +} +if(e.getSource()==bmod){ //FOR MOD/REMAINDER + try{ + num1=Double.parseDouble(l1.getText()); + }catch(NumberFormatException f){ + l1.setText("Invalid Format"); + return; + } + z=""; + l1.setText(z); + check=5; +} + //RESULT BUTTON +if(e.getSource()==bcalc){ + try{ + num2=Double.parseDouble(l1.getText()); + }catch(Exception f){ + l1.setText("ENTER NUMBER FIRST "); + return; + } + if(check==1) + xd =num1+num2; + if(check==2) + xd =num1-num2; + if(check==3) + xd =num1*num2; + if(check==4) + xd =num1/num2; + if(check==5) + xd =num1%num2; + l1.setText(String.valueOf(xd)); +} + //FOR CLEARING THE LABEL and Memory +if(e.getSource()==bclr){ + num1=0; + num2=0; + check=0; + xd=0; + z=""; + l1.setText(z); + } + +} +//MAIN METHOD where objects of MyCalc is instantaiated + public static void main(String args[]){ + new MyCalc(); + } +} diff --git a/Calculator_frame.java b/Calculator_frame.java new file mode 100644 index 00000000..1be2261b --- /dev/null +++ b/Calculator_frame.java @@ -0,0 +1,207 @@ +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; +public class Calculator_frame extends Frame implements ActionListener +{ + TextField tf; + Label l1,l2; + Button b1, b2, b3, b4, b5, b6, b7,b8, b9, b0, bA, bM, c, eq, bD, bS; + String s = ""; + + public Calculator_frame() { + l1=new Label("Calculator X"); + l1.setBounds(100,30,100,30); + l1.setFont(new Font("Verdana", Font.BOLD, 15)); + tf = new TextField(); + setSize(300,350); + + tf.setBounds(10, 60, 200, 30); + tf.setText("0"); + tf.setEditable(false); + + b9 = new Button("9"); + b9.setBounds(10,90, 40, 40); + b9.setActionCommand("b9"); + b9.addActionListener(this); + b9.setBackground(Color.LIGHT_GRAY); + + b8 = new Button("8"); + b8.setBounds(50,90, 40, 40); + b8.setActionCommand("b8"); + b8.addActionListener(this); + + b7 = new Button("7"); + b7.setBounds(90,90, 40, 40); + b7.setActionCommand("b7"); + b7.addActionListener(this); + + b6 = new Button("6"); + b6.setBounds(10,130, 40, 40); + b6.setActionCommand("b6"); + b6.addActionListener(this); + + b5 = new Button("5"); + b5.setBounds(50,130, 40, 40); + b5.setActionCommand("b5"); + b5.addActionListener(this); + + b4 = new Button("4"); + b4.setBounds(90,130, 40, 40); + b4.setActionCommand("b4"); + b4.addActionListener(this); + + b3 = new Button("3"); + b3.setBounds(10,170, 40, 40); + b3.setActionCommand("b3"); + b3.addActionListener(this); + + b2 = new Button("2"); + b2.setBounds(50,170, 40, 40); + b2.setActionCommand("b2"); + b2.addActionListener(this); + + b1 = new Button("1"); + b1.setBounds(90,170, 40, 40); + b1.setActionCommand("b1"); + b1.addActionListener(this); + + b0 = new Button("0"); + b0.setBounds(10,210, 40, 40); + b0.setActionCommand("b0"); + b0.addActionListener(this); + + eq = new Button("="); + eq.setBounds(50,210, 80, 40); + eq.setActionCommand("eq"); + eq.addActionListener(this); + + c = new Button("C"); + c.setBounds(130,90, 80, 40); + c.setActionCommand("c"); + c.addActionListener(this); + + bA = new Button("+"); + bA.setBounds(130,130, 40, 40); + bA.setActionCommand("bA"); + bA.addActionListener(this); + + bS = new Button("-"); + bS.setBounds(170,130, 40, 40); + bS.setActionCommand("bS"); + bS.addActionListener(this); + + bM = new Button("X"); + bM.setBounds(130,170, 40, 40); + bM.setActionCommand("bM"); + bM.addActionListener(this); + + bD = new Button("/"); + bD.setBounds(170,170, 40, 40); + bD.setActionCommand("bD"); + bD.addActionListener(this); + l2=new Label("Made By: Rajesh"); + l2.setBounds(10,250,250,40); + add(l1);add(tf);add(b9);add(b8);add(b7);add(b6);add(b5);add(b4);add(b3);add(b2);add(b1);add(b0);add(eq); + add(c);add(bA);add(bS);add(bM);add(bD);add(l2); + + addWindowListener(new WindowListener() { + public void windowOpened(WindowEvent e) {} + public void windowIconified(WindowEvent e) {} + public void windowDeiconified(WindowEvent e) {} + public void windowDeactivated(WindowEvent e) {} + public void windowClosing(WindowEvent e) { dispose();} + public void windowClosed(WindowEvent e) {} + public void windowActivated(WindowEvent e) {} + }); + + addKeyListener(new KeyListener() { + public void keyTyped(KeyEvent e) { + char c=e.getKeyChar(); + switch(c) + { + case '1': s=s.concat("1");tf.setText(s); + break; + } + } + public void keyReleased(KeyEvent e) {} + public void keyPressed(KeyEvent e) {} + + }); + setLayout(null); + setVisible(true); + + } + public int calcString(String a){ + String operators[]=a.split("[0-9]+"); + String operands[]=a.split("\\+|\\-|x|\\/",0); + + /*StringBuffer sb = new StringBuffer(); + for(int i = 0; i < operands.length; i++) { + sb.append(operands[i]); + } + String str = sb.toString(); + System.out.println(str);*/ + + int agregate = Integer.parseInt(operands[0]); + for(int i=1;i candies) { + amt = candies; + } + + candies -= amt; + money += amt; + + return amt; + } + + public void print() { + System.out.println("Candies left: " + candies); + System.out.println("Money collected: " + money); + } + + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + + System.out.println("Welcome to the candy vending machine!"); + + int candies = sc.nextInt(); + + CandyVendor vendor = new CandyVendor(candies); + + while (true) { + System.out.println("How much money do you want to insert?"); + + int money = sc.nextInt(); + + int candiesDispensed = vendor.buy(money); + + if (candiesDispensed == 0) { + System.out.println("Not enough candies or money!"); + } else { + System.out.println("Here are your candies!"); + } + + vendor.print(); + + System.out.println("Do you want to buy more candy? (y/n)"); + + String choice = sc.next(); + + if (!choice.equalsIgnoreCase("y")) { + break; + } + } + + sc.close(); + } +} \ No newline at end of file diff --git a/CanvasDemo.py b/CanvasDemo.py new file mode 100644 index 00000000..fe785349 --- /dev/null +++ b/CanvasDemo.py @@ -0,0 +1,76 @@ +from tkinter import * # Import tkinter + +class CanvasDemo: + def __init__(self): + window = Tk() # Create a window + window.title("Canvas Demo") # Set title + + # Place self.canvas in the window + self.canvas = Canvas(window, width = 200, height = 100, + bg = "white") + self.canvas.pack() + + # Place buttons in frame + frame = Frame(window) + frame.pack() + btRectangle = Button(frame, text = "Rectangle", + command = self.displayRect) + btOval = Button(frame, text = "Oval", + command = self.displayOval) + btArc = Button(frame, text = "Arc", + command = self.displayArc) + btPolygon = Button(frame, text = "Polygon", + command = self.displayPolygon) + btLine = Button(frame, text = "Line", + command = self.displayLine) + btString = Button(frame, text = "String", + command = self.displayString) + btClear = Button(frame, text = "Clear", + command = self.clearCanvas) + btRectangle.grid(row = 1, column = 1) + btOval.grid(row = 1, column = 2) + btArc.grid(row = 1, column = 3) + btPolygon.grid(row = 1, column = 4) + btLine.grid(row = 1, column = 5) + btString.grid(row = 1, column = 6) + btClear.grid(row = 1, column = 7) + + window.mainloop() # Create an event loop + + # Display a rectangle + def displayRect(self): + self.canvas.create_rectangle(10, 10, 190, 90, tags = "rect") + + # Display an oval + def displayOval(self): + self.canvas.create_oval(10, 10, 190, 90, fill = "red", + tags = "oval") + + # Display an arc + def displayArc(self): + self.canvas.create_arc(10, 10, 190, 90, start = 0, + extent = 90, width = 8, fill = "red", tags = "arc") + + # Display a polygon + def displayPolygon(self): + self.canvas.create_polygon(10, 10, 190, 90, 30, 50, + tags = "polygon") + + # Display a line + def displayLine(self): + self.canvas.create_line(10, 10, 190, 90, fill = "red", + tags = "line") + self.canvas.create_line(10, 90, 190, 10, width = 9, + arrow = "last", activefill = "blue", tags = "line") + + # Display a string + def displayString(self): + self.canvas.create_text(60, 40, text = "Hi, I am a string", + font = "Times 10 bold underline", tags = "string") + + # Clear drawings + def clearCanvas(self): + self.canvas.delete("rect", "oval", "arc", "polygon", + "line", "string") + +CanvasDemo() # Create GUI \ No newline at end of file diff --git a/Challenge.java b/Challenge.java new file mode 100644 index 00000000..9bcee0e0 --- /dev/null +++ b/Challenge.java @@ -0,0 +1,51 @@ +import java.util.Scanner; +public class Challenge { + static boolean isLeapYear(int n) { + if (n % 100 == 0) { + return (n % 400) == 0; + } else { + return n % 4 == 0; + } + } + static int numLYunsorted(int[] a){ + int count=0; + for (int j : a) { + if (isLeapYear(j)) { + count++; + } + } + return count; + } + public static void main(String[] args){ + Scanner sc = new Scanner(System.in); + + System.out.println("Enter the Lower and Upper range."); + System.out.print("\nlower range:"); + int l=sc.nextInt(); + System.out.print("upper range:"); + int u=sc.nextInt(); +// int res1=numLYrange(l,u); + + System.out.println("Enter no. of years in the sorted list:"); + int n=sc.nextInt(); + int[] arry = new int[n]; + System.out.println("Enter the list of years:"); + for(int i=0;i{ + System.out.println("reader started..."); + + try{ + while(true){ + + String msg = br.readLine(); + if(msg.equals("EXIT")){System.out.println("Server terminated the chatting!!"); + socket.close(); + break;} + + System.out.println("Server : "+msg); + + + } + }catch(Exception e){System.out.print("----Connection is Closed----");} + }; + + new Thread(r1).start(); + } + + + + public void startWriting(){ + Runnable r2=()->{ + System.out.println("Writer started..."); + + try{ + while(!socket.isClosed()){ + + BufferedReader br1 = new BufferedReader(new InputStreamReader(System.in)); + + String content=br1.readLine(); + out.println(content); + out.flush(); + + if(content.equals("EXIT")){ + socket.close(); + break; + } + + System.out.print("----Connection is Closed----"); + } + }catch(Exception e){}; + }; + + new Thread(r2).start(); + } + + + + public static void main(String[] args){ + + System.out.println("this is client..."); + new Client(); + } +} diff --git a/Chat Project/Server.java b/Chat Project/Server.java new file mode 100644 index 00000000..59fd32c5 --- /dev/null +++ b/Chat Project/Server.java @@ -0,0 +1,97 @@ +import java.net.*; + +import javax.sound.sampled.SourceDataLine; + +import java.io.*; + +class Server{ + +ServerSocket server; +Socket socket; + +BufferedReader br; +PrintWriter out; + + public Server(){ + try{server = new ServerSocket(7777); + System.out.println("Server is ready to accept connection"); + System.out.println("waiting..."); + socket=server.accept(); + + br = new BufferedReader(new InputStreamReader(socket.getInputStream())); + + out = new PrintWriter(socket.getOutputStream()); + + startReading(); + startWriting(); + + + + + } catch(Exception e ){};} + + +public void startReading(){ + Runnable r1=()->{ + System.out.println("reader started..."); + + try{ + while(true){ + + String msg = br.readLine(); + if(msg.equals("EXIT")){System.out.println("Client terminated the chatting"); + socket.close(); + break;} + + System.out.println("Client : "+msg); + + + } + } catch(Exception e){System.out.print("----Connection is Closed----");} + }; + + new Thread(r1).start(); +} + + + +public void startWriting(){ + Runnable r2=()->{ + System.out.println("Writer started..."); + + try{ + while(!socket.isClosed()){ + + BufferedReader br1 = new BufferedReader(new InputStreamReader(System.in)); + + String content=br1.readLine(); + + out.println(content); + out.flush(); + + if(content.equals("EXIT")){ + socket.close(); + break; + } + + } + } catch(Exception e){System.out.print("----Connection is Closed----");}; + + }; + + new Thread(r2).start(); +} + + + + + + +public static void main(String[] args){ + System.out.println("This is server..going to start server"); + new Server(); +} + + + +} diff --git a/Chat Project/mclient.java b/Chat Project/mclient.java new file mode 100644 index 00000000..412403c3 --- /dev/null +++ b/Chat Project/mclient.java @@ -0,0 +1,43 @@ +import java.util.*; +import java.net.*; +import java.io.*; + +public class mclient { + + public static void main(String s[]) throws Exception { + Socket s1 = null; + String line = null; + DataInputStream br = null; + DataInputStream is = null; + PrintWriter os = null; + try { + s1 = new Socket("localhost", 9999); + br = new DataInputStream(System.in); + is = new DataInputStream(s1.getInputStream()); + os = new PrintWriter(s1.getOutputStream()); + + } catch (IOException e) { + System.err.print("IO Exception"); + + } + System.out.println("Enter data to server (enter QUIT to end) :-> "+s1.getRemoteSocketAddress().toString()); + String res = null; + try { + line = br.readLine(); + while (line.compareTo("QUIT") != 0) { + os.println(line); + os.flush(); + res = is.readLine(); + System.out.println("server response :-> " + res); + line = br.readLine(); + } + is.close(); + os.close(); + br.close(); + s1.close(); + System.out.println("close connection "); + } catch (IOException e) { + System.out.println("socket read error"); + } + } +} diff --git a/Chat Project/mserver.java b/Chat Project/mserver.java new file mode 100644 index 00000000..020e4d0a --- /dev/null +++ b/Chat Project/mserver.java @@ -0,0 +1,63 @@ +import java.util.*; +import java.net.*; +import java.io.*; + +public class mserver { + + public static void main(String s[]) throws Exception { + Socket sa = null; + ServerSocket ss2 = null; + System.out.println("Host starts accepting response "); + try { + ss2 = new ServerSocket(9999); + } catch (IOException e) { + System.out.println("server error"); + } + while (true) { + try { + sa = ss2.accept(); + System.out.println("connetion established by"+ ss2.getInetAddress()); + ServerThread st = new ServerThread(sa); + st.start(); + } catch (Exception e) { + System.out.println("connetion error"); + } + } + } +} + +class ServerThread extends Thread { + String line = null; + DataInputStream is = null; + PrintWriter od = null; + Socket s1 = null; + + public ServerThread(Socket s) { + s1 = s; + } ++ + public void run() { + try { + + is = new DataInputStream(s1.getInputStream()); + od = new PrintWriter(s1.getOutputStream()); + + line = is.readLine(); + + while (!line.equals("QUIT")) { + od.println(line); + od.flush(); + + System.out.println("response to client " + line); + line = is.readLine(); + + } + is.close(); + od.close(); + s1.close(); + + } catch (IOException ie) { + System.out.println("socket close error"); + } + } +} \ No newline at end of file diff --git a/CheckSudokuSolution.py b/CheckSudokuSolution.py new file mode 100644 index 00000000..ed75fd63 --- /dev/null +++ b/CheckSudokuSolution.py @@ -0,0 +1,29 @@ +# Check whether a solution is valid +def isValid(grid): + for i in range(9): + for j in range(9): + if grid[i][j] < 1 or grid[i][j] > 9 \ + or not isValidAt(i, j, grid): + return False + return True # The fixed cells are valid + +# Check whether grid[i][j] is valid in the grid +def isValidAt(i, j, grid): + # Check whether grid[i][j] is valid at the i's row + for column in range(9): + if column != j and grid[i][column] == grid[i][j]: + return False + + # Check whether grid[i][j] is valid at the j's column + for row in range(9): + if row != i and grid[row][j] == grid[i][j]: + return False + + # Check whether grid[i][j] is valid in the 3 by 3 box + for row in range((i // 3) * 3, (i // 3) * 3 + 3): + for col in range((j // 3) * 3, (j // 3) * 3 + 3): + if row != i and col != j and \ + grid[row][col] == grid[i][j]: + return False + + return True # The current value at grid[i][j] is valid diff --git a/CheckSudokuSolution.txt b/CheckSudokuSolution.txt new file mode 100644 index 00000000..ed3d11cf --- /dev/null +++ b/CheckSudokuSolution.txt @@ -0,0 +1,9 @@ +9 6 3 1 7 4 2 5 8 +1 7 8 3 2 5 6 4 9 +2 5 4 6 8 9 7 3 1 +8 2 1 4 3 7 5 9 6 +4 9 6 8 5 2 3 1 7 +7 3 5 9 6 1 8 2 4 +5 8 9 7 1 3 4 6 2 +3 1 7 2 4 6 9 8 5 +6 4 2 5 9 8 1 7 3 \ No newline at end of file diff --git a/ChessBoard.py b/ChessBoard.py new file mode 100644 index 00000000..c5dd1f39 --- /dev/null +++ b/ChessBoard.py @@ -0,0 +1,44 @@ +import turtle + +# Draw chess board borders +turtle.pensize(3) # Set pen thickness to 3 pixels +turtle.penup() # Pull the pen up +turtle.goto(-120, -120) +turtle.pendown() # Pull the pen down +turtle.color("red") + +for i in range(4): + turtle.forward(240) # Draw a line + turtle.left(90) # Turn left 90 degrees + +# Draw chess board inside +turtle.color("black") +for j in range(-120, 90, 60): + for i in range(-120, 120, 60): + turtle.penup() + turtle.goto(i, j) + turtle.pendown() + + # Draw a small rectangle + turtle.begin_fill() + for k in range(4): + turtle.forward(30) # Draw a line + turtle.left(90) # Turn left 90 degrees + turtle.end_fill() + +for j in range(-90, 120, 60): + for i in range(-90, 120, 60): + turtle.penup() + turtle.goto(i, j) + turtle.pendown() + + # Draw a small rectangle + turtle.begin_fill() + for k in range(4): + turtle.forward(30) # Draw a line + turtle.left(90) # Turn left 90 degrees + turtle.end_fill() + +turtle.hideturtle() + +turtle.done() diff --git a/Circular_queue.java b/Circular_queue.java new file mode 100644 index 00000000..c020c8b6 --- /dev/null +++ b/Circular_queue.java @@ -0,0 +1,75 @@ +public class CircularQueue { + private int[] arr; + private int front; + private int rear; + private int capacity; + private int size; + + public CircularQueue(int capacity) { + this.capacity = capacity; + this.arr = new int[capacity]; + this.front = -1; + this.rear = -1; + this.size = 0; + } + + public boolean isEmpty() { + return size == 0; + } + + public boolean isFull() { + return size == capacity; + } + + public void enqueue(int element) { + if (isFull()) { + System.out.println("Queue is full. Cannot enqueue more elements."); + return; + } + + if (isEmpty()) { + front = 0; + } + + rear = (rear + 1) % capacity; + arr[rear] = element; + size++; + } + + public int dequeue() { + if (isEmpty()) { + System.out.println("Queue is empty. Cannot dequeue elements."); + return -1; + } + + int element = arr[front]; + if (front == rear) { + front = -1; + rear = -1; + } else { + front = (front + 1) % capacity; + } + + size--; + + return element; + } + + public int front() { + if (isEmpty()) { + System.out.println("Queue is empty. No front element."); + return -1; + } + + return arr[front]; + } +} + public static void main(String[] args) { + CircularQueue queue = new CircularQueue(5); + queue.enqueue(1); + queue.enqueue(2); + queue.enqueue(3); + + System.out.println(queue.dequeue()); // Output: 1 + System.out.println(queue.front()); // Output: 2 + } diff --git a/Clue Simulator/AssistantJack.class b/Clue Simulator/AssistantJack.class new file mode 100644 index 00000000..1ae7ee13 Binary files /dev/null and b/Clue Simulator/AssistantJack.class differ diff --git a/Clue Simulator/AssistantJack.java b/Clue Simulator/AssistantJack.java new file mode 100644 index 00000000..71315e25 --- /dev/null +++ b/Clue Simulator/AssistantJack.java @@ -0,0 +1,138 @@ + +/** + * AssistantJack.java : will be asked various theories by Detective Jill, + * AssistantJack will then refute the answer or will accept the answer. If + * AssistantJack refutes the answer, you will be notified of 1 part of your + * theory that is incorrect (there may be more than one). + * + * @author Nery Chapeton-Lamas (material from Kevin Lewis) + * @version 1.0 + * + */ + +import java.util.ArrayList; +import java.util.Random; + +public class AssistantJack { + + private int timesAsked; + private Theory correctTheory; + + /** + * The default constructor but will not be called from outside. + */ + private AssistantJack() { + this.timesAsked = 0; + this.correctTheory = null; + } + + /** + * The full constructor, specifying which assistant to use (answer set 1, + * answer set 2, or random). Depending on assistant, a different correct + * Theory object is created. + * + * @param answerSet + * 1 is a fixed answer of 1,1,1 and 2 is a fixed answer of 6,10,6 + * any other integer will be randomly assigned + */ + public AssistantJack(int answerSet) { + this(); + + if (answerSet == 1) { + this.correctTheory = new Theory(1, 1, 1); + } else if (answerSet == 2) { + this.correctTheory = new Theory(6, 10, 6); + } else { + Random random = new Random(); + int weapon = random.nextInt(6) + 1; + int location = random.nextInt(10) + 1; + int person = random.nextInt(6) + 1; + this.correctTheory = new Theory(weapon, location, person); + } + } + + /** + * Creates an assistant Jack with a theory that was passed in. + * + * @param theory + * deep copied object stored as correct theory + */ + public AssistantJack(Theory theory) { + this(); + this.correctTheory = new Theory(theory); + } + + /** + * Will report to the user whether their theory is correct. It will return a + * number that needs to be interpreted (see return). Also keeps track of + * times asked by incrementing every time this method is called + * + * @param weapon + * the weapon used 1 - 6 + * @param location + * the location where it was done 1 - 10 + * @param person + * the person who did it 1 - 6 + * @return 0 if all three are correct, 1 if the weapon is incorrect, 2 if + * the location is incorrect and 3 if the person is incorrect. If + * multiple are incorrect it will randomly select one of the + * incorrect parts and return that. + */ + public int checkAnswer(int weapon, int location, int person) { + ArrayList wrongItems = new ArrayList(); + + this.timesAsked++; + + // check each part and add to array list appropriately + if (this.correctTheory.getWeapon() != weapon) { + wrongItems.add(1); + } + + if (this.correctTheory.getLocation() != location) { + wrongItems.add(2); + } + + if (this.correctTheory.getPerson() != person) { + wrongItems.add(3); + } + + // return based on incorrect items, if any, in array list + if (wrongItems.size() == 0) { + return 0; + } else if (wrongItems.size() == 1) { + return wrongItems.get(0); + } else { + Random random = new Random(); + int randomSelected = random.nextInt(wrongItems.size()); + return wrongItems.get(randomSelected); + } + } + + /** + * Pass through (convenient) method that converts the theory to numbers and + * sends it to the overloaded method. + * + * @param theory + * a theory of the murder, weapon and location + * + * @return 0 if all three are correct, 1 if the weapon is incorrect, 2 if + * the location is incorrect and 3 if the person is incorrect. If + * multiple are incorrect it will randomly select one of the + * incorrect parts and return that. + */ + public int checkAnswer(Theory theory) { + return this.checkAnswer(theory.getWeapon(), theory.getLocation(), theory.getPerson()); + } + + /** + * Accessor for times your AssistantJack has been asked to check a theory + * + * @return number of times AssistantJack has checkAnswer() been called + */ + public int getTimesAsked() { + return this.timesAsked; + } + + + +} \ No newline at end of file diff --git a/Clue Simulator/DetectiveJill.class b/Clue Simulator/DetectiveJill.class new file mode 100644 index 00000000..e4a343a9 Binary files /dev/null and b/Clue Simulator/DetectiveJill.class differ diff --git a/Clue Simulator/DetectiveJill.java b/Clue Simulator/DetectiveJill.java new file mode 100644 index 00000000..4b5cc608 --- /dev/null +++ b/Clue Simulator/DetectiveJill.java @@ -0,0 +1,62 @@ + +import java.util.Random; +import java.util.Scanner; + +public class DetectiveJill { + + public static void main() { + // DECLARATION + INITIALIZATION + int answerSet, solution, murder, weapon, location; + Theory answer; + AssistantJack jack; + Scanner keyboard = new Scanner(System.in); + Random random = new Random(); + + // INPUT + System.out.print("Which theory would like you like to test? (1, 2, 3[random]): "); + answerSet = keyboard.nextInt(); + keyboard.close(); + + // PROCESSING + jack = new AssistantJack(answerSet); +//START OUR WEAPON LOCATION AND MURDER AT 1 + int weapont = 1, locationt = 1, murdert = 1, total1 = 0; +//CHECK IF 1,1,1 IS CORRECT + solution = jack.checkAnswer(weapont, locationt, murdert); +//IF NOT CONTINUE WITH WHILE LOOP + while(solution != 0){ + //SWITCH BASED OF WHAT JACK SAYS IS WRONG + switch(solution){ + case 1: + //IF WEAPON IS WRONG + weapont++; + break; + case 2: + //IF LOCATION IS WRONG + locationt++; + break; + case 3: + //IF MURDER IS WRONG + murdert++; + break; + } + //CHECK SOLUTION AND IF WRONG, LOOP CONTINUES + solution = jack.checkAnswer(weapont, locationt, murdert); + } + + answer = new Theory(weapont, locationt, murdert); + + + // OUTPUT + System.out.println("Total Checks = " + jack.getTimesAsked() + ", Solution " + answer); + + if (jack.getTimesAsked() > 20) { + System.out.println("FAILED!! You're a horrible Detective...¯\\_(ツ)_/¯"); + } else { + System.out.println("WOW! You might as well be called Batman"); + + } + + } + +} \ No newline at end of file diff --git a/Clue Simulator/Main.class b/Clue Simulator/Main.class new file mode 100644 index 00000000..df9c189b Binary files /dev/null and b/Clue Simulator/Main.class differ diff --git a/Clue Simulator/Main.java b/Clue Simulator/Main.java new file mode 100644 index 00000000..787afb86 --- /dev/null +++ b/Clue Simulator/Main.java @@ -0,0 +1,17 @@ +// package edu.miracosta.cs113; +import java.util.Random; + +import java.util.Scanner; + +public class Main +{ + /** + * Driver method for random guessing approach + * + * @param args not used for driver + */ + public static void main(String[] args) { + DetectiveJill.main(); + + } +} diff --git a/Clue Simulator/RandomClue.class b/Clue Simulator/RandomClue.class new file mode 100644 index 00000000..b3229fe7 Binary files /dev/null and b/Clue Simulator/RandomClue.class differ diff --git a/Clue Simulator/RandomClue.java b/Clue Simulator/RandomClue.java new file mode 100644 index 00000000..cace3e97 --- /dev/null +++ b/Clue Simulator/RandomClue.java @@ -0,0 +1,99 @@ +/** + * RandomClue.java : Your job is to ask your AssistantJack and get the correct + * answer in <= 20 tries. RandomClue is ONE solution to the problem, + * where a set of random numbers is generated every attempt until all three + * random numbers match the solution from the AssistantJack object. + * + * This is a sample solution, a driver using random number implementation. + * You can use this file as a guide to create your own SEPARATE driver for + * your implementation that can solve it in <= 20 times consistently. + * + * @author Nery Chapeton-Lamas (material from Kevin Lewis) + * @version 1.0 + * + */ + +import java.util.Random; +import java.util.Scanner; + +public class RandomClue { + + /* + * ALGORITHM: + * + * PROMPT "Which theory to test? (1, 2, 3[random]): " + * READ answerSet + * INSTANTIATE jack = new AssistantJack(answerSet) + * DO + * weapon = random int between 1 and 6 + * location = random int between 1 and 10 + * murder = random int between 1 and 6 + * solution = jack.checkAnswer(weapon, location, murder) + * WHILE solution != 0 + * + * OUTPUT "Total checks = " + jack.getTimesAsked() + * IF jack.getTimesAsked() is greater than 20 THEN + * OUTPUT "FAILED" + * ELSE + * OUTPUT "PASSED" + * END IF + */ + + /** + * Driver method for random guessing approach + * + * @param args not used for driver + */ + public static void main() { + // DECLARATION + INITIALIZATION + int answerSet, solution, murder, weapon, location; + Theory answer; + AssistantJack jack; + Scanner keyboard = new Scanner(System.in); + Random random = new Random(); + + // INPUT + System.out.print("Which theory would like you like to test? (1, 2, 3[random]): "); + answerSet = keyboard.nextInt(); + keyboard.close(); + + // PROCESSING + jack = new AssistantJack(answerSet); +//START OUR WEAPON LOCATION AND MURDER AT 1 + int weapont = 1, locationt = 1, murdert = 1, total1 = 0; +//CHECK IF 1,1,1 IS CORRECT + solution = jack.checkAnswer(weapont, locationt, murdert); +//IF NOT CONTINUE WITH WHILE LOOP + while(solution != 0){ + //SWITCH BASED OF WHAT JACK SAYS IS WRONG + switch(solution){ + case 1: + weapont++; + break; + case 2: + locationt++; + break; + case 3: + murdert++; + break; + } + + solution = jack.checkAnswer(weapont, locationt, murdert); + } + + answer = new Theory(weapont, locationt, murdert); + + + // OUTPUT + System.out.println("Total Checks = " + jack.getTimesAsked() + ", Solution " + answer); + + if (jack.getTimesAsked() > 20) { + System.out.println("FAILED!! You're a horrible Detective...¯\\_(ツ)_/¯"); + } else { + System.out.println("WOW! You might as well be called Batman"); + + } + + } + +} \ No newline at end of file diff --git a/Clue Simulator/Theory.class b/Clue Simulator/Theory.class new file mode 100644 index 00000000..efd12928 Binary files /dev/null and b/Clue Simulator/Theory.class differ diff --git a/Clue Simulator/Theory.java b/Clue Simulator/Theory.java new file mode 100644 index 00000000..eded42b8 --- /dev/null +++ b/Clue Simulator/Theory.java @@ -0,0 +1,130 @@ +/** + * Theory.java : stores values for weapon, location, and person + * + * @author Nery Chapeton-Lamas (material from Kevin Lewis) + * @version 1.0 + * + */ + +public class Theory { + private int weapon; + private int location; + private int person; + + /** + * Full constructor, specifying each part of theory + * + * @param weapon + * integer representing weapon + * @param location + * integer representing location + * @param person + * integer representing person + * + * @see TheoryItem for values + */ + public Theory(int weapon, int location, int person) { + this.weapon = weapon; + this.location = location; + this.person = person; + } + + /** + * Copy constructor, deep copies Theory object + * + * @param other + * used to get all theory parts and deep copy + */ + public Theory(Theory other) { + this.weapon = other.weapon; + this.location = other.location; + this.person = other.person; + } + + /** + * Accessor for weapon value + * + * @return weapon integer value + */ + public int getWeapon() { + return weapon; + } + + /** + * Mutator for weapon value + * + * @param weapon + * integer value representing weapon + */ + public void setWeapon(int weapon) { + this.weapon = weapon; + } + + /** + * Accessor for location value + * + * @return location integer value + */ + public int getLocation() { + return location; + } + + /** + * Mutator for location value + * + * @param location + * integer value representing location + */ + public void setLocation(int location) { + this.location = location; + } + + /** + * Accessor for person value + * + * @return person integer value + */ + public int getPerson() { + return person; + } + + /** + * Mutator for person value + * + * @param person + * integer value representing person + */ + public void setPerson(int person) { + this.person = person; + } + + /** + * Equals method checks ALL instance variables are equal + * + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object obj) { + if (obj == null || this.getClass() != obj.getClass()) { + return false; + } + + Theory other = (Theory) obj; + + return (this.weapon != other.weapon || this.person != other.person || this.location != other.location); + + } + + /** + * toString representing objects values + * + * @return formatted string of weapon, person, and location + */ + @Override + public String toString() { + return String.format("Theory is: Weapon = %s (%d), Person = %s (%d), Location = %s (%d)", + TheoryItem.getWeaponName(this.weapon), this.weapon, TheoryItem.getPersonName(this.person), this.person, + TheoryItem.getLocationName(this.location), this.location); + } + +} \ No newline at end of file diff --git a/Clue Simulator/TheoryItem.class b/Clue Simulator/TheoryItem.class new file mode 100644 index 00000000..28f69c08 Binary files /dev/null and b/Clue Simulator/TheoryItem.class differ diff --git a/Clue Simulator/TheoryItem.java b/Clue Simulator/TheoryItem.java new file mode 100644 index 00000000..a1a72593 --- /dev/null +++ b/Clue Simulator/TheoryItem.java @@ -0,0 +1,283 @@ +/** + * TheoryItem.java : Convenient class helps to keep track of different kinds of + * murders, locations, and weapons. Constants can be used as limits (1 - + * constant value), static methods mostly used for error checking or translating + * between Strings and integers + * + * @author Nery Chapeton-Lamas (material from Kevin Lewis) + * @version 1.0 + * + */ + +public final class TheoryItem { + + public static final int TOTAL_MURDERS = 6; + public static final int TOTAL_LOCATIONS = 10; + public static final int TOTAL_WEAPONS = 6; + + /** + * Converts location integer to String: Kitchen (1), Ballroom (2), + * Conservatory (3), Billiard (4), Library (5), Study (6), Hall (7), Lounge + * (8), Dining (9), Cellar (10). + * + * @param location + * integer to convert to String + * @return String version of location number, null if invalid integer + */ + public static String getLocationName(int location) { + String locationName = null; + + switch (location) { + case 1: + locationName = "Kitchen"; + break; + case 2: + locationName = "Ballroom"; + break; + case 3: + locationName = "Conservatory"; + break; + case 4: + locationName = "Billiard"; + break; + case 5: + locationName = "Library"; + break; + case 6: + locationName = "Study"; + break; + case 7: + locationName = "Hall"; + break; + case 8: + locationName = "Lounge"; + break; + case 9: + locationName = "Dining"; + break; + case 10: + locationName = "Cellar"; + break; + } + return locationName; + } + + /** + * Converts location String to integer: Kitchen (1), Ballroom (2), + * Conservatory (3), Billiard (4), Library (5), Study (6), Hall (7), Lounge + * (8), Dining (9), Cellar (10). + * + * @param location + * String to convert to integer + * @return integer version of location String, 0 if invalid String + */ + public static int getLocationNumber(String location) { + int locationNumber = 0; + + switch (location.toLowerCase()) { + case "kitchen": + locationNumber = 1; + break; + case "ballroom": + locationNumber = 2; + break; + case "conservatory": + locationNumber = 3; + break; + case "billiard": + locationNumber = 4; + break; + case "library": + locationNumber = 5; + break; + case "study": + locationNumber = 6; + break; + case "hall": + locationNumber = 7; + break; + case "lounge": + locationNumber = 8; + break; + case "dining": + locationNumber = 9; + break; + case "cellar": + locationNumber = 10; + break; + } + return locationNumber; + } + + /** + * Checks validity of location number + * + * @param location + * integer representing location + * @return true if valid (1-10), false otherwise + */ + public static boolean validateLocationNumber(int location) { + return (location >= 1 && location <= 10); + } + + /** + * Converts person integer to String: Ms. Scarlet (1), Colonial Mustard (2), + * Mrs. White (3), Reverend Green (4), Mrs. Peacock (5), Professor Plum (6) + * + * @param person + * integer to convert to String + * @return String version of person number, null if invalid integer + */ + public static String getPersonName(int person) { + String personString = null; + + switch (person) { + case 1: + personString = "Ms. Scarlet"; + break; + case 2: + personString = "Colonial Mustard"; + break; + case 3: + personString = "Mrs. White"; + break; + case 4: + personString = "Reverend Green"; + break; + case 5: + personString = "Mrs. Peacock"; + break; + case 6: + personString = "Professor Plum"; + break; + } + return personString; + } + + /** + * Converts person String to integer: Ms. Scarlet (1), Colonial Mustard (2), + * Mrs. White (3), Reverend Green (4), Mrs. Peacock (5), Professor Plum (6) + * + * @param person + * String to convert to integer + * @return integer version of person String, 0 if invalid String + * + */ + public static int getPersonNumber(String person) { + int personNumber = 0; + + switch (person.toLowerCase()) { + case "ms. scarlet": + personNumber = 1; + break; + case "colonial mustard": + personNumber = 2; + break; + case "mrs. white": + personNumber = 3; + break; + case "reverend green": + personNumber = 4; + break; + case "mrs. peacock": + personNumber = 5; + break; + case "professor plum": + personNumber = 6; + break; + } + return personNumber; + } + + /** + * Checks validity of person number + * + * @param person + * integer representing person + * @return true if valid (1-6), false otherwise + */ + public static boolean validatePersonNumber(int person) { + return (person >= 1 && person <= 6); + } + + /** + * Converts weapon integer to String: rope (1), wrench (2), candlestick (3), + * revolver (4), knife (5), pipe (6) + * + * @param weapon + * integer to convert to String + * @return String version of weapon number, null if invalid integer + */ + public static String getWeaponName(int weapon) { + String weaponString = null; + + switch (weapon) { + case 1: + weaponString = "rope"; + break; + case 2: + weaponString = "wrench"; + break; + case 3: + weaponString = "candlestick"; + break; + case 4: + weaponString = "revolver"; + break; + case 5: + weaponString = "knife"; + break; + case 6: + weaponString = "pipe"; + break; + + } + return weaponString; + } + + /** + * Converts weapon String to integer: rope (1), wrench (2), candlestick (3), + * revolver (4), knife (5), pipe (6) + * + * @param weapon + * String to convert to integer + * @return integer version of weapon number, 0 if invalid String + * + */ + public static int getWeaponNumber(String weapon) { + int weaponNumber = 0; + + switch (weapon.toLowerCase()) { + case "rope": + weaponNumber = 1; + break; + case "wrench": + weaponNumber = 2; + break; + case "candlestick": + weaponNumber = 3; + break; + case "revolver": + weaponNumber = 4; + break; + case "knife": + weaponNumber = 5; + break; + case "pipe": + weaponNumber = 6; + break; + } + return weaponNumber; + } + + /** + * Checks validity of weapon number + * + * @param weapon + * integer representing weapon + * @return true if valid (1-6), false otherwise + */ + public static boolean validateWeaponNumber(int weapon) { + return (weapon >= 1 && weapon <= 6); + } +} diff --git a/Clue Simulator/pom.xml b/Clue Simulator/pom.xml new file mode 100644 index 00000000..56deae15 --- /dev/null +++ b/Clue Simulator/pom.xml @@ -0,0 +1,53 @@ + + 4.0.0 + mygroupid + myartifactid + 0.0-SNAPSHOT + + + com.googlecode.json-simple + json-simple + 1.1.1 + jar + + + org.hamcrest + hamcrest-core + 1.3 + jar + + + junit + junit + 4.12 + jar + + + + + + de.qaware.maven + go-offline-maven-plugin + 1.2.5 + + + + org.apache.maven.surefire + surefire-junit4 + 2.20.1 + + PLUGIN + + + com.querydsl + querydsl-apt + 4.2.1 + jpa + MAIN + + + + + + + \ No newline at end of file diff --git a/Clue Simulator/replit.nix b/Clue Simulator/replit.nix new file mode 100644 index 00000000..7f7e1291 --- /dev/null +++ b/Clue Simulator/replit.nix @@ -0,0 +1,8 @@ +{ pkgs }: { + deps = [ + pkgs.graalvm17-ce + pkgs.maven + pkgs.replitPackages.jdt-language-server + pkgs.replitPackages.java-debug + ]; +} \ No newline at end of file diff --git a/Clue Simulator/target/dependency/hamcrest-core-1.3.jar b/Clue Simulator/target/dependency/hamcrest-core-1.3.jar new file mode 100644 index 00000000..9d5fe16e Binary files /dev/null and b/Clue Simulator/target/dependency/hamcrest-core-1.3.jar differ diff --git a/Clue Simulator/target/dependency/json-simple-1.1.1.jar b/Clue Simulator/target/dependency/json-simple-1.1.1.jar new file mode 100644 index 00000000..dfd5856d Binary files /dev/null and b/Clue Simulator/target/dependency/json-simple-1.1.1.jar differ diff --git a/Clue Simulator/target/dependency/junit-4.12.jar b/Clue Simulator/target/dependency/junit-4.12.jar new file mode 100644 index 00000000..3a7fc266 Binary files /dev/null and b/Clue Simulator/target/dependency/junit-4.12.jar differ diff --git a/ColorCodeConverter.java b/ColorCodeConverter.java new file mode 100644 index 00000000..7881f082 --- /dev/null +++ b/ColorCodeConverter.java @@ -0,0 +1,53 @@ +import java.util.Scanner; + +public class ColorCodeConverter { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + System.out.println("Color Code Converter"); + System.out.println("1. RGB to HEX"); + System.out.println("2. HEX to RGB"); + System.out.print("Enter your choice (1 or 2): "); + + int choice = scanner.nextInt(); + scanner.nextLine(); // Consume the newline character + + if (choice == 1) { + System.out.print("Enter RGB color (e.g., 255, 0, 0): "); + String rgb = scanner.nextLine(); + String hex = rgbToHex(rgb); + System.out.println("HEX color: " + hex); + } else if (choice == 2) { + System.out.print("Enter HEX color (e.g., #FF0000): "); + String hex = scanner.nextLine(); + String rgb = hexToRgb(hex); + System.out.println("RGB color: " + rgb); + } else { + System.out.println("Invalid choice. Please select 1 or 2."); + } + } + + public static String rgbToHex(String rgb) { + String[] values = rgb.split(","); + if (values.length != 3) { + return "Invalid RGB format"; + } + int r = Integer.parseInt(values[0]); + int g = Integer.parseInt(values[1]); + int b = Integer.parseInt(values[2]); + + return String.format("#%02X%02X%02X", r, g, b); + } + + public static String hexToRgb(String hex) { + if (hex.startsWith("#")) { + hex = hex.substring(1); + } + + int intValue = Integer.parseInt(hex, 16); + int r = (intValue >> 16) & 0xFF; + int g = (intValue >> 8) & 0xFF; + int b = intValue & 0xFF; + + return r + ", " + g + ", " + b; + } +} diff --git a/ColorShapes.py b/ColorShapes.py new file mode 100644 index 00000000..c12ac920 --- /dev/null +++ b/ColorShapes.py @@ -0,0 +1,52 @@ +import turtle + +turtle.pensize(3) # Set pen thickness to 3 pixels +turtle.penup() # Pull the pen up +turtle.goto(-200, -50) +turtle.pendown() # Pull the pen down +turtle.begin_fill() # Begin to fill color in a shape +turtle.color("red") +turtle.circle(40, steps = 3) # Draw a triangle +turtle.end_fill() # Fill the shape + +turtle.penup() +turtle.goto(-100, -50) +turtle.pendown() +turtle.begin_fill() # Begin to fill color in a shape +turtle.color("blue") +turtle.circle(40, steps = 4) # Draw a square +turtle.end_fill() # Fill the shape + +turtle.penup() +turtle.goto(0, -50) +turtle.pendown() +turtle.begin_fill() # Begin to fill color in a shape +turtle.color("green") +turtle.circle(40, steps = 5) # Draw a pentagon +turtle.end_fill() # Fill the shape + +turtle.penup() +turtle.goto(100, -50) +turtle.pendown() +turtle.begin_fill() # Begin to fill color in a shape +turtle.color("yellow") +turtle.circle(40, steps = 6) # Draw a hexagon +turtle.end_fill() # Fill the shape + +turtle.penup() +turtle.goto(200, -50) +turtle.pendown() +turtle.begin_fill() # Begin to fill color in a shape +turtle.color("purple") +turtle.circle(40) # Draw a circle +turtle.end_fill() # Fill the shape + +turtle.color("green") +turtle.penup() +turtle.goto(-100, 50) +turtle.pendown() +turtle.write("Cool Colorful Shapes", + font = ("Times", 18, "bold")) +turtle.hideturtle() + +turtle.done() diff --git a/ComputeLoan.py b/ComputeLoan.py new file mode 100644 index 00000000..59bd4488 --- /dev/null +++ b/ComputeLoan.py @@ -0,0 +1,20 @@ +# Enter yearly interest rate +annualInterestRate = eval(input( + "Enter annual interest rate, e.g., 8.25: ")) +monthlyInterestRate = annualInterestRate / 1200 + +# Enter number of years +numberOfYears = eval(input( + "Enter number of years as an integer, e.g., 5: ")) + +# Enter loan amount +loanAmount = eval(input("Enter loan amount, e.g., 120000.95: ")) + +# Calculate payment +monthlyPayment = loanAmount * monthlyInterestRate / (1 + - 1 / (1 + monthlyInterestRate) ** (numberOfYears * 12)) +totalPayment = monthlyPayment * numberOfYears * 12 + +# Display results +print("The monthly payment is", int(monthlyPayment * 100) / 100) +print("The total payment is", int(totalPayment * 100) /100) diff --git a/Convert_JPEG_to_PNG/README.md b/Convert_JPEG_to_PNG/README.md new file mode 100644 index 00000000..76f0ae26 --- /dev/null +++ b/Convert_JPEG_to_PNG/README.md @@ -0,0 +1,21 @@ +# CONVERT_JPEG_to_PNG + +This project contains a simply python script to change file extension from .jpeg to .png + +## Requirements +Pillow module + +`pip install pillow` + +## Two methods: + +I accomplished this task in two ways +### Using Terminal +- Add the image in jpeg format with name as 'input' in this folder. +- Run converter_terminal.py script +- output image will be generated in this folder + +### Using GUI +Just run the converter_GUI.py script and pick any jpeg image from any location and then press 'Convert Jpeg to Png' + + diff --git a/Convert_JPEG_to_PNG/converter_GUI.py b/Convert_JPEG_to_PNG/converter_GUI.py new file mode 100644 index 00000000..a6d59613 --- /dev/null +++ b/Convert_JPEG_to_PNG/converter_GUI.py @@ -0,0 +1,40 @@ +import tkinter as tk +from tkinter import filedialog +from PIL import Image +root = tk.Tk() # Tkinter window initialized +root.title('Converter') # Title of the window +canvas1 = tk.Canvas(root, width=300, height=250, bg='orange', relief='raised') +canvas1.pack() +label1 = tk.Label(root, text='File Converter', bg='lightsteelblue2') # giving a title to the screen +label1.config(font=('helvetica', 20)) +canvas1.create_window(150, 60, window=label1) +im1 = None # variable to store path of image + + +def getJPG(): + '''Function to get image location and open it with pillow''' + global im1 + import_file_path = filedialog.askopenfilename() + im1 = Image.open(import_file_path) + + +font = ('helvetica', 12, 'bold') +bg = 'royalblue' +fg = 'white' +browseButton_JPG = tk.Button(text=" Import JPEG File ", command=getJPG, bg=bg, fg=fg, font=font) # Browse button +canvas1.create_window(150, 130, window=browseButton_JPG) + + +def convertToPNG(): + '''Function to change file extenstion to png and save it to User's prefered location ''' + global im1 + if im1 is None: + tk.messagebox.showerror("Error", "No File selected") + else: + export_file_path = filedialog.asksaveasfilename(defaultextension='.png') + im1.save(export_file_path) + + +saveAsButton_PNG = tk.Button(text='Convert JPEG to PNG', command=convertToPNG, bg=bg, fg=fg, font=font) # Convert button +canvas1.create_window(150, 180, window=saveAsButton_PNG) +root.mainloop() diff --git a/Convert_JPEG_to_PNG/converter_terminal.py b/Convert_JPEG_to_PNG/converter_terminal.py new file mode 100644 index 00000000..0168b7e1 --- /dev/null +++ b/Convert_JPEG_to_PNG/converter_terminal.py @@ -0,0 +1,3 @@ +from PIL import Image +im1 = Image.open('input.jpeg') # takes input image from present folder +im1.save('output.png') # output image is generated the folder diff --git a/Convert_JPEG_to_PNG/input.jpeg b/Convert_JPEG_to_PNG/input.jpeg new file mode 100644 index 00000000..a850441a Binary files /dev/null and b/Convert_JPEG_to_PNG/input.jpeg differ diff --git a/Convert_JPEG_to_PNG/output.png b/Convert_JPEG_to_PNG/output.png new file mode 100644 index 00000000..121bacc6 Binary files /dev/null and b/Convert_JPEG_to_PNG/output.png differ diff --git a/Correct Number Guess Game/Game.class b/Correct Number Guess Game/Game.class new file mode 100644 index 00000000..6e888ad7 Binary files /dev/null and b/Correct Number Guess Game/Game.class differ diff --git a/Correct Number Guess Game/Game.java b/Correct Number Guess Game/Game.java new file mode 100644 index 00000000..aea14d24 --- /dev/null +++ b/Correct Number Guess Game/Game.java @@ -0,0 +1,55 @@ +import java.util.Random; +import java.util.Scanner; +class Game1{ + private int noofGuesses=0; + public int inputno; + private int Rando; + public Game1(){ + Random rand = new Random(); + int upperbound=100; + Rando= rand.nextInt(upperbound); + } + public void TakeUserinput(){ + System.out.print("Guess a no:"); + Scanner a1 = new Scanner(System.in); + inputno= a1.nextInt(); + a1.close(); //scanner closed + } + public void SetnoofGuesses(int Guesses){ + this.noofGuesses=Guesses; + } + public int GetnoofGuesses(){ + return noofGuesses; + } + + boolean NoofCorrectGuesses(){ + noofGuesses++; + if (inputno==Rando){ + System.out.printf("You guesses the no right: "+ "%d",Rando); + System.out.println(""); + System.out.printf("You guesses in " + "%d" +" attempts",noofGuesses); + System.out.println(""); + return true; + } + else if(inputno>Rando){ + System.out.println("No is greater"); + } + else if(inputno + + + + + + + + + + Builds, tests, and runs the project Crypto. + + + diff --git a/Crypto-Image and Text Encryption Decryption/build/classes/.netbeans_automatic_build b/Crypto-Image and Text Encryption Decryption/build/classes/.netbeans_automatic_build new file mode 100644 index 00000000..e69de29b diff --git a/Crypto-Image and Text Encryption Decryption/build/classes/.netbeans_update_resources b/Crypto-Image and Text Encryption Decryption/build/classes/.netbeans_update_resources new file mode 100644 index 00000000..e69de29b diff --git a/Crypto-Image and Text Encryption Decryption/build/classes/Images/Home UI.jpg b/Crypto-Image and Text Encryption Decryption/build/classes/Images/Home UI.jpg new file mode 100644 index 00000000..feee2d49 Binary files /dev/null and b/Crypto-Image and Text Encryption Decryption/build/classes/Images/Home UI.jpg differ diff --git a/Crypto-Image and Text Encryption Decryption/build/classes/Images/icons8_back_64px.png b/Crypto-Image and Text Encryption Decryption/build/classes/Images/icons8_back_64px.png new file mode 100644 index 00000000..8208553b Binary files /dev/null and b/Crypto-Image and Text Encryption Decryption/build/classes/Images/icons8_back_64px.png differ diff --git a/Crypto-Image and Text Encryption Decryption/build/classes/Images/icons8_back_arrow_64px_1.png b/Crypto-Image and Text Encryption Decryption/build/classes/Images/icons8_back_arrow_64px_1.png new file mode 100644 index 00000000..13914376 Binary files /dev/null and b/Crypto-Image and Text Encryption Decryption/build/classes/Images/icons8_back_arrow_64px_1.png differ diff --git a/Crypto-Image and Text Encryption Decryption/build/classes/Images/icons8_help_40px.png b/Crypto-Image and Text Encryption Decryption/build/classes/Images/icons8_help_40px.png new file mode 100644 index 00000000..84a3c50e Binary files /dev/null and b/Crypto-Image and Text Encryption Decryption/build/classes/Images/icons8_help_40px.png differ diff --git a/Crypto-Image and Text Encryption Decryption/build/classes/Images/imgencryptions.jpg b/Crypto-Image and Text Encryption Decryption/build/classes/Images/imgencryptions.jpg new file mode 100644 index 00000000..34d7671d Binary files /dev/null and b/Crypto-Image and Text Encryption Decryption/build/classes/Images/imgencryptions.jpg differ diff --git a/Crypto-Image and Text Encryption Decryption/build/classes/Images/textecy.jpg b/Crypto-Image and Text Encryption Decryption/build/classes/Images/textecy.jpg new file mode 100644 index 00000000..738691ee Binary files /dev/null and b/Crypto-Image and Text Encryption Decryption/build/classes/Images/textecy.jpg differ diff --git a/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Crypto.class b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Crypto.class new file mode 100644 index 00000000..878224b3 Binary files /dev/null and b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Crypto.class differ diff --git a/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Home$1.class b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Home$1.class new file mode 100644 index 00000000..745e5210 Binary files /dev/null and b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Home$1.class differ diff --git a/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Home$2.class b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Home$2.class new file mode 100644 index 00000000..16d0a093 Binary files /dev/null and b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Home$2.class differ diff --git a/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Home$3.class b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Home$3.class new file mode 100644 index 00000000..f5614421 Binary files /dev/null and b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Home$3.class differ diff --git a/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Home$4.class b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Home$4.class new file mode 100644 index 00000000..8d73f4e9 Binary files /dev/null and b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Home$4.class differ diff --git a/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Home.class b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Home.class new file mode 100644 index 00000000..3647489d Binary files /dev/null and b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Home.class differ diff --git a/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Home.form b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Home.form new file mode 100644 index 00000000..60ed9741 --- /dev/null +++ b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Home.form @@ -0,0 +1,93 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Textencryption$1.class b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Textencryption$1.class new file mode 100644 index 00000000..9535f68d Binary files /dev/null and b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Textencryption$1.class differ diff --git a/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Textencryption$2.class b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Textencryption$2.class new file mode 100644 index 00000000..e5943c09 Binary files /dev/null and b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Textencryption$2.class differ diff --git a/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Textencryption$3.class b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Textencryption$3.class new file mode 100644 index 00000000..59b83717 Binary files /dev/null and b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Textencryption$3.class differ diff --git a/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Textencryption$4.class b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Textencryption$4.class new file mode 100644 index 00000000..2569477c Binary files /dev/null and b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Textencryption$4.class differ diff --git a/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Textencryption$5.class b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Textencryption$5.class new file mode 100644 index 00000000..3ad50c1e Binary files /dev/null and b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Textencryption$5.class differ diff --git a/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Textencryption$6.class b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Textencryption$6.class new file mode 100644 index 00000000..7d028495 Binary files /dev/null and b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Textencryption$6.class differ diff --git a/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Textencryption$7.class b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Textencryption$7.class new file mode 100644 index 00000000..39534a4c Binary files /dev/null and b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Textencryption$7.class differ diff --git a/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Textencryption.class b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Textencryption.class new file mode 100644 index 00000000..aaaa7b48 Binary files /dev/null and b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Textencryption.class differ diff --git a/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Textencryption.form b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Textencryption.form new file mode 100644 index 00000000..28d8b236 --- /dev/null +++ b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/Textencryption.form @@ -0,0 +1,156 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Crypto-Image and Text Encryption Decryption/build/classes/crypto/f.class b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/f.class new file mode 100644 index 00000000..c34129f7 Binary files /dev/null and b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/f.class differ diff --git a/Crypto-Image and Text Encryption Decryption/build/classes/crypto/icon.png b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/icon.png new file mode 100644 index 00000000..527e7328 Binary files /dev/null and b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/icon.png differ diff --git a/Crypto-Image and Text Encryption Decryption/build/classes/crypto/imagencryption$1.class b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/imagencryption$1.class new file mode 100644 index 00000000..7190d4bc Binary files /dev/null and b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/imagencryption$1.class differ diff --git a/Crypto-Image and Text Encryption Decryption/build/classes/crypto/imagencryption$2.class b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/imagencryption$2.class new file mode 100644 index 00000000..b33eeb96 Binary files /dev/null and b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/imagencryption$2.class differ diff --git a/Crypto-Image and Text Encryption Decryption/build/classes/crypto/imagencryption$3.class b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/imagencryption$3.class new file mode 100644 index 00000000..37f43745 Binary files /dev/null and b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/imagencryption$3.class differ diff --git a/Crypto-Image and Text Encryption Decryption/build/classes/crypto/imagencryption$4.class b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/imagencryption$4.class new file mode 100644 index 00000000..a24a081c Binary files /dev/null and b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/imagencryption$4.class differ diff --git a/Crypto-Image and Text Encryption Decryption/build/classes/crypto/imagencryption$5.class b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/imagencryption$5.class new file mode 100644 index 00000000..91f01b48 Binary files /dev/null and b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/imagencryption$5.class differ diff --git a/Crypto-Image and Text Encryption Decryption/build/classes/crypto/imagencryption.class b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/imagencryption.class new file mode 100644 index 00000000..69161ec6 Binary files /dev/null and b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/imagencryption.class differ diff --git a/Crypto-Image and Text Encryption Decryption/build/classes/crypto/imagencryption.form b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/imagencryption.form new file mode 100644 index 00000000..4878dc94 --- /dev/null +++ b/Crypto-Image and Text Encryption Decryption/build/classes/crypto/imagencryption.form @@ -0,0 +1,134 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Crypto-Image and Text Encryption Decryption/manifest.mf b/Crypto-Image and Text Encryption Decryption/manifest.mf new file mode 100644 index 00000000..328e8e5b --- /dev/null +++ b/Crypto-Image and Text Encryption Decryption/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +X-COMMENT: Main-Class will be added automatically by build + diff --git a/Crypto-Image and Text Encryption Decryption/nbproject/build-impl.xml b/Crypto-Image and Text Encryption Decryption/nbproject/build-impl.xml new file mode 100644 index 00000000..3b21c9b5 --- /dev/null +++ b/Crypto-Image and Text Encryption Decryption/nbproject/build-impl.xml @@ -0,0 +1,1771 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + Must select one file in the IDE or set profile.class + This target only works when run from inside the NetBeans IDE. + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + Must select some files in the IDE or set test.includes + + + + + Must select one file in the IDE or set run.class + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Crypto-Image and Text Encryption Decryption/nbproject/genfiles.properties b/Crypto-Image and Text Encryption Decryption/nbproject/genfiles.properties new file mode 100644 index 00000000..9af22bf8 --- /dev/null +++ b/Crypto-Image and Text Encryption Decryption/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=7f90a431 +build.xml.script.CRC32=a2c5abf7 +build.xml.stylesheet.CRC32=f85dc8f2@1.100.0.48 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=7f90a431 +nbproject/build-impl.xml.script.CRC32=31a761c4 +nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.100.0.48 diff --git a/Crypto-Image and Text Encryption Decryption/nbproject/private/private.properties b/Crypto-Image and Text Encryption Decryption/nbproject/private/private.properties new file mode 100644 index 00000000..38f610ec --- /dev/null +++ b/Crypto-Image and Text Encryption Decryption/nbproject/private/private.properties @@ -0,0 +1,2 @@ +compile.on.save=true +user.properties.file=C:\\Users\\hakay\\AppData\\Roaming\\NetBeans\\8.0.2\\build.properties diff --git a/Crypto-Image and Text Encryption Decryption/nbproject/private/private.xml b/Crypto-Image and Text Encryption Decryption/nbproject/private/private.xml new file mode 100644 index 00000000..6807a2ba --- /dev/null +++ b/Crypto-Image and Text Encryption Decryption/nbproject/private/private.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Crypto-Image and Text Encryption Decryption/nbproject/project.properties b/Crypto-Image and Text Encryption Decryption/nbproject/project.properties new file mode 100644 index 00000000..9252cc9d --- /dev/null +++ b/Crypto-Image and Text Encryption Decryption/nbproject/project.properties @@ -0,0 +1,87 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=false +annotation.processing.processor.options= +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.modulepath=\ + ${run.modulepath} +debug.test.classpath=\ + ${run.test.classpath} +debug.test.modulepath=\ + ${run.test.modulepath} +# Files in build.classes.dir which should be excluded from distribution jar +dist.archive.excludes= +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/Crypto.jar +dist.javadoc.dir=${dist.dir}/javadoc +excludes= +includes=** +jar.compress=false +javac.classpath=\ + ${libs.absolutelayout.classpath} +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.external.vm=true +javac.modulepath= +javac.processormodulepath= +javac.processorpath=\ + ${javac.classpath} +javac.source=1.8 +javac.target=1.8 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.modulepath=\ + ${javac.modulepath} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +main.class=crypto.Crypto +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=false +platform.active=default_platform +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project. +# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. +# To set system properties for unit tests define test-sys-prop.name=value: +run.jvmargs= +run.modulepath=\ + ${javac.modulepath} +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +run.test.modulepath=\ + ${javac.test.modulepath} +source.encoding=UTF-8 +src.dir=src +test.src.dir=test diff --git a/Crypto-Image and Text Encryption Decryption/nbproject/project.xml b/Crypto-Image and Text Encryption Decryption/nbproject/project.xml new file mode 100644 index 00000000..7af08779 --- /dev/null +++ b/Crypto-Image and Text Encryption Decryption/nbproject/project.xml @@ -0,0 +1,15 @@ + + + org.netbeans.modules.java.j2seproject + + + Crypto + + + + + + + + + diff --git a/Crypto-Image and Text Encryption Decryption/src/Images/Home UI.jpg b/Crypto-Image and Text Encryption Decryption/src/Images/Home UI.jpg new file mode 100644 index 00000000..feee2d49 Binary files /dev/null and b/Crypto-Image and Text Encryption Decryption/src/Images/Home UI.jpg differ diff --git a/Crypto-Image and Text Encryption Decryption/src/Images/icons8_back_64px.png b/Crypto-Image and Text Encryption Decryption/src/Images/icons8_back_64px.png new file mode 100644 index 00000000..8208553b Binary files /dev/null and b/Crypto-Image and Text Encryption Decryption/src/Images/icons8_back_64px.png differ diff --git a/Crypto-Image and Text Encryption Decryption/src/Images/icons8_back_arrow_64px_1.png b/Crypto-Image and Text Encryption Decryption/src/Images/icons8_back_arrow_64px_1.png new file mode 100644 index 00000000..13914376 Binary files /dev/null and b/Crypto-Image and Text Encryption Decryption/src/Images/icons8_back_arrow_64px_1.png differ diff --git a/Crypto-Image and Text Encryption Decryption/src/Images/icons8_help_40px.png b/Crypto-Image and Text Encryption Decryption/src/Images/icons8_help_40px.png new file mode 100644 index 00000000..84a3c50e Binary files /dev/null and b/Crypto-Image and Text Encryption Decryption/src/Images/icons8_help_40px.png differ diff --git a/Crypto-Image and Text Encryption Decryption/src/Images/imgencryptions.jpg b/Crypto-Image and Text Encryption Decryption/src/Images/imgencryptions.jpg new file mode 100644 index 00000000..34d7671d Binary files /dev/null and b/Crypto-Image and Text Encryption Decryption/src/Images/imgencryptions.jpg differ diff --git a/Crypto-Image and Text Encryption Decryption/src/Images/textecy.jpg b/Crypto-Image and Text Encryption Decryption/src/Images/textecy.jpg new file mode 100644 index 00000000..738691ee Binary files /dev/null and b/Crypto-Image and Text Encryption Decryption/src/Images/textecy.jpg differ diff --git a/Crypto-Image and Text Encryption Decryption/src/crypto/Crypto.java b/Crypto-Image and Text Encryption Decryption/src/crypto/Crypto.java new file mode 100644 index 00000000..e3905f51 --- /dev/null +++ b/Crypto-Image and Text Encryption Decryption/src/crypto/Crypto.java @@ -0,0 +1,21 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package crypto; + +/** + * + * @author SP + */ +public class Crypto { + + /** + * @param args the command line arguments + */ + public static void main(String[] args) { + // TODO code application logic here + } + +} diff --git a/Crypto-Image and Text Encryption Decryption/src/crypto/Home.form b/Crypto-Image and Text Encryption Decryption/src/crypto/Home.form new file mode 100644 index 00000000..60ed9741 --- /dev/null +++ b/Crypto-Image and Text Encryption Decryption/src/crypto/Home.form @@ -0,0 +1,93 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Crypto-Image and Text Encryption Decryption/src/crypto/Home.java b/Crypto-Image and Text Encryption Decryption/src/crypto/Home.java new file mode 100644 index 00000000..38291ddf --- /dev/null +++ b/Crypto-Image and Text Encryption Decryption/src/crypto/Home.java @@ -0,0 +1,138 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package crypto; + +import java.awt.Frame; +import java.awt.Image; +import java.awt.Toolkit; +import javax.swing.JOptionPane; + +/** + * + * @author SP + */ +public class Home extends javax.swing.JFrame { + + /** + * Creates new form Home + */ + public Home() { + initComponents(); + Frame f=new Frame(); + setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("icon.png"))); + this.setLocationRelativeTo(null); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jButton1 = new javax.swing.JButton(); + jButton3 = new javax.swing.JButton(); + jButton2 = new javax.swing.JButton(); + jLabel1 = new javax.swing.JLabel(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setTitle("Crypto"); + setResizable(false); + getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); + + jButton1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N + jButton1.setText("Text Encryption & Decryption"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + getContentPane().add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 340, 240, 60)); + + jButton3.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N + jButton3.setText("Image Encryption & Decryption"); + jButton3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton3ActionPerformed(evt); + } + }); + getContentPane().add(jButton3, new org.netbeans.lib.awtextra.AbsoluteConstraints(360, 340, 260, 60)); + + jButton2.setBackground(new java.awt.Color(5, 116, 232)); + jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/icons8_help_40px.png"))); // NOI18N + jButton2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton2ActionPerformed(evt); + } + }); + getContentPane().add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(590, 0, -1, -1)); + + jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/Home UI.jpg"))); // NOI18N + getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1)); + + pack(); + }// //GEN-END:initComponents + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + + new Textencryption().setVisible(true); + + }//GEN-LAST:event_jButton1ActionPerformed + + private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed + new imagencryption().setVisible(true); + }//GEN-LAST:event_jButton3ActionPerformed + + private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed + JOptionPane.showMessageDialog(null, "This project, Crypto (Text Encryption and Decryption Software) is developed using NetBeans.\n This project is written in java language. \n The aim of this system was to create a Graphical User Interface program which can \n help user to Encrypt or Decrypt message or Image."); + }//GEN-LAST:event_jButton2ActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new Home().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton2; + private javax.swing.JButton jButton3; + private javax.swing.JLabel jLabel1; + // End of variables declaration//GEN-END:variables + + +} diff --git a/Crypto-Image and Text Encryption Decryption/src/crypto/Textencryption.form b/Crypto-Image and Text Encryption Decryption/src/crypto/Textencryption.form new file mode 100644 index 00000000..28d8b236 --- /dev/null +++ b/Crypto-Image and Text Encryption Decryption/src/crypto/Textencryption.form @@ -0,0 +1,156 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Crypto-Image and Text Encryption Decryption/src/crypto/Textencryption.java b/Crypto-Image and Text Encryption Decryption/src/crypto/Textencryption.java new file mode 100644 index 00000000..364e68da --- /dev/null +++ b/Crypto-Image and Text Encryption Decryption/src/crypto/Textencryption.java @@ -0,0 +1,234 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package crypto; + +import java.awt.Component; +import java.awt.Toolkit; +import java.awt.datatransfer.Clipboard; +import java.awt.datatransfer.StringSelection; +import javax.swing.JOptionPane; + +/** + * + * @author SP + */ +public class Textencryption extends javax.swing.JFrame { + + private Component JFrame; + + /** + * Creates new form Textencryption + */ + public Textencryption() { + initComponents(); + this.setLocationRelativeTo(null); + setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("icon.png"))); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + inp = new javax.swing.JTextArea(); + jScrollPane1 = new javax.swing.JScrollPane(); + jButton1 = new javax.swing.JButton(); + jButton2 = new javax.swing.JButton(); + jButton3 = new javax.swing.JButton(); + jButton4 = new javax.swing.JButton(); + jButton5 = new javax.swing.JButton(); + jButton6 = new javax.swing.JButton(); + jLabel1 = new javax.swing.JLabel(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setTitle("Crypto"); + setResizable(false); + getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); + + inp.setColumns(20); + inp.setRows(5); + getContentPane().add(inp, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 100, 500, 230)); + getContentPane().add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(270, 220, -1, -1)); + + jButton1.setText("Encrypt"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + getContentPane().add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 360, 110, 40)); + + jButton2.setText("Decrypt"); + jButton2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton2ActionPerformed(evt); + } + }); + getContentPane().add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(170, 360, 110, 40)); + + jButton3.setText("Clear"); + jButton3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton3ActionPerformed(evt); + } + }); + getContentPane().add(jButton3, new org.netbeans.lib.awtextra.AbsoluteConstraints(320, 360, 110, 40)); + + jButton4.setText("Copy to Clipboard"); + jButton4.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton4ActionPerformed(evt); + } + }); + getContentPane().add(jButton4, new org.netbeans.lib.awtextra.AbsoluteConstraints(460, 360, 190, 40)); + + jButton5.setBackground(new java.awt.Color(5, 116, 232)); + jButton5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/icons8_back_arrow_64px_1.png"))); // NOI18N + jButton5.setOpaque(false); + jButton5.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton5ActionPerformed(evt); + } + }); + getContentPane().add(jButton5, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 70, 70)); + + jButton6.setBackground(new java.awt.Color(5, 116, 232)); + jButton6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/icons8_help_40px.png"))); // NOI18N + jButton6.setOpaque(false); + jButton6.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton6ActionPerformed(evt); + } + }); + getContentPane().add(jButton6, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 70, 70, 60)); + + jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/textecy.jpg"))); // NOI18N + getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1)); + + pack(); + }// //GEN-END:initComponents + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + String s=inp.getText(); + + inp.setText(encryptkey(s)); + Component frame = null; + // TODO add your handling code here: + }//GEN-LAST:event_jButton1ActionPerformed + + private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed + String s=inp.getText(); + + inp.setText(decryptkey(s)); + + Component frame = null; + }//GEN-LAST:event_jButton2ActionPerformed + + private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed + inp.setText(" "); + }//GEN-LAST:event_jButton3ActionPerformed + + private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed + StringSelection stringSelection = new StringSelection (inp.getText()); + Clipboard clpbrd = Toolkit.getDefaultToolkit ().getSystemClipboard (); + clpbrd.setContents (stringSelection, null); + JOptionPane.showMessageDialog(JFrame,"Your Message is copied"); + }//GEN-LAST:event_jButton4ActionPerformed + + private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed + this.toBack(); + + +// TODO add your handling code here: + }//GEN-LAST:event_jButton5ActionPerformed + + private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed + JOptionPane.showMessageDialog(null, "This project, Crypto (Text Encryption and Decryption Software) is developed using NetBeans.\n This project is written in java language. \n The aim of this system was to create a Graphical User Interface program which can \n help user to Encrypt or Decrypt message or Image."); + }//GEN-LAST:event_jButton6ActionPerformed + int count=0; + public static String encryptkey(String s1) { +StringBuffer sb=new StringBuffer(); +for(int i=0;i + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(Textencryption.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(Textencryption.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(Textencryption.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(Textencryption.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new Textencryption().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JTextArea inp; + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton2; + private javax.swing.JButton jButton3; + private javax.swing.JButton jButton4; + private javax.swing.JButton jButton5; + private javax.swing.JButton jButton6; + private javax.swing.JLabel jLabel1; + private javax.swing.JScrollPane jScrollPane1; + // End of variables declaration//GEN-END:variables +} diff --git a/Crypto-Image and Text Encryption Decryption/src/crypto/f.java b/Crypto-Image and Text Encryption Decryption/src/crypto/f.java new file mode 100644 index 00000000..8e7eb0f0 --- /dev/null +++ b/Crypto-Image and Text Encryption Decryption/src/crypto/f.java @@ -0,0 +1,14 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package crypto; + +/** + * + * @author SP + */ +class f { + +} diff --git a/Crypto-Image and Text Encryption Decryption/src/crypto/icon.png b/Crypto-Image and Text Encryption Decryption/src/crypto/icon.png new file mode 100644 index 00000000..527e7328 Binary files /dev/null and b/Crypto-Image and Text Encryption Decryption/src/crypto/icon.png differ diff --git a/Crypto-Image and Text Encryption Decryption/src/crypto/imagencryption.form b/Crypto-Image and Text Encryption Decryption/src/crypto/imagencryption.form new file mode 100644 index 00000000..4878dc94 --- /dev/null +++ b/Crypto-Image and Text Encryption Decryption/src/crypto/imagencryption.form @@ -0,0 +1,134 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Crypto-Image and Text Encryption Decryption/src/crypto/imagencryption.java b/Crypto-Image and Text Encryption Decryption/src/crypto/imagencryption.java new file mode 100644 index 00000000..db6b54fe --- /dev/null +++ b/Crypto-Image and Text Encryption Decryption/src/crypto/imagencryption.java @@ -0,0 +1,203 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package crypto; + +import java.awt.Toolkit; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import javax.swing.JFileChooser; +import javax.swing.JOptionPane; + +/** + * + * @author SP + */ + + +public class imagencryption extends javax.swing.JFrame { + + /** + * Creates new form imagencryption + */ + public imagencryption() { + initComponents(); + this.setLocationRelativeTo(null); + setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("icon.png"))); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + inp = new javax.swing.JTextField(); + jButton1 = new javax.swing.JButton(); + jButton2 = new javax.swing.JButton(); + jLabel2 = new javax.swing.JLabel(); + jButton5 = new javax.swing.JButton(); + jButton3 = new javax.swing.JButton(); + jLabel1 = new javax.swing.JLabel(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setTitle("Crypto"); + setResizable(false); + getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); + + inp.setFont(new java.awt.Font("Arial", 0, 36)); // NOI18N + getContentPane().add(inp, new org.netbeans.lib.awtextra.AbsoluteConstraints(400, 270, 180, 50)); + + jButton1.setText("Encrypt"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + getContentPane().add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(150, 370, 160, 50)); + + jButton2.setText("Decrypt"); + jButton2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton2ActionPerformed(evt); + } + }); + getContentPane().add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(360, 370, 160, 50)); + + jLabel2.setFont(new java.awt.Font("Arial", 0, 36)); // NOI18N + jLabel2.setForeground(new java.awt.Color(255, 255, 255)); + jLabel2.setText("Enter Key"); + getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 260, 160, 60)); + + jButton5.setBackground(new java.awt.Color(5, 116, 232)); + jButton5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/icons8_back_arrow_64px_1.png"))); // NOI18N + jButton5.setOpaque(false); + jButton5.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton5ActionPerformed(evt); + } + }); + getContentPane().add(jButton5, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 70, 70)); + + jButton3.setBackground(new java.awt.Color(5, 116, 232)); + jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/icons8_help_40px.png"))); // NOI18N + jButton3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton3ActionPerformed(evt); + } + }); + getContentPane().add(jButton3, new org.netbeans.lib.awtextra.AbsoluteConstraints(590, 0, -1, -1)); + + jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/imgencryptions.jpg"))); // NOI18N + getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1)); + + pack(); + }// //GEN-END:initComponents + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + String text=inp.getText(); + int temp=Integer.parseInt(text); + operate(temp); + }//GEN-LAST:event_jButton1ActionPerformed + + private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed + String text=inp.getText(); + int temp=Integer.parseInt(text); + operate(temp); // TODO add your handling code here: + }//GEN-LAST:event_jButton2ActionPerformed + + private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed + this.toBack(); + + // TODO add your handling code here: + }//GEN-LAST:event_jButton5ActionPerformed + + private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed + JOptionPane.showMessageDialog(null, "This project, Crypto (Text Encryption and Decryption Software) is developed using NetBeans.\n This project is written in java language. \n The aim of this system was to create a Graphical User Interface program which can \n help user to Encrypt or Decrypt message or Image."); + }//GEN-LAST:event_jButton3ActionPerformed + + /** + * @param args the command line arguments + */ + + public static void operate(int key) + { + + JFileChooser fileChooser=new JFileChooser(); + fileChooser.showOpenDialog(null); + File file=fileChooser.getSelectedFile(); + //file FileInputStream + try + { + + FileInputStream fis=new FileInputStream(file); + + byte []data=new byte[fis.available()]; + fis.read(data); + int i=0; + for(byte b:data) + { + System.out.println(b); + data[i]=(byte)(b^key); + i++; + } + + FileOutputStream fos=new FileOutputStream(file); + fos.write(data); + fos.close(); + fis.close(); + JOptionPane.showMessageDialog(null, "Done"); + + }catch(Exception e) + { + e.printStackTrace(); + } + } + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(imagencryption.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(imagencryption.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(imagencryption.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(imagencryption.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new imagencryption().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JTextField inp; + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton2; + private javax.swing.JButton jButton3; + private javax.swing.JButton jButton5; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + // End of variables declaration//GEN-END:variables +} diff --git a/Currency Converter using Java/Converter.java b/Currency Converter using Java/Converter.java new file mode 100644 index 00000000..13c96e5e --- /dev/null +++ b/Currency Converter using Java/Converter.java @@ -0,0 +1,223 @@ +package currencyConverter; + +import java.util.ArrayList; + +import java.util.HashMap; + +public class Currency { + +private String name; + +private String shortName; + +private HashMap exchangeValues = new HashMap(); + +// “Currency” Constructor + +public Currency(String nameValue, String shortNameValue) { + +this.name = nameValue; + +this.shortName = shortNameValue; + +} + +// Getter for name + +public String getName() { + +return this.name; + +} + +// Setter for name + +public void setName(String name) { + +this.name = name; + +} + +// Getter for shortName + +public String getShortName() { + +return this.shortName; + +} + +// Setter for shortName + +public void setShortName(String shortName) { + +this.shortName = shortName; + +} + +// Getter for exchangeValues + +public HashMap getExchangeValues() { + +return this.exchangeValues; + +} + +// Setter for exchangeValues + +public void setExchangeValues(String key, Double value) { + +this.exchangeValues.put(key, value); + +} + +// Set default values for a currency + +public void defaultValues() { + +String currency = this.name; + +switch (currency) { + +case “US Dollar”: + +this.exchangeValues.put(“USD”, 1.00); + +this.exchangeValues.put(“EUR”, 0.93); + +this.exchangeValues.put(“GBP”, 0.66); + +this.exchangeValues.put(“CHF”, 1.01); + +this.exchangeValues.put(“CNY”, 6.36); + +this.exchangeValues.put(“JPY”, 123.54); + +break; + +case “Euro”: + +this.exchangeValues.put(“USD”, 1.073); + +this.exchangeValues.put(“EUR”, 1.00); + +this.exchangeValues.put(“GBP”, 0.71); + +this.exchangeValues.put(“CHF”, 1.08); + +this.exchangeValues.put(“CNY”, 6.83); + +this.exchangeValues.put(“JPY”, 132.57); + +break; + +case “British Pound”: + +this.exchangeValues.put(“USD”, 1.51); + +this.exchangeValues.put(“EUR”, 1.41); + +this.exchangeValues.put(“GBP”, 1.00); + +this.exchangeValues.put(“CHF”, 1.52); + +this.exchangeValues.put(“CNY”, 9.60); + +this.exchangeValues.put(“JPY”, 186.41); + +break; + +case “Swiss Franc”: + +this.exchangeValues.put(“USD”, 0.99); + +this.exchangeValues.put(“EUR”, 0.93); + +this.exchangeValues.put(“GBP”, 0.66); + +this.exchangeValues.put(“CHF”, 1.00); + +this.exchangeValues.put(“CNY”, 6.33); + +this.exchangeValues.put(“JPY”, 122.84); + +break; + +case “Chinese Yuan Renminbi”: + +this.exchangeValues.put(“USD”, 0.16); + +this.exchangeValues.put(“EUR”, 0.15); + +this.exchangeValues.put(“GBP”, 0.11); + +this.exchangeValues.put(“CHF”, 0.16); + +this.exchangeValues.put(“CNY”, 1.00); + +this.exchangeValues.put(“JPY”, 19.41); + +break; + +case “Japanese Yen”: + +this.exchangeValues.put(“USD”, 0.008); + +this.exchangeValues.put(“EUR”, 0.007); + +this.exchangeValues.put(“GBP”, 0.005); + +this.exchangeValues.put(“CHF”, 0.008); + +this.exchangeValues.put(“CNY”, 0.051); + +this.exchangeValues.put(“JPY”, 1.000); + +break; + +} + +} + +// Initialize currencies + +public static ArrayList init() { + +ArrayList currencies = new ArrayList(); + +currencies.add( new Currency(“US Dollar”, “USD”) ); + +currencies.add( new Currency(“Euro”, “EUR”) ); + +currencies.add( new Currency(“British Pound”, “GBP”) ); + +currencies.add( new Currency(“Swiss Franc”, “CHF”) ); + +currencies.add( new Currency(“Chinese Yuan Renminbi”, “CNY”) ); + +currencies.add( new Currency(“Japanese Yen”, “JPY”) ); + +for (Integer i =0; i < currencies.size(); i++) { + +currencies.get(i).defaultValues(); + +} + +return currencies; + +} + +// Convert a currency to another + +public static Double convert(Double amount, Double exchangeValue) { + +Double price; + +price = amount * exchangeValue; + +price = Math.round(price * 100d) / 100d; + +return price; + +} + +} diff --git a/Currency Converter.java b/Currency Converter.java new file mode 100644 index 00000000..1a43e2fa --- /dev/null +++ b/Currency Converter.java @@ -0,0 +1,132 @@ +// Java program to convert from +// rupee to the dollar and vice-versa +// using Java Swing + +import javax.swing.*; +import java.awt.*; +import java.awt.event.*; +public class GFG { + + // Function to convert from rupee + // to the dollar and vice-versa + // using Java Swing + public static void converter() + { + + // Creating a new frame using JFrame + JFrame f = new JFrame("CONVERTER"); + + // Creating two labels + JLabel l1, l2; + + // Creating two text fields. + // One for rupee and one for + // the dollar + JTextField t1, t2; + + // Creating three buttons + JButton b1, b2, b3; + + // Naming the labels and setting + // the bounds for the labels + l1 = new JLabel("Rupees:"); + l1.setBounds(20, 40, 60, 30); + l2 = new JLabel("Dollars:"); + l2.setBounds(170, 40, 60, 30); + + // Initializing the text fields with + // 0 by default and setting the + // bounds for the text fields + t1 = new JTextField("0"); + t1.setBounds(80, 40, 50, 30); + t2 = new JTextField("0"); + t2.setBounds(240, 40, 50, 30); + + // Creating a button for INR, + // one button for the dollar + // and one button to close + // and setting the bounds + b1 = new JButton("INR"); + b1.setBounds(50, 80, 60, 15); + b2 = new JButton("Dollar"); + b2.setBounds(190, 80, 60, 15); + b3 = new JButton("close"); + b3.setBounds(150, 150, 60, 30); + + // Adding action listener + b1.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) + { + // Converting to double + double d + = Double.parseDouble(t1.getText()); + + // Converting rupees to dollars + double d1 = (d / 65.25); + + // Getting the string value of the + // calculated value + String str1 = String.valueOf(d1); + + // Placing it in the text box + t2.setText(str1); + } + }); + + // Adding action listener + b2.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) + { + // Converting to double + double d2 + = Double.parseDouble(t2.getText()); + + // converting Dollars to rupees + double d3 = (d2 * 65.25); + + // Getting the string value of the + // calculated value + String str2 = String.valueOf(d3); + + // Placing it in the text box + t1.setText(str2); + } + }); + + // Action listener to close the form + b3.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) + { + f.dispose(); + } + }); + + // Default method for closing the frame + f.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) + { + System.exit(0); + } + }); + + // Adding the created objects + // to the form + f.add(l1); + f.add(t1); + f.add(l2); + f.add(t2); + f.add(b1); + f.add(b2); + f.add(b3); + + f.setLayout(null); + f.setSize(400, 300); + f.setVisible(true); + } + + // Driver code + public static void main(String args[]) + { + converter(); + } +} diff --git a/Currency Converter/CurrencyConverter.java b/Currency Converter/CurrencyConverter.java new file mode 100644 index 00000000..17699db5 --- /dev/null +++ b/Currency Converter/CurrencyConverter.java @@ -0,0 +1,226 @@ +package com.exchange; + +import java.io.*; + +import java.net.*; + +import java.util.*; + +import javax.servlet.*; + +import javax.servlet.http.*; + +import java.io.InputStream; + +import java.net.*; + +import com.google.gson.*; + + +classRecv + +{ + +private String lhs; + +private String rhs; + +private String error; + +private String icc; + +public Recv( + +{ + +} + +public String getLhs() + +{ + +return lhs; + +} + +public String getRhs() + +{ + +return rhs; + +} + +} + +public classConvertextendsHttpServlet { + +/** + +* Processes requests for both HTTP GET and POST methods. + +* @param request servlet request + +* @param response servlet response + +* @throws ServletException if a servlet-specific error occurs + +* @throws IOException if an I/O error occurs + +*/ + +protected void processRequest(HttpServletRequest req, HttpServletResponse resp) + +throws ServletException, IOException { + +String query = ""; + +String amount = ""; + +String curTo = ""; + +String curFrom = ""; + +String submit = ""; + +String res = ""; + +HttpSession session; + +resp.setContentType("text/html;charset=UTF-8"); + +PrintWriter out = resp.getWriter(); + +/*Read request parameters*/ + +amount = req.getParameter("amount"); + +curTo = req.getParameter("to"); + +curFrom = req.getParameter("from"); + +/*Open a connection to google and read the result*/ + +try { + +query = "http://www.google.com/ig/calculator?hl=en&q=" + amount + curFrom + "=?" + curTo; + +URL url = new URL(query); + +InputStreamReader stream = new InputStreamReader(url.openStream()); + +BufferedReader in = new BufferedReader(stream); + +String str = ""; + +String temp = ""; + +while ((temp = in.readLine()) != null) { + +str = str + temp; + +} + +/*Parse the result which is in json format*/ + +Gson gson = new Gson(); + +Recv st = gson.fromJson(str, Recv.class); + +String rhs = st.getRhs(); + +rhs = rhs.replaceAll("�", ""); + +/*we do the check in order to print the additional word(millions,billions etc)*/ + +StringTokenizer strto = new StringTokenizer(rhs); + +String nextToken; + +out.write(strto.nextToken()); + +nextToken = strto.nextToken(); + +if( nextToken.equals("million") || nextToken.equals("billion") || nextToken.equals("trillion")) + +{ + +out.println(" "+nextToken); + +} + +} catch (NumberFormatException e) { + +out.println("The given amount is not a valid number"); + +} + +} + +// + +/** + +* Handles the HTTP GET method. + +* @param request servlet request + +* @param response servlet response + +* @throws ServletException if a servlet-specific error occurs + +* @throws IOException if an I/O error occurs + +*/ + +@Override + +protected void doGet(HttpServletRequest request, HttpServletResponse response) + +throws ServletException, IOException { + +processRequest(request, response); + +} + +/** + +* Handles the HTTP POST method. + +* @param request servlet request + +* @param response servlet response + +* @throws ServletException if a servlet-specific error occurs + +* @throws IOException if an I/O error occurs + +*/ + +@Override + +protected void doPost(HttpServletRequest request, HttpServletResponse response) + +throws ServletException, IOException { + +processRequest(request, response); + +} + +/** + +* Returns a short description of the servlet. + +* @return a String containing servlet description + +*/ + +@Override + +public String getServletInfo() { + +return "Short description"; + +} + +} \ No newline at end of file diff --git a/Currency Converter/currency_converter.java b/Currency Converter/currency_converter.java new file mode 100644 index 00000000..cd1ea9e5 --- /dev/null +++ b/Currency Converter/currency_converter.java @@ -0,0 +1,241 @@ +/* + +* To change this template, choose Tools | Templates + +* and open the template in the editor. + +*/ + +package com.exchange; + +import java.io.*; + +import java.net.*; + +import java.util.*; + +import javax.servlet.*; + +import javax.servlet.http.*; + +import java.io.InputStream; + +import java.net.*; + +import com.google.gson.*; + +/** + +* + +* @author pakallis + +*/ + +classRecv + +{ + +private String lhs; + +private String rhs; + +private String error; + +private String icc; + +public Recv( + +{ + +} + +public String getLhs() + +{ + +return lhs; + +} + +public String getRhs() + +{ + +return rhs; + +} + +} + +public classConvertextendsHttpServlet { + +/** + +* Processes requests for both HTTP GET and POST methods. + +* @param request servlet request + +* @param response servlet response + +* @throws ServletException if a servlet-specific error occurs + +* @throws IOException if an I/O error occurs + +*/ + +protected void processRequest(HttpServletRequest req, HttpServletResponse resp) + +throws ServletException, IOException { + +String query = ""; + +String amount = ""; + +String curTo = ""; + +String curFrom = ""; + +String submit = ""; + +String res = ""; + +HttpSession session; + +resp.setContentType("text/html;charset=UTF-8"); + +PrintWriter out = resp.getWriter(); + +/*Read request parameters*/ + +amount = req.getParameter("amount"); + +curTo = req.getParameter("to"); + +curFrom = req.getParameter("from"); + +/*Open a connection to google and read the result*/ + +try { + +query = "http://www.google.com/ig/calculator?hl=en&q=" + amount + curFrom + "=?" + curTo; + +URL url = new URL(query); + +InputStreamReader stream = new InputStreamReader(url.openStream()); + +BufferedReader in = new BufferedReader(stream); + +String str = ""; + +String temp = ""; + +while ((temp = in.readLine()) != null) { + +str = str + temp; + +} + +/*Parse the result which is in json format*/ + +Gson gson = new Gson(); + +Recv st = gson.fromJson(str, Recv.class); + +String rhs = st.getRhs(); + +rhs = rhs.replaceAll("�", ""); + +/*we do the check in order to print the additional word(millions,billions etc)*/ + +StringTokenizer strto = new StringTokenizer(rhs); + +String nextToken; + +out.write(strto.nextToken()); + +nextToken = strto.nextToken(); + +if( nextToken.equals("million") || nextToken.equals("billion") || nextToken.equals("trillion")) + +{ + +out.println(" "+nextToken); + +} + +} catch (NumberFormatException e) { + +out.println("The given amount is not a valid number"); + +} + +} + +// + +/** + +* Handles the HTTP GET method. + +* @param request servlet request + +* @param response servlet response + +* @throws ServletException if a servlet-specific error occurs + +* @throws IOException if an I/O error occurs + +*/ + +@Override + +protected void doGet(HttpServletRequest request, HttpServletResponse response) + +throws ServletException, IOException { + +processRequest(request, response); + +} + +/** + +* Handles the HTTP POST method. + +* @param request servlet request + +* @param response servlet response + +* @throws ServletException if a servlet-specific error occurs + +* @throws IOException if an I/O error occurs + +*/ + +@Override + +protected void doPost(HttpServletRequest request, HttpServletResponse response) + +throws ServletException, IOException { + +processRequest(request, response); + +} + +/** + +* Returns a short description of the servlet. + +* @return a String containing servlet description + +*/ + +@Override + +public String getServletInfo() { + +return "Short description"; + +}// + +} diff --git a/DNS Record using Python/dns_record.py b/DNS Record using Python/dns_record.py new file mode 100644 index 00000000..70da90b7 --- /dev/null +++ b/DNS Record using Python/dns_record.py @@ -0,0 +1,29 @@ +#Simple program to fetch dns record of a given website + +import dns.resolver + +#Dictionary to store the dns record of a website +dns_record = {} + +#User defined website +website = input("Enter the name of the website: ") + +#Fetching the 'A' record of the website and storing it in the dictionary +a_record = dns.resolver.resolve(website, 'A') +for ipval in a_record: + dns_record['A_Record_IP'] = ipval.to_text() + +#List to store the mx records of a website +mx_record_list = [] + +#Fetching the mx records and storing them in the dictionary +mx_record = dns.resolver.resolve(website,'MX') +for server in mx_record: + mx_record_list.append(server) +for i, element in enumerate(mx_record_list): + dns_record['MX_Record', i+1] = element + +#Displaying the record on the screen +for key,value in dns_record.items(): + print(f"{key} = {value}") + diff --git a/DNS Record using Python/requirements.txt b/DNS Record using Python/requirements.txt new file mode 100644 index 00000000..689e42ff --- /dev/null +++ b/DNS Record using Python/requirements.txt @@ -0,0 +1 @@ +dnspython==2.0.0 \ No newline at end of file diff --git a/Data Visualisation/.github/workflows/maven.yml b/Data Visualisation/.github/workflows/maven.yml new file mode 100644 index 00000000..7e43ac43 --- /dev/null +++ b/Data Visualisation/.github/workflows/maven.yml @@ -0,0 +1,28 @@ +# https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven + +name: GROOT-CI + +on: + push: + branches: [ '**' ] + pull_request: + branches: [ '**' ] + schedule: + # NOTE: From what I read, the email notification for cron can only go + # to the last committer of this file!!!!! + - cron: '0 22 * * *' + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up JDK + uses: actions/setup-java@v1 + with: + java-version: 11 + - name: build + run: mvn install + diff --git a/Data Visualisation/.gitignore b/Data Visualisation/.gitignore new file mode 100644 index 00000000..f44c0108 --- /dev/null +++ b/Data Visualisation/.gitignore @@ -0,0 +1,12 @@ +/target/ + +*.prefs + +.classpath + +.project + +hs_err_pid50650.log + +hs_err_pid50363.log +/bin/ diff --git a/Data Visualisation/Readme.md b/Data Visualisation/Readme.md new file mode 100644 index 00000000..6e0fc9ca --- /dev/null +++ b/Data Visualisation/Readme.md @@ -0,0 +1,35 @@ +![MasterHead](https://github.com/D-Sensei/Java-Projects-Collections/blob/main/Data%20Visualisation/k.jpg) +

Data Visualisation using Java

+ +## Introduction +Java Data Visualization project designed to make histogramming, plotting, and fitting accessible for Java users. +## Features +- Histograms 1D/2D +- Functions +- GraphErrors +- Fitting routines using Minuit +- GUI tools for easily editing plot attributes and for fitting + +## How to run +Unzip src file + + Check out the examples on our [Wiki](https://github.com/gavalian/groot/wiki "GROOT Wiki"). + +To run the example: Simply double click on the jar if you're a mac user, or if you're a linux user run ```java -jar GrootDemo.jar``` + + + + + + +# Installation +Simply add this [library jar](https://github.com/gavalian/groot/raw/master/jars/) to your build path in an IDE. + +# Requirements +Java 1.8 or greater + +# Documentation +Check out our [Wiki](https://github.com/gavalian/groot/wiki "GROOT Wiki")! + +# Feature requests and contributions +One of the best ways to contribute is to give us feature requests and bug reports on the [issues page](https://github.com/gavalian/groot/issues "GROOT Issues page")! diff --git a/Data Visualisation/build_docs.sh b/Data Visualisation/build_docs.sh new file mode 100644 index 00000000..0cf7245a --- /dev/null +++ b/Data Visualisation/build_docs.sh @@ -0,0 +1,106 @@ +#!/bin/bash +#******************************************************** +# Compilation code for the JNP Library project. +# To compile and deploy the library use the command +# >./build.sh -b +# This will build all the submodules and deploy them +# to MAVEN repository at Jefferson Lab +# To clean the previous build use: +# >./build.sh -c +# To clean all built jars and temporary files +# To generate JavaDoc ( Java API documentation) use: +# >./build.sh -d +# +# The project has a synchronized version set to all +# submodules, currently the change is done manually +# using the command: +# +# mvn versions:set -DnewVersion=1.1-SNAPSHOT +# +# this command is run in each directory, to switch the +# version numbers. In the future this will be automated +#-------------------------------------------------------- +#******************************************************** +# Parsing command line arguments +#-------------------------------------------------------- +while [ "$1" != "" ]; do + case $1 in + -c) + CLEAN_COMMAND="1" + shift 1 + continue + ;; + -b) + BUILD_COMMAND="1" + shift 1 + continue + ;; + -l) + LOCAL_BUILD_COMMAND="1" + shift 1 + continue + ;; + -d) + DOCS_COMMAND="1" + shift 1 + continue + ;; + *) + break + esac +done +#----------------------------------------------------------- +# If clean command was activated. maven clean is performed +# in all sub directories +#----------------------------------------------------------- +if [[ ! -z $CLEAN_COMMAND ]] +then + echo 'Cleaning the distribution' + cd jnp-utils ; mvn clean; cd - + cd jnp-cli ; mvn clean; cd - + cd jnp-hipo ; mvn clean; cd - + cd jnp-physics ; mvn clean; cd - + cd jnp-math ; mvn clean; cd - + cd jnp-distro ; rm -rf jaw* ; cd - +fi +#*********************************************************** +# BUILD LOCALLY without deploying the distribution +#*********************************************************** +if [[ ! -z $LOCAL_BUILD_COMMAND ]] +then + echo 'building the distribution locally' + rm -rf ~/.m2/repository/org/jlab/jnp + cd jnp-utils ; mvn install; cd - + cd jnp-cli ; mvn install; cd - + cd jnp-hipo ; mvn install; cd - + cd jnp-physics ; mvn install; cd - + cd jnp-math ; mvn install; cd - +fi +#----------------------------------------------------------- +# If the build command is activated maven install and +# maven deploy commands are executed for all sub modules +#----------------------------------------------------------- +if [[ ! -z $BUILD_COMMAND ]] +then + echo 'building the distribution' + rm -rf ~/.m2/repository/org/jlab/jnp + cd jnp-utils ; mvn install; mvn deploy; cd - + cd jnp-cli ; mvn install; mvn deploy; cd - + cd jnp-hipo ; mvn install; mvn deploy; cd - + cd jnp-math ; mvn install; mvn deploy; cd - + cd jnp-physics ; mvn install; mvn deploy; cd - +fi +#----------------------------------------------------------- +# generating the documentation for the sub modules. +# if permissions permit, they will be ported to clas12 +# documentation site. +#----------------------------------------------------------- +if [[ ! -z $DOCS_COMMAND ]] +then + echo 'documenting the distribution' + javadoc -d javadoc/groot -sourcepath src/main/java/ -subpackages org + scp -r javadoc clas12@ifarm1402:/group/clas/www/clasweb/html/jhep/docs/. +fi + +#----------------------------------------------------------- +echo ''; echo 'all done.....'; echo '' diff --git a/Data Visualisation/build_history.txt b/Data Visualisation/build_history.txt new file mode 100644 index 00000000..646a9cd3 --- /dev/null +++ b/Data Visualisation/build_history.txt @@ -0,0 +1,6 @@ +1.0.1 2016-08-30 56d134a Will Phelps Fixing build issues +1.0.1 2016-08-30 56d134a Will Phelps Fixing build issues +1.0.1 2016-08-30 56d134a Will Phelps Fixing build issues +1.1.0 + 2016-09-08 76a260f Will Phelps Bug Fix: X Axis Title Position +1.1.1 2016-09-08 76a260f Will Phelps Bug Fix: X Axis Title Position diff --git a/Data Visualisation/build_version.pl b/Data Visualisation/build_version.pl new file mode 100644 index 00000000..082440a5 --- /dev/null +++ b/Data Visualisation/build_version.pl @@ -0,0 +1,59 @@ +$major = 0; +$minor = 0; +$subminor = 1; +foreach(@ARGV){ + print $_."\n"; + if(index($_,"-minor")!=-1){ + $minor = 1; + $subminor = 0; + }elsif(index($_,"-major")!=-1){ + $major = 1; + } +} +$date = `date +%F`; +$hash = `git log --format="%H" -n 1`; +$username = `git log --format="%cn" -n 1`; +$message = `git log --format="%s" -n 1`; +$hash = substr($hash,0,7); + +chomp($username); +chomp($message); +chomp($date); + +#print $date."_".$hash."\n"; +print $date ." ".$hash." ".$username." ".$message." \n"; + +open($original_pom, "pom.xml"); +open($new_pom, ">pom_new.xml"); +open($build_history, ">>build_history.txt"); + +while(<$original_pom>){ + chomp; + #print $_ ."\n"; + if(index($_, "")!=-1&&index($_, "SNAPSHOT")!=-1){ + $_ =~ s|<.+?>||g; + $_ =~ s|-SNAPSHOT||g; + $_ =~ s/^\s+|\s+$//g; + @version = split(/\./,$_); + print "Old version:".$version[0]."\.".$version[1]."\.".$version[2]."\n"; + $new_version = ""; + if($minor == 1){ + $new_version = $version[0]."\.".($version[1]+1)."\.0\n"; + }elsif($major == 1){ + $new_version = ($version[0]+1)."\.0\.0"; + }else{ + $new_version = $version[0]."\.".$version[1]."\.".($version[2]+1); + } + print $build_history "".$new_version." ".$date ." ".$hash." ".$username." ".$message." \n"; + print "New version:".$new_version."\n"; + chomp($new_version); + print $new_pom " ".$new_version."-SNAPSHOT".""."\n" + }else{ + print $new_pom $_."\n"; + } +} +system("mv pom.xml pom_old.xml"); +system("mv pom_new.xml pom.xml"); +system("mvn3 package"); +system("mv target/*.jar jars/") + diff --git a/Data Visualisation/images/Histogram2D.png b/Data Visualisation/images/Histogram2D.png new file mode 100644 index 00000000..032b1805 Binary files /dev/null and b/Data Visualisation/images/Histogram2D.png differ diff --git a/Data Visualisation/images/bar_graph_example.png b/Data Visualisation/images/bar_graph_example.png new file mode 100644 index 00000000..aae7e81e Binary files /dev/null and b/Data Visualisation/images/bar_graph_example.png differ diff --git a/Data Visualisation/images/basicdemo1.png b/Data Visualisation/images/basicdemo1.png new file mode 100644 index 00000000..7da54d0a Binary files /dev/null and b/Data Visualisation/images/basicdemo1.png differ diff --git a/Data Visualisation/images/basicdemo1_5.png b/Data Visualisation/images/basicdemo1_5.png new file mode 100644 index 00000000..c0f1e776 Binary files /dev/null and b/Data Visualisation/images/basicdemo1_5.png differ diff --git a/Data Visualisation/images/basicdemo2.png b/Data Visualisation/images/basicdemo2.png new file mode 100644 index 00000000..fca498f2 Binary files /dev/null and b/Data Visualisation/images/basicdemo2.png differ diff --git a/Data Visualisation/images/basicdemo3.png b/Data Visualisation/images/basicdemo3.png new file mode 100644 index 00000000..1df9468f Binary files /dev/null and b/Data Visualisation/images/basicdemo3.png differ diff --git a/Data Visualisation/images/basicdemo3_log.png b/Data Visualisation/images/basicdemo3_log.png new file mode 100644 index 00000000..e12459c2 Binary files /dev/null and b/Data Visualisation/images/basicdemo3_log.png differ diff --git a/Data Visualisation/images/copy.png b/Data Visualisation/images/copy.png new file mode 100644 index 00000000..ed17b4dd Binary files /dev/null and b/Data Visualisation/images/copy.png differ diff --git a/Data Visualisation/images/copyPaste.png b/Data Visualisation/images/copyPaste.png new file mode 100644 index 00000000..ce871a94 Binary files /dev/null and b/Data Visualisation/images/copyPaste.png differ diff --git a/Data Visualisation/images/customFunction.png b/Data Visualisation/images/customFunction.png new file mode 100644 index 00000000..c5d146ef Binary files /dev/null and b/Data Visualisation/images/customFunction.png differ diff --git a/Data Visualisation/images/customfunction_demo.png b/Data Visualisation/images/customfunction_demo.png new file mode 100644 index 00000000..d55f0717 Binary files /dev/null and b/Data Visualisation/images/customfunction_demo.png differ diff --git a/Data Visualisation/images/doubleClick.png b/Data Visualisation/images/doubleClick.png new file mode 100644 index 00000000..92782d95 Binary files /dev/null and b/Data Visualisation/images/doubleClick.png differ diff --git a/Data Visualisation/images/fitPanel.png b/Data Visualisation/images/fitPanel.png new file mode 100644 index 00000000..421c84c3 Binary files /dev/null and b/Data Visualisation/images/fitPanel.png differ diff --git a/Data Visualisation/images/groot4_example_1.png b/Data Visualisation/images/groot4_example_1.png new file mode 100644 index 00000000..06c5a034 Binary files /dev/null and b/Data Visualisation/images/groot4_example_1.png differ diff --git a/Data Visualisation/images/histogram2d_demo.png b/Data Visualisation/images/histogram2d_demo.png new file mode 100644 index 00000000..f6f19a68 Binary files /dev/null and b/Data Visualisation/images/histogram2d_demo.png differ diff --git a/Data Visualisation/images/histogram2d_log.png b/Data Visualisation/images/histogram2d_log.png new file mode 100644 index 00000000..fc73c82d Binary files /dev/null and b/Data Visualisation/images/histogram2d_log.png differ diff --git a/Data Visualisation/images/modifiedHistogram.png b/Data Visualisation/images/modifiedHistogram.png new file mode 100644 index 00000000..0d77a66d Binary files /dev/null and b/Data Visualisation/images/modifiedHistogram.png differ diff --git a/Data Visualisation/images/multipad.png b/Data Visualisation/images/multipad.png new file mode 100644 index 00000000..af6e4718 Binary files /dev/null and b/Data Visualisation/images/multipad.png differ diff --git a/Data Visualisation/images/multiplot_example.png b/Data Visualisation/images/multiplot_example.png new file mode 100644 index 00000000..9fb449da Binary files /dev/null and b/Data Visualisation/images/multiplot_example.png differ diff --git a/Data Visualisation/images/optionsPanel.png b/Data Visualisation/images/optionsPanel.png new file mode 100644 index 00000000..be1a9605 Binary files /dev/null and b/Data Visualisation/images/optionsPanel.png differ diff --git a/Data Visualisation/images/paste.png b/Data Visualisation/images/paste.png new file mode 100644 index 00000000..3d9580a5 Binary files /dev/null and b/Data Visualisation/images/paste.png differ diff --git a/Data Visualisation/images/rightClick.png b/Data Visualisation/images/rightClick.png new file mode 100644 index 00000000..4d309e4b Binary files /dev/null and b/Data Visualisation/images/rightClick.png differ diff --git a/Data Visualisation/images/syn b/Data Visualisation/images/syn new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/Data Visualisation/images/syn @@ -0,0 +1 @@ + diff --git a/Data Visualisation/images/totalcs_ppbar.png b/Data Visualisation/images/totalcs_ppbar.png new file mode 100644 index 00000000..947d3695 Binary files /dev/null and b/Data Visualisation/images/totalcs_ppbar.png differ diff --git a/Data Visualisation/k.jpg b/Data Visualisation/k.jpg new file mode 100644 index 00000000..fcb83339 Binary files /dev/null and b/Data Visualisation/k.jpg differ diff --git a/Data Visualisation/pom.xml b/Data Visualisation/pom.xml new file mode 100644 index 00000000..c5bfb03d --- /dev/null +++ b/Data Visualisation/pom.xml @@ -0,0 +1,148 @@ + + + 4.0.0 + + org.jlab + groot + 4.0.4-SNAPSHOT + jar + + + + net.objecthunter + exp4j + 0.4.4 + + + + org.jlab.jnp + jnp-hipo + 2.0-SNAPSHOT + + + + org.jlab.jnp + jnp-hipo4 + 4.1-SNAPSHOT + + + + org.jlab.jnp + jnp-graphics + 2.0-SNAPSHOT + + + + + org.freehep + freehep-jminuit + 1.0.2 + + + + org.jfree + org.jfree.pdf + 2.0 + + + + org.jfree + org.jfree.svg + 4.2 + + + + + + net.miginfocom + miglayout + 4.0 + + + + + + + clas12maven + https://clasweb.jlab.org/clas12maven + + + jnp-maven + https://clasweb.jlab.org/jhep/maven + + + + freehep-repo-public + https://srs.slac.stanford.edu/nexus/content/groups/freehep-maven2-public/ + + + + + + + + org.apache.maven.wagon + wagon-ssh-external + 2.8 + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.0 + + 11 + 11 + 11 + + + + + maven-assembly-plugin + 2.6 + + + jar-with-dependencies + + + + + org.jlab.groot.demo.GROOTDemo + + + + + + + make-assembly + package + + single + + + + + + + + + + ssh-clasweb + scpexe://clas12@jlabl1.jlab.org/group/clas/www/clasweb/html/clas12maven + + + + + diff --git a/Data Visualisation/src.zip b/Data Visualisation/src.zip new file mode 100644 index 00000000..d9ab1df7 Binary files /dev/null and b/Data Visualisation/src.zip differ diff --git a/DateChooser.jar b/DateChooser.jar new file mode 100644 index 00000000..54a2e0d8 Binary files /dev/null and b/DateChooser.jar differ diff --git a/Department-Wise Salary Calculation/.DS_Store b/Department-Wise Salary Calculation/.DS_Store new file mode 100644 index 00000000..7e68eb3b Binary files /dev/null and b/Department-Wise Salary Calculation/.DS_Store differ diff --git a/Department-Wise Salary Calculation/App.json b/Department-Wise Salary Calculation/App.json new file mode 100644 index 00000000..e14c3c1e --- /dev/null +++ b/Department-Wise Salary Calculation/App.json @@ -0,0 +1 @@ +{"Department 4":64400,"Department 2":111400,"Department 3":61000,"Department 1":110000} \ No newline at end of file diff --git a/Department-Wise Salary Calculation/assessment.xml b/Department-Wise Salary Calculation/assessment.xml new file mode 100644 index 00000000..50fcc291 --- /dev/null +++ b/Department-Wise Salary Calculation/assessment.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Department-Wise Salary Calculation/pom.xml b/Department-Wise Salary Calculation/pom.xml new file mode 100644 index 00000000..cb0be32a --- /dev/null +++ b/Department-Wise Salary Calculation/pom.xml @@ -0,0 +1,24 @@ + + + 4.0.0 + + org.example + assessment + 1.0-SNAPSHOT + + + + com.google.code.gson + gson + 2.2.4 + + + + + 16 + 16 + + + \ No newline at end of file diff --git a/Department-Wise Salary Calculation/src/main/java/assessment/Department_salary.java b/Department-Wise Salary Calculation/src/main/java/assessment/Department_salary.java new file mode 100644 index 00000000..9fb359de --- /dev/null +++ b/Department-Wise Salary Calculation/src/main/java/assessment/Department_salary.java @@ -0,0 +1,2 @@ +package assessment;public class Department_salary { +} diff --git a/Department-Wise Salary Calculation/src/main/java/assessment/salary.java b/Department-Wise Salary Calculation/src/main/java/assessment/salary.java new file mode 100644 index 00000000..a2d9c4e6 --- /dev/null +++ b/Department-Wise Salary Calculation/src/main/java/assessment/salary.java @@ -0,0 +1,71 @@ +package assessment; +import java.io.FileWriter; +import java.io.IOException; +import java.util.HashMap; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +public class salary { + public static void main( String [] args) throws Exception + { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + HashMap map=new HashMap(); + String jsonString; + FileWriter myWriter = new FileWriter("App.json"); + + try { + DocumentBuilder builder = factory.newDocumentBuilder(); + Document doc = builder.parse("assessment.xml"); + NodeList departmentList =doc.getElementsByTagName("Department"); + String dep,s; + int sal,depsal=0; + for(int k=0; k myGraphs = new ArrayList<>(); + int currentDinosaurX = 0; + int currentDinosaurY = 0; + boolean gameOver = false; + DrawPanel drawPanel = new DrawPanel(); + public static void main(String args[]) { + new Game(); + } + + public Game() { + super("Run Dino Run"); + setSize(1200, 550); // set the size of the window + setVisible(true); + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + dispose(); + System.exit(0); + } + }); + + addKeyListener(this); + initCactusG(); + + ActionListener listener = new ActionListener() { + public void actionPerformed(ActionEvent e) { + if (!gameOver) { + if (jump >= D_W) { + jump = 0; + initCactusG(); + drawPanel.repaint(); + } else { + jump += 10; + drawPanel.repaint(); + } + } + } + }; + + Timer timer = new javax.swing.Timer(40, listener); + timer.start(); + ActionListener listenerD = new ActionListener() { + public void actionPerformed(ActionEvent e) { + if (!gameOver) { + if (onEnterPresses) { + if (down) { + jumpY -= 20; + } else { + jumpY += 20; + } + } + if (jumpY >= 280) { + down = true; + } + if (jumpY <= 0) { + onEnterPresses = false; + down = false; + jumpY = 0; + } + } + } + }; + Timer timerD = new javax.swing.Timer(80, listenerD); + timerD.start(); + add(drawPanel); + pack(); + // setDefaultCloseOperation(EXIT_ON_CLOSE); + setLocationRelativeTo(null); + setVisible(true); + } + + // create the cactus on random positions + private void initCactusG() { + Random rr = new Random(); + int nbr = 2;// rr.nextInt(2)+1 ;; + int x_ = 10; + int y_ = 100; + int h_ = 60; + int p_ = 10; + myGraphs = new ArrayList(); + for (int it = 0; it < nbr; it++) { + Random r = new Random(); + int step = r.nextInt(10) + 1; + MyGraph myGraph = new MyGraph(); + myGraph.x_ = x_ * 30 + step * 10 + 600; + myGraph.h_ = 10 + (6 * step) + 2; + myGraph.y_ = 300 - h_; + myGraph.p_ = 8 + step / 2; + myGraphs.add(myGraph); + } + } + + // draw the cactus + private void drawCactus(Graphics g) { + int x = 0; + int y = 0; + int h = 0; + int p = 0; + for (MyGraph myGraph : myGraphs) { + x = myGraph.x_; + h = myGraph.h_; + y = myGraph.y_; + p = myGraph.p_; + int maxH = 180; + int i = p * 2 + 40; + int j = p * 2 + 40; + int y1 = y + 40; + int y2 = y + 60; + if (x + j - jump < 0) { + jump = 0; + } + draw(g, x - i - jump, y1, h, p); + draw(g, x - jump, y, maxH, p * 2); + draw(g, x + j - jump, y2, h, p); + drow2(g, x - jump, h, p, i, j, y1, y2); + } + } + + // on game over draw the game over text + private void gameOver(Graphics g) { + Graphics2D graph = (Graphics2D) g; + graph.setPaint(colorGameOver1); + graph.setFont(new Font("MV Boli", 20, 50)); + graph.drawString("Game Over", 550, 150); + + //restart + Graphics2D graph1 = (Graphics2D) g; + graph1.setPaint(colorGameOver1); + graph1.setFont(new Font("MV Boli", 20, 50)); + graph1.drawString("Press Space key to restart!!", 350, 250); + } + + // restart the game + private void restartGame(Graphics g) { + new Game(); + } + + // draw the sun on the sky + private void drawSun(Graphics g) { + Graphics2D sun1 = (Graphics2D) g; + sun1.setPaint(new Color(255, 255, 0)); + sun1.fillArc(900, 70, 80, 80, 90, 180); + Graphics2D sun2 = (Graphics2D) g; + sun2.setPaint(new Color(255, 255, 153)); + sun2.fillArc(900, 70, 80, 80, 270, 180); + } + + // draw the cactus + private void drow2(Graphics g, int x, int h, int p, int i, int j, int y1, int y2) { + Graphics2D gsds = (Graphics2D) g; + gsds.setPaint(colorCactus1); + gsds.fillRect(x - i + p, y1 + h, i, p); + Graphics2D gsdds = (Graphics2D) g; + gsdds.setPaint(colorCactus2); + gsdds.fillRect(x - i + 2 * p, y1 + h - p, i - 2 * p, p); + Graphics2D gsd2 = (Graphics2D) g; + gsd2.setPaint(colorCactus2); + gsd2.fillRect(x + p * 2, y2 + h, j - p, p); + Graphics2D gsd3 = (Graphics2D) g; + gsd3.setPaint(colorCactus1); + gsd3.fillRect(x + p * 4, y2 + h - p, j - 4 * p, p); + } + + // draw the surface + private void drawSol(Graphics g, int x, int y, int maxH) { + Graphics2D sol = (Graphics2D) g; + sol.setPaint(Color.orange); + sol.fillRect(0, y + maxH - 20, 1700, 100); + } + + // draw the dinausor + private void drawDinausor(Graphics g, int y) { + int xDinausor = 180; + int step = 1; + g.setColor(colorDinosaur); + currentDinosaurX = xDinausor; + currentDinosaurY = y; + drawRaw(g, xDinausor, y, 2, 1); + drawRaw(g, xDinausor + 4 * unit, y, 2, 1); + drawRaw(g, xDinausor, y - step * unit, 1, 1); + drawRaw(g, xDinausor + 4 * unit, y - step * unit, 1, 1); + step++; + drawRaw(g, xDinausor, y - step * unit, 2, 1); + drawRaw(g, xDinausor + 3 * unit, y - step * unit, 2, 1); + step++; + drawRaw(g, xDinausor, y - step * unit, 5, 1); + step++; + drawRaw(g, xDinausor - unit, y - step * unit, 6, 1); + step++; + drawRaw(g, xDinausor - 2 * unit, y - step * unit, 8, 1); + step++; + drawRaw(g, xDinausor - 3 * unit, y - step * unit, 10, 1); + step++; + drawRaw(g, xDinausor - 4 * unit, y - step * unit, 11, 1); + drawRaw(g, xDinausor + (11 + 1 - 4) * unit, y - step * unit, 1, 1); + step++; + drawRaw(g, xDinausor - 4 * unit, y - step * unit, 3, 1); + drawRaw(g, xDinausor + (5 - 4) * unit, y - step * unit, 8, 1); + step++; + drawRaw(g, xDinausor - 4 * unit, y - step * unit, 2, 1); + drawRaw(g, xDinausor + (6 - 4) * unit, y - step * unit, 5, 1); + step++; + drawRaw(g, xDinausor - 4 * unit, y - step * unit, 1, 1); + drawRaw(g, xDinausor + (7 - 4) * unit, y - step * unit, 4, 1); + step++; + drawRaw(g, xDinausor - 4 * unit, y - step * unit, 1, 1); + drawRaw(g, xDinausor + (8 - 4) * unit, y - step * unit, 7, 1); + step++; + drawRaw(g, xDinausor + (8 - 4) * unit, y - step * unit, 4, 1); + step++; + drawRaw(g, xDinausor + (8 - 4) * unit, y - step * unit, 8, 1); + step++; + drawRaw(g, xDinausor + (8 - 4) * unit, y - step * unit, 2, 1); + drawRaw(g, xDinausor + (11 - 4) * unit, y - step * unit, 5, 1); + step++; + drawRaw(g, xDinausor + (8 - 4) * unit, y - step * unit, 8, 1); + step++; + drawRaw(g, xDinausor + (9 - 4) * unit, y - step * unit, 6, 1); + step++; + } + + private void drawRaw(Graphics g, int Dinausor, int y, int w, int h) { + Graphics2D sun16 = (Graphics2D) g; + sun16.fillRect(Dinausor, y, w * unit, h * unit); + } + + private void draw(Graphics g, int x, int y, int h, int p) { + if (x <= currentDinosaurX && x + p >= currentDinosaurX && y <= currentDinosaurY) { + gameOver(g); + gameOver = true; + return; + } + Graphics2D gcd = (Graphics2D) g; + // Green 0 -204- 0 + gcd.setPaint(colorCactus1); + gcd.fillRect(x, y, p, h); + Graphics2D gsd = (Graphics2D) g; + // Very dark green 0 -102- 0 + gsd.setPaint(colorCactus2); + gsd.fillRect(x + p, y, p, h); + Graphics2D gssd = (Graphics2D) g; + // Very dark green 0 -102- 0 + gssd.setPaint(colorCactus2); + gssd.fillArc(x, y - p, p * 2, p * 2, 1, 90); + Graphics2D gzssd = (Graphics2D) g; + gzssd.setPaint(colorCactus1); + gzssd.fillArc(x, y - p, p * 2, p * 2, 90, 90); + Graphics2D ghssd = (Graphics2D) g; + ghssd.setPaint(colorCactus1); + ghssd.fillArc(x, y + h - p, p * 2, p * 2, 180, 90); + Graphics2D ghzssd = (Graphics2D) g; + ghzssd.setPaint(colorCactus2); + ghzssd.fillArc(x, y + h - p, p * 2, p * 2, 270, 90); + } + + private class DrawPanel extends JPanel { + public DrawPanel() { + MoveAction action = new MoveAction("onEnter"); + String ACTION_KEY = "onEnter"; + KeyStroke W = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0); + InputMap inputMap = getInputMap(WHEN_IN_FOCUSED_WINDOW); + inputMap.put(W, ACTION_KEY); + ActionMap actionMap = getActionMap(); + actionMap.put(ACTION_KEY, action); + } + protected void paintComponent(Graphics g) { + super.paintComponent(g); + drawCactus(g); + drawSun(g); + drawSol(g, 100, 250, 180); + drawDinausor(g, 400 - jumpY); + if (gameOver) { + gameOver(g); + } + } + public Dimension getPreferredSize() { + return new Dimension(D_W, D_H); + } + } + + private class MyGraph { + int x_ = 10; + int y_ = 100; + int h_ = 60; + int p_ = 10; + } + + class MoveAction extends AbstractAction { + public MoveAction(String name) { + putValue(NAME, name); + } + public void actionPerformed(ActionEvent actionEvent) { + onEnterPresses = true; + drawPanel.repaint(); + } + } + + @Override + public void keyTyped(KeyEvent e) { + // TODO Auto-generated method stub + } + + @Override + public void keyPressed(KeyEvent e) { + if(e.getKeyCode() == KeyEvent.VK_SPACE) { + if(gameOver){ + gameOver = false; + restartGame(getGraphics()); + } + } + } + + @Override + public void keyReleased(KeyEvent e) { + // TODO Auto-generated method stub + } +} diff --git a/Dns_record/README.md b/Dns_record/README.md new file mode 100644 index 00000000..c8af26b6 --- /dev/null +++ b/Dns_record/README.md @@ -0,0 +1,21 @@ +## DNS Record + +This script takes the website name as input and returns its dns records. + +#Requirements to run this file: + +External library called dnspython has been used here and it can be installed easily by using the following command: + +pip install -r requirements.txt + +#How to use this script? + +1.Install the requirements. + +2. Type the following command + +python dns_record.py + +3.It will ask for a website: + +You can give any website name for example: google.com diff --git a/Dns_record/dns_record.py b/Dns_record/dns_record.py new file mode 100644 index 00000000..70da90b7 --- /dev/null +++ b/Dns_record/dns_record.py @@ -0,0 +1,29 @@ +#Simple program to fetch dns record of a given website + +import dns.resolver + +#Dictionary to store the dns record of a website +dns_record = {} + +#User defined website +website = input("Enter the name of the website: ") + +#Fetching the 'A' record of the website and storing it in the dictionary +a_record = dns.resolver.resolve(website, 'A') +for ipval in a_record: + dns_record['A_Record_IP'] = ipval.to_text() + +#List to store the mx records of a website +mx_record_list = [] + +#Fetching the mx records and storing them in the dictionary +mx_record = dns.resolver.resolve(website,'MX') +for server in mx_record: + mx_record_list.append(server) +for i, element in enumerate(mx_record_list): + dns_record['MX_Record', i+1] = element + +#Displaying the record on the screen +for key,value in dns_record.items(): + print(f"{key} = {value}") + diff --git a/Dns_record/requirements.txt b/Dns_record/requirements.txt new file mode 100644 index 00000000..689e42ff --- /dev/null +++ b/Dns_record/requirements.txt @@ -0,0 +1 @@ +dnspython==2.0.0 \ No newline at end of file diff --git a/DomesticFlight.class b/DomesticFlight.class new file mode 100644 index 00000000..5ddf29ae Binary files /dev/null and b/DomesticFlight.class differ diff --git a/DomesticFlight.java b/DomesticFlight.java new file mode 100644 index 00000000..edd00237 --- /dev/null +++ b/DomesticFlight.java @@ -0,0 +1,318 @@ +import javax.swing.*; +import java.awt.*; +import java.awt.event.*; +import java.io.*; + +public class DomesticFlight extends JFrame +{ + JComboBox CBFrom, CBTo, CBClass, CBAdult, CBChildren, CBInfant; + JLabel LFrom, LTo, LBookingDate, LClass, LAdult, LChildren, LInfant, LBookingDetails, LPassengerDetails, LDate, LImg1, LImg2, LNotes; + JTextField TFBookingDate; + Icon img1, img2; + JButton BFindFlight; + JPanel PPanel1, PPanel2; + + LoginPage type1; + + public DomesticFlight(LoginPage type1) + { + Container c =getContentPane(); + c.setLayout(new BorderLayout()); + String[] sItem1={"Trivandrum"}; + String[] sItem2 ={ "Bangalore", "Chennai ", "Delhi", "Goa", "Hyderabad", "Kolkata", "Lucknow", "Mumbai", "Vishakapatnam" }; + String[] sItem3={"Economic","Business"}; + + this.type1 = type1; + PPanel1 = new JPanel(null); + PPanel1.setPreferredSize(new Dimension(500,200)); + + LBookingDetails = new JLabel("Booking Details"); + LFrom = new JLabel("From :"); + LTo = new JLabel("To :"); + LBookingDate = new JLabel("Booking Date:"); + LClass = new JLabel("Class :"); + + CBFrom = new JComboBox(sItem1); + CBTo = new JComboBox(sItem2); + CBClass = new JComboBox(sItem3); + + TFBookingDate = new JTextField(10); + LDate = new JLabel("(DD/MM/YYYY)"); + LDate.setForeground(Color.red); + + img1=new ImageIcon("map1.jpg"); + LImg1 = new JLabel(img1); + + BFindFlight = new JButton("Find Flight"); + + LBookingDetails.setBounds(20,3,100,20); + + LFrom.setBounds(20,40,100,20); + CBFrom.setBounds(100,40,100,20); + + LTo.setBounds(20,100,100,20); + CBTo.setBounds(100,100,100,20); + + LBookingDate.setBounds(14,160,100,20); + TFBookingDate.setBounds(100,160,100,20); + LDate.setBounds(210,160,100,20); + + LClass.setBounds(20,220,100,20); + CBClass.setBounds(100,220,100,20); + + BFindFlight.setBounds(50,270,100,25); + + LImg1.setBounds(0,290,495,260); + + PPanel1.add(LBookingDetails); + PPanel1.add(LFrom); + PPanel1.add(CBFrom); + PPanel1.add(LTo); + PPanel1.add(CBTo); + PPanel1.add(LBookingDate); + PPanel1.add(TFBookingDate); + PPanel1.add(LDate); + PPanel1.add(LClass); + PPanel1.add(CBClass); + PPanel1.add(BFindFlight); + PPanel1.add(LImg1); + PPanel1.setBackground(Color.white); + + c.add(PPanel1,BorderLayout.WEST); + + PPanel2 = new JPanel(null); + PPanel2.setPreferredSize(new Dimension(320,160)); + + LPassengerDetails=new JLabel("PassengerDetails"); + + LAdult = new JLabel("Adults(12+)"); + + LChildren = new JLabel("Children(2-11)"); + LInfant = new JLabel("Infants(under 2)"); + + String[] item4={"1","2","3","4","5","6"}; + CBAdult = new JComboBox(item4); + + String[] item5={"0","1","2","3","4"}; + CBChildren = new JComboBox(item5); + + String[] item6={"0","1","2","3"}; + CBInfant = new JComboBox(item6); + + img2 = new ImageIcon("note_bg.gif"); + LImg2 = new JLabel(img2); + LNotes = new JLabel("

NOTE: Bookings with International Credit Cards

have temporarily been suspended.This Service

will resume shortly and we will have a notice

posted on our website.We regret any

inconvenience caused to our passengers."); + + LPassengerDetails.setBounds(40,3,100,20); + + LAdult.setBounds(40,40,100,20); + CBAdult.setBounds(140,40,100,20); + + LChildren.setBounds(40,105,100,20); + CBChildren.setBounds(140,105,100,20); + + LInfant.setBounds(40,170,100,20); + CBInfant.setBounds(140,170,100,20); + + LImg2.setBounds(16,220,320,200); + LNotes.setBounds(55,240,380,180); + + PPanel2.add(LPassengerDetails); + PPanel2.add(LAdult); + PPanel2.add(LChildren); + PPanel2.add(LInfant); + PPanel2.add(CBAdult); + PPanel2.add(CBChildren); + PPanel2.add(CBInfant); + + PPanel2.add(LNotes); + PPanel2.add(LImg2); + + PPanel2.setBackground(Color.white); + + c.add(PPanel2,BorderLayout.EAST); + + setSize(795,580); + setVisible(true); + + BFindFlight.addActionListener(new button3(this, type1)); + } + public static void main(String args[]) + { + LoginPage type1=null; + new DomesticFlight(type1); + } +} + +class button3 implements ActionListener +{ + DomesticFlight type; + LoginPage type1; + button3(DomesticFlight type, LoginPage type1) + { + this.type = type; + this.type1 = type1; + } + public void actionPerformed(ActionEvent e) + { + String sFrom = (String)type.CBFrom.getSelectedItem(); + String sTo = (String)type.CBTo.getSelectedItem(); + String sClass = (String)type.CBClass.getSelectedItem(); + String sBookingDate = type.TFBookingDate.getText(); + Integer iPrice=0; + String sTime=""; + + + Integer iAdult = Integer.parseInt((String)type.CBAdult.getSelectedItem()); + Integer iChildren = Integer.parseInt((String)type.CBChildren.getSelectedItem()); + Integer iInfant = Integer.parseInt((String)type.CBInfant.getSelectedItem()); + + int i = 0; + + if(sClass.equals("Economic")) + { + try{ + while(i<20) + { + if(type1.row1[i][1].equals(sTo)) + { + iPrice = Integer.parseInt((String)type1.row1[i][2]); + sTime = (String)type1.row1[i][3]; + break; + } + i++; + } + }catch(Exception e1) + { + JOptionPane.showMessageDialog(null, "You have no rights to access"); + System.exit(0); + } + } + else + { + try + { + while(i<20) + { + if(type1.row1[i][1].equals(sTo)) + { + iPrice = Integer.parseInt((String)type1.row3[i][2]); + sTime = (String)type1.row3[i][3]; + break; + } + i++; + } + }catch(Exception e1) + { + JOptionPane.showMessageDialog(null, "You have no rights to access it"); + System.exit(0); + } + } + type.setTitle(iPrice + " " + sTime); + + iPrice = (iPrice*iAdult)+(iPrice*(iChildren/2)); + + int iCount=0; + int iSeatCount=0; + + String[] sTempFrom=new String[1250]; + String[] sTempTo=new String[1250]; + String[] sTempClass=new String[1250]; + String[] sTempBookingDate=new String[1250]; + String[] sTempTime=new String[1250]; + Integer[] iTempAdult=new Integer[1250]; + Integer[] iTempChildren=new Integer[1250]; + Integer[] iTempInfant=new Integer[1250]; + Integer[] iTempPrice=new Integer[1250]; + + try + { +//read from data + Save2 save1; + ObjectInputStream OIS1 = new ObjectInputStream(new FileInputStream("save2")); + do + { + save1 = (Save2)OIS1.readObject(); + sTempFrom[iCount] = save1.sFrom; + sTempTo[iCount] = save1.sTo; + sTempClass[iCount] = save1.sClass; + sTempBookingDate[iCount] = save1.sBookingDate; + sTempTime[iCount] = save1.sTime; + iTempAdult[iCount] = save1.iAdult; + iTempChildren[iCount] = save1.iChildren; + iTempInfant[iCount] = save1.iInfant; + iTempPrice[iCount] = save1.iPrice; + + iCount++; + if(save1.sBookingDate.equals(sBookingDate)) + if(save1.sTo.equals(sTo)) + iSeatCount=iSeatCount + save1.iAdult + save1.iChildren + save1.iInfant; + }while(save1!=null); + OIS1.close(); + + } + catch(Exception e1) + { + } + + iSeatCount = iSeatCount + iAdult + iChildren + iInfant; + + if(iSeatCount > 60) + { + JOptionPane.showMessageDialog(null,"Seats are full. Sorry!"); + } + else + { + int iChoice = JOptionPane.showConfirmDialog(null,"Seats available. Do you want to Book now?"); + if(iChoice == JOptionPane.YES_OPTION) + { + new PrintTicket1(sFrom, sTo, sClass, iAdult, iChildren, iInfant, sBookingDate, iPrice, sTime); + try + { +//write into data + Save2 save2=new Save2(sFrom, sTo, sClass, iAdult, iChildren, iInfant, sBookingDate, iPrice, sTime); + ObjectOutputStream OOS1 = new ObjectOutputStream(new FileOutputStream("save2")); + for(i=0;i +![Screenshot of the Output](Screenshot.png) + +## Working +The script first lists all the files in the directory. It takes MD5 hash of each file, when hash of 2 files become same it deletes the file. + +## Author Name +[Anandha Krishnan Aji](https://github.com/anandhakrishnanaji) diff --git a/Duplicate files remover/Screenshot.png b/Duplicate files remover/Screenshot.png new file mode 100644 index 00000000..c69aefaa Binary files /dev/null and b/Duplicate files remover/Screenshot.png differ diff --git a/Duplicate files remover/duplicatefileremover.py b/Duplicate files remover/duplicatefileremover.py new file mode 100644 index 00000000..7dd9dcd1 --- /dev/null +++ b/Duplicate files remover/duplicatefileremover.py @@ -0,0 +1,40 @@ +import hashlib +import os + +# Returns the hash string of the given file name + + +def hashFile(filename): + # For large files, if we read it all together it can lead to memory overflow, So we take a blocksize to read at a time + BLOCKSIZE = 65536 + hasher = hashlib.md5() + with open(filename, 'rb') as file: + # Reads the particular blocksize from file + buf = file.read(BLOCKSIZE) + while(len(buf) > 0): + hasher.update(buf) + buf = file.read(BLOCKSIZE) + return hasher.hexdigest() + + +if __name__ == "__main__": + # Dictionary to store the hash and filename + hashMap = {} + + # List to store deleted files + deletedFiles = [] + filelist = [f for f in os.listdir() if os.path.isfile(f)] + for f in filelist: + key = hashFile(f) + # If key already exists, it deletes the file + if key in hashMap.keys(): + deletedFiles.append(f) + os.remove(f) + else: + hashMap[key] = f + if len(deletedFiles) != 0: + print('Deleted Files') + for i in deletedFiles: + print(i) + else: + print('No duplicate files found') diff --git a/E-Health Care Management/E-Health Care Management/Ehospital.class b/E-Health Care Management/E-Health Care Management/Ehospital.class new file mode 100644 index 00000000..cec84542 Binary files /dev/null and b/E-Health Care Management/E-Health Care Management/Ehospital.class differ diff --git a/E-Health Care Management/E-Health Care Management/Ehospital.java b/E-Health Care Management/E-Health Care Management/Ehospital.java new file mode 100644 index 00000000..e4c4d7d5 --- /dev/null +++ b/E-Health Care Management/E-Health Care Management/Ehospital.java @@ -0,0 +1,379 @@ +import java.util.*; +import java.lang.String; +import java.io.*; +import java.time.format.DateTimeFormatter; +import java.time.LocalDateTime; + +class Info +{ +Info() +{ +System.out.print("\t\t\t\t\t ___________________________________________________________________________________________\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| WELCOME TO E-HEALTH CARE MANAGEMENT SYSTEM |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| -Brought To You by |\n"); +System.out.print("\t\t\t\t\t| Md Fahad,Omer Mohiuddin and Yaseen Hussain |\n"); +System.out.print("\t\t\t\t\t|___________________________________________________________________________________________|\n"); +} +//Declaring variales to be used +Scanner scan=new Scanner(System.in); +String name; +String address; +long contact; +int age; +String bg; +String sex; +String disease; +long id; +String dadm; +//To take a pause +private void pressAnyKeyToContinue() + { + System.out.println("Press Enter key to continue..."); + try + { + System.in.read(); + } + catch(Exception e) + { + System.out.println("Press 'Enter' key to continue!"); + } + } + //Taking multiple words +String readString() +{ + Scanner scanner = new Scanner(System.in); + return scanner.nextLine(); +} +//Log in Module +void login() +{ + int a; + String pass; + System.out.print("\t\t\t\t\t _______________________________________________________________________________________ \n"); + System.out.print("\n\t\t\t\t\t\t\t\tE-HEALTH CARE MANAGEMENT SYSTEM \n"); + System.out.print("\t\t\t\t\t _______________________________________________________________________________________ \n"); + System.out.println("\n\n\t\t\t\t\t\t\t\t------------------------------"); + System.out.print("\n\t\t\t\t\t\t\t\t\t LOGIN \n"); + System.out.print("\t\t\t\t\t\t\t\t------------------------------\n\n"); + System.out.print("\t\t\t\t\t\t\t\tEnter the Password: "); + pass=scan.next(); + if(pass.equals("deccan")) + { + System.out.print("\n\n\t\t\t\t\t\t\t\tAccess Granted!\n"); + pressAnyKeyToContinue(); + } + else + { + System.out.print( "\n\n\t\t\t\t\t\t\t\tAccess Aborted...\n\t\t\t\t\t\t\t\t1.Try Again\n\n\t\t\t\t\t\t\t\t2.Exit"); + System.out.print("\n\n\t\t\t\t\t\t\tEnter the option: "); + try{ + a=scan.nextInt(); + if(a==1) + login(); + else if(a==2) + System.exit(0); + else + { + System.out.print("\n\n\t\t\t\t\t\tInvalid Choice\n"); + } + } + catch(InputMismatchException e){ + System.out.println("\n\n\t\t\t\t\t\t\t*Enter the correct option!*\n\n"); + login(); + } + } +} +//To get Date + public void getCurrentTimeUsingDate() + { + DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm:ss"); + LocalDateTime now = LocalDateTime.now(); + dadm=dtf.format(now); + + } + +void menu() +{ +char k; +//giving option to the user for their choice +System.out.print("\t\t\t\t\t _______________________________________________________________________________________ \n"); +System.out.print("\n\n\t\t\t\t\t\t\t\t E-HEALTH CARE MANAGEMENT SYSTEM \n\n"); +System.out.print("\t\t\t\t\t _______________________________________________________________________________________ \n"); +System.out.print("\n\n\t\t\t\t\t\tPlease, Choose from the following Options: \n\n"); +System.out.print("\t\t\t\t\t\t _________________________________________________________________ \n"); +System.out.print("\t\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t\t| 1 >> Add New Patient Record |\n"); +System.out.print("\t\t\t\t\t\t| 2 >> Add Diagnosis Information |\n"); +System.out.print("\t\t\t\t\t\t| 3 >> History of the Patient |\n"); +System.out.print("\t\t\t\t\t\t| 4 >> Bill of the patient |\n"); +System.out.print("\t\t\t\t\t\t| 5 >> Help |\n"); +System.out.print("\t\t\t\t\t\t| 6 >> Exit |\n"); +System.out.print("\t\t\t\t\t\t|_________________________________________________________________|\n\n"); +System.out.print("\t\t\t\t\t\tEnter your choice: "); +k=scan.next().charAt(0); +//if inputed choice is other than given choice +switch(k) +{ +case '1': patient(); +break; +case '2': diagnos(); +break; +case '3': history(); +break; +case '4': bill(); +break; +case '5': info(); +break; +case '6': exit(); +break; +default: System.out.print("\n\n\t\t\t\t\t\tInvalid Choice\n"); + System.out.print("\t\t\t\t\t\tTry again...........\n\n"); + menu(); +} +menu(); +} +void patient() +{ +System.out.print("Enter the patient's file name: "); + +String fileName =scan.next(); +getCurrentTimeUsingDate(); + + try { + // Assume default encoding. + FileWriter fileWriter = new FileWriter(fileName+".txt"); + + // Always wrap FileWriter in BufferedWriter. + BufferedWriter bufferedWriter = new BufferedWriter(fileWriter); + + // Note that write() does not automatically + // append a newline character. + System.out.print("\n********************************************************************\n"); + bufferedWriter.write("Date of admission: "+dadm); + bufferedWriter.newLine(); + System.out.print("\nName : ");name=readString();bufferedWriter.write("Name : "+name); + bufferedWriter.newLine(); + System.out.print("\nAddress : ");address=readString();bufferedWriter.write("Address : "+address); + bufferedWriter.newLine(); + System.out.print("\nContact Number : ");contact=scan.nextLong();bufferedWriter.write("Contact Number : "+contact); + bufferedWriter.newLine(); + System.out.print("\nAge : ");age=scan.nextInt();bufferedWriter.write("Age : "+age); + bufferedWriter.newLine(); + System.out.print("\nSex : ");sex=scan.next();bufferedWriter.write("Sex : "+sex); + bufferedWriter.newLine(); + System.out.print("\nBlood Group : ");bg=scan.next();bufferedWriter.write("Blood Group : "+bg); + bufferedWriter.newLine(); + System.out.print("\nAny Major disease suffered earlier : ");disease=readString();bufferedWriter.write("Any Major disease suffered earlier : "+disease); + bufferedWriter.newLine(); + System.out.print("\nPatient ID : ");id=scan.nextLong();bufferedWriter.write("Patient ID : "+id); + bufferedWriter.newLine(); + System.out.print("\n********************************************************************\n"); + bufferedWriter.write("\n********************************************************************\n\n"); + bufferedWriter.newLine();System.out.print("\nInformation Saved Successfully\n"); + + // Always close files. + bufferedWriter.close(); + } + catch(IOException ex) + { + System.out.println("Error writing to file '"+ fileName +"'"); + } + pressAnyKeyToContinue(); +} +void diagnos() +{ + String symptom; + String diagnosis; + String medicine; + String addmission; + String ward; + String doctor; + getCurrentTimeUsingDate(); + System.out.print("\n\nEnter the patient's file name to be opened : "); + String fileName=scan.next(); + // This will reference one line at a time + String line = null; + try { + // FileReader reads text files in the default encoding. + FileReader fileReader = new FileReader(fileName+".txt"); + + // Always wrap FileReader in BufferedReader. + BufferedReader bufferedReader = new BufferedReader(fileReader); + System.out.println("\n\n\n\n\t\t\t\t........................................ Information about '"+fileName+"' ........................................\n\n\n\n"); + while((line = bufferedReader.readLine()) != null) + { + System.out.println(line); + } + + // Always close files. + bufferedReader.close(); + //Appending data in file + PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(fileName+".txt", true))); + System.out.print("Adding more information in patient's file................on : "+dadm); + out.println("Description of the day:"+dadm); + System.out.print("\nDoctor appointed:");doctor=readString();out.println("Doctor appointed: "+doctor); + System.out.print("\nSymptoms : ");symptom=readString();out.println("Symptoms : "+symptom); + System.out.print("\nDiagnosis : "); diagnosis=readString();out.println("Diagnosis : "+diagnosis); + System.out.print("\nMedicines : ");medicine=readString(); out.println("Medicines : "+medicine); + System.out.print("\nAddmission Required? : "); + addmission=readString();out.println("Addmission Required? : "+addmission); + if(addmission.equals("Yes")||addmission.equals("Y")) + { + System.out.print("\nType of ward : ");ward=readString(); out.println("Type of ward : "+ward); + out.println("\n*************************************************************************\n"); + System.out.print(ward+" ward is alloted Successfully\n"); + } + else + {out.println("*************************************************************************\n");} + out.close(); + pressAnyKeyToContinue(); + } + catch(FileNotFoundException ex) { + System.out.println( + "Unable to open file '" + fileName + "'"); + } + catch (IOException e) { + System.out.println("Error writing or Reading to file '"+ fileName +"'"); + } +} + +void history() + { + System.out.print("\n\nEnter the patient's file name to be opened : "); + String fileName=scan.next(); + // This will reference one line at a time + String line = null; + try { + // FileReader reads text files in the default encoding. + FileReader fileReader = new FileReader(fileName+".txt"); + + // Always wrap FileReader in BufferedReader. + BufferedReader bufferedReader = new BufferedReader(fileReader); + System.out.print("\n\n\n\n\t\t\t\t........................................ Full Medical History of '"+fileName+"' ........................................\n\n\n\n"); + while((line = bufferedReader.readLine()) != null) + { + System.out.println(line); + } + pressAnyKeyToContinue(); + // Always close files. + bufferedReader.close(); + } + catch(FileNotFoundException ex) { + System.out.println( + "Unable to open file '" + fileName + "'"); + } + catch(IOException ex) { + System.out.println( + "Error reading file '" + fileName + "'"); + } + } +void bill() +{ + getCurrentTimeUsingDate(); + int days; + double wcharge; + double doc; + double ser; +System.out.println("\t\t\t\t\t\t _________________________________________________________________ "); + System.out.print("\n\n\t\t\t\t\t\t\t\t E-HEALTH CARE MANAGEMENT SYSTEM \n\n"); +System.out.println("\t\t\t\t\t\t _________________________________________________________________ "); + System.out.print("Enter the patient's file name to get the Bill: "); + String fileName=scan.next(); + // This will reference one line at a time + String line = null; + try { + // FileReader reads text files in the default encoding. + FileReader fileReader = new FileReader(fileName+".txt"); + PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(fileName+".txt", true))); + + // Always wrap FileReader in BufferedReader. + BufferedReader bufferedReader = new BufferedReader(fileReader); + System.out.print("Date: "+dadm); + System.out.println("\n\n\n\n\t\t\t\tDetails of the patient:\n\n\n\n"); + while((line = bufferedReader.readLine()) != null) + { + System.out.println(line); + } + System.out.print("\t\t\t\t\t\t _________________________________________________________________ "); + System.out.println("\n\t\t\t\t\t\t\t\t\tBill of the patient:"); + System.out.print("\t\t\t\t\t\t _________________________________________________________________ \n\n"); + System.out.print("\t\t\t\t\t\tNo.of days patient stayed:");days=scan.nextInt(); + System.out.print("\t\t\t\t\t\tWard charges/day:");wcharge=scan.nextDouble(); + System.out.print("\n\t\t\t\t\t\tTotal ward charges:"+(wcharge*days)); + System.out.print("\n\t\t\t\t\t\tDoctor's fee:");doc=scan.nextDouble(); + System.out.print("\n\t\t\t\t\t\tService charges:");ser=scan.nextDouble(); + System.out.print("\n\t\t\t\t\t\tTOTAL AMOUNT:"+((wcharge*days)+doc+ser)); + out.println("Total Bill:"+((wcharge*days)+doc+ser)); + System.out.print("\n\t\t\t\t\t\t _________________________________________________________________ \n"); + // Always close files. + out.close(); + bufferedReader.close(); + } + catch(FileNotFoundException ex) { + System.out.println( + "Unable to open file '" + fileName + "'"); + } + catch(IOException ex) { + System.out.println( + "Error reading file '" + fileName + "'"); + } + pressAnyKeyToContinue(); +} +void exit() +{ +System.out.print("\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t\t\n"); +System.out.print("\t\t\t\t\t _______________________________________________________________________________________ \n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| THANK YOU FOR USING |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| E-HEALTH CARE MANAGEMENT SYSTEM |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| -Brought To You by Fahad,Omer and Yaseen |\n"); +System.out.print("\t\t\t\t\t|_______________________________________________________________________________________|\n"); +System.out.print("\t\t\t\t\t\n\n\n\n\t\t\t\t\t"); +System.exit(0); +} +void info() +{ + System.out.println("\n\nE-Health care management system is command-driven application that helps to manage the record of the patient's as well as generate their hospital bills."); + System.out.print("\t\t\t\t__________________________________________________________________________________________________________________________________\n"); + System.out.print("\t\t\t\t\tOptions | Description\n"); + System.out.print("\t\t\t\t__________________________________________________________________________________________________________________________________\n"); + System.out.println("\t\t\t\t 1 >> Add New Patient Record | A new patient file can be created by using this module."); + System.out.println("\t\t\t\t 2 >> Add Diagnosis Information | Adding day-to-day evaluation of the patient or the diagnosis report in the existing file."); + System.out.println("\t\t\t\t 3 >> History of the Patient | Check the previous or existing details of particular patient by using their file name."); + System.out.println("\t\t\t\t 4 >> Bill of the patient | Generates the bill of the patient with displaying the details."); + System.out.println("\t\t\t\t 5 >> Help | Provide the help documentation."); + System.out.println("\t\t\t\t 6 >> Exit | Exits the application."); + pressAnyKeyToContinue(); +} +} +public class Ehospital +{ +public static void main (String args[]) +{ + Info i=new Info(); + i.login(); + i.menu(); +} +} diff --git a/E-Health Care Management/E-Health Care Management/Info.class b/E-Health Care Management/E-Health Care Management/Info.class new file mode 100644 index 00000000..9eb706cf Binary files /dev/null and b/E-Health Care Management/E-Health Care Management/Info.class differ diff --git a/E-Health Care Management/Ehospital.class b/E-Health Care Management/Ehospital.class new file mode 100644 index 00000000..cec84542 Binary files /dev/null and b/E-Health Care Management/Ehospital.class differ diff --git a/E-Health Care Management/Ehospital.java b/E-Health Care Management/Ehospital.java new file mode 100644 index 00000000..e4c4d7d5 --- /dev/null +++ b/E-Health Care Management/Ehospital.java @@ -0,0 +1,379 @@ +import java.util.*; +import java.lang.String; +import java.io.*; +import java.time.format.DateTimeFormatter; +import java.time.LocalDateTime; + +class Info +{ +Info() +{ +System.out.print("\t\t\t\t\t ___________________________________________________________________________________________\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| WELCOME TO E-HEALTH CARE MANAGEMENT SYSTEM |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| -Brought To You by |\n"); +System.out.print("\t\t\t\t\t| Md Fahad,Omer Mohiuddin and Yaseen Hussain |\n"); +System.out.print("\t\t\t\t\t|___________________________________________________________________________________________|\n"); +} +//Declaring variales to be used +Scanner scan=new Scanner(System.in); +String name; +String address; +long contact; +int age; +String bg; +String sex; +String disease; +long id; +String dadm; +//To take a pause +private void pressAnyKeyToContinue() + { + System.out.println("Press Enter key to continue..."); + try + { + System.in.read(); + } + catch(Exception e) + { + System.out.println("Press 'Enter' key to continue!"); + } + } + //Taking multiple words +String readString() +{ + Scanner scanner = new Scanner(System.in); + return scanner.nextLine(); +} +//Log in Module +void login() +{ + int a; + String pass; + System.out.print("\t\t\t\t\t _______________________________________________________________________________________ \n"); + System.out.print("\n\t\t\t\t\t\t\t\tE-HEALTH CARE MANAGEMENT SYSTEM \n"); + System.out.print("\t\t\t\t\t _______________________________________________________________________________________ \n"); + System.out.println("\n\n\t\t\t\t\t\t\t\t------------------------------"); + System.out.print("\n\t\t\t\t\t\t\t\t\t LOGIN \n"); + System.out.print("\t\t\t\t\t\t\t\t------------------------------\n\n"); + System.out.print("\t\t\t\t\t\t\t\tEnter the Password: "); + pass=scan.next(); + if(pass.equals("deccan")) + { + System.out.print("\n\n\t\t\t\t\t\t\t\tAccess Granted!\n"); + pressAnyKeyToContinue(); + } + else + { + System.out.print( "\n\n\t\t\t\t\t\t\t\tAccess Aborted...\n\t\t\t\t\t\t\t\t1.Try Again\n\n\t\t\t\t\t\t\t\t2.Exit"); + System.out.print("\n\n\t\t\t\t\t\t\tEnter the option: "); + try{ + a=scan.nextInt(); + if(a==1) + login(); + else if(a==2) + System.exit(0); + else + { + System.out.print("\n\n\t\t\t\t\t\tInvalid Choice\n"); + } + } + catch(InputMismatchException e){ + System.out.println("\n\n\t\t\t\t\t\t\t*Enter the correct option!*\n\n"); + login(); + } + } +} +//To get Date + public void getCurrentTimeUsingDate() + { + DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm:ss"); + LocalDateTime now = LocalDateTime.now(); + dadm=dtf.format(now); + + } + +void menu() +{ +char k; +//giving option to the user for their choice +System.out.print("\t\t\t\t\t _______________________________________________________________________________________ \n"); +System.out.print("\n\n\t\t\t\t\t\t\t\t E-HEALTH CARE MANAGEMENT SYSTEM \n\n"); +System.out.print("\t\t\t\t\t _______________________________________________________________________________________ \n"); +System.out.print("\n\n\t\t\t\t\t\tPlease, Choose from the following Options: \n\n"); +System.out.print("\t\t\t\t\t\t _________________________________________________________________ \n"); +System.out.print("\t\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t\t| 1 >> Add New Patient Record |\n"); +System.out.print("\t\t\t\t\t\t| 2 >> Add Diagnosis Information |\n"); +System.out.print("\t\t\t\t\t\t| 3 >> History of the Patient |\n"); +System.out.print("\t\t\t\t\t\t| 4 >> Bill of the patient |\n"); +System.out.print("\t\t\t\t\t\t| 5 >> Help |\n"); +System.out.print("\t\t\t\t\t\t| 6 >> Exit |\n"); +System.out.print("\t\t\t\t\t\t|_________________________________________________________________|\n\n"); +System.out.print("\t\t\t\t\t\tEnter your choice: "); +k=scan.next().charAt(0); +//if inputed choice is other than given choice +switch(k) +{ +case '1': patient(); +break; +case '2': diagnos(); +break; +case '3': history(); +break; +case '4': bill(); +break; +case '5': info(); +break; +case '6': exit(); +break; +default: System.out.print("\n\n\t\t\t\t\t\tInvalid Choice\n"); + System.out.print("\t\t\t\t\t\tTry again...........\n\n"); + menu(); +} +menu(); +} +void patient() +{ +System.out.print("Enter the patient's file name: "); + +String fileName =scan.next(); +getCurrentTimeUsingDate(); + + try { + // Assume default encoding. + FileWriter fileWriter = new FileWriter(fileName+".txt"); + + // Always wrap FileWriter in BufferedWriter. + BufferedWriter bufferedWriter = new BufferedWriter(fileWriter); + + // Note that write() does not automatically + // append a newline character. + System.out.print("\n********************************************************************\n"); + bufferedWriter.write("Date of admission: "+dadm); + bufferedWriter.newLine(); + System.out.print("\nName : ");name=readString();bufferedWriter.write("Name : "+name); + bufferedWriter.newLine(); + System.out.print("\nAddress : ");address=readString();bufferedWriter.write("Address : "+address); + bufferedWriter.newLine(); + System.out.print("\nContact Number : ");contact=scan.nextLong();bufferedWriter.write("Contact Number : "+contact); + bufferedWriter.newLine(); + System.out.print("\nAge : ");age=scan.nextInt();bufferedWriter.write("Age : "+age); + bufferedWriter.newLine(); + System.out.print("\nSex : ");sex=scan.next();bufferedWriter.write("Sex : "+sex); + bufferedWriter.newLine(); + System.out.print("\nBlood Group : ");bg=scan.next();bufferedWriter.write("Blood Group : "+bg); + bufferedWriter.newLine(); + System.out.print("\nAny Major disease suffered earlier : ");disease=readString();bufferedWriter.write("Any Major disease suffered earlier : "+disease); + bufferedWriter.newLine(); + System.out.print("\nPatient ID : ");id=scan.nextLong();bufferedWriter.write("Patient ID : "+id); + bufferedWriter.newLine(); + System.out.print("\n********************************************************************\n"); + bufferedWriter.write("\n********************************************************************\n\n"); + bufferedWriter.newLine();System.out.print("\nInformation Saved Successfully\n"); + + // Always close files. + bufferedWriter.close(); + } + catch(IOException ex) + { + System.out.println("Error writing to file '"+ fileName +"'"); + } + pressAnyKeyToContinue(); +} +void diagnos() +{ + String symptom; + String diagnosis; + String medicine; + String addmission; + String ward; + String doctor; + getCurrentTimeUsingDate(); + System.out.print("\n\nEnter the patient's file name to be opened : "); + String fileName=scan.next(); + // This will reference one line at a time + String line = null; + try { + // FileReader reads text files in the default encoding. + FileReader fileReader = new FileReader(fileName+".txt"); + + // Always wrap FileReader in BufferedReader. + BufferedReader bufferedReader = new BufferedReader(fileReader); + System.out.println("\n\n\n\n\t\t\t\t........................................ Information about '"+fileName+"' ........................................\n\n\n\n"); + while((line = bufferedReader.readLine()) != null) + { + System.out.println(line); + } + + // Always close files. + bufferedReader.close(); + //Appending data in file + PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(fileName+".txt", true))); + System.out.print("Adding more information in patient's file................on : "+dadm); + out.println("Description of the day:"+dadm); + System.out.print("\nDoctor appointed:");doctor=readString();out.println("Doctor appointed: "+doctor); + System.out.print("\nSymptoms : ");symptom=readString();out.println("Symptoms : "+symptom); + System.out.print("\nDiagnosis : "); diagnosis=readString();out.println("Diagnosis : "+diagnosis); + System.out.print("\nMedicines : ");medicine=readString(); out.println("Medicines : "+medicine); + System.out.print("\nAddmission Required? : "); + addmission=readString();out.println("Addmission Required? : "+addmission); + if(addmission.equals("Yes")||addmission.equals("Y")) + { + System.out.print("\nType of ward : ");ward=readString(); out.println("Type of ward : "+ward); + out.println("\n*************************************************************************\n"); + System.out.print(ward+" ward is alloted Successfully\n"); + } + else + {out.println("*************************************************************************\n");} + out.close(); + pressAnyKeyToContinue(); + } + catch(FileNotFoundException ex) { + System.out.println( + "Unable to open file '" + fileName + "'"); + } + catch (IOException e) { + System.out.println("Error writing or Reading to file '"+ fileName +"'"); + } +} + +void history() + { + System.out.print("\n\nEnter the patient's file name to be opened : "); + String fileName=scan.next(); + // This will reference one line at a time + String line = null; + try { + // FileReader reads text files in the default encoding. + FileReader fileReader = new FileReader(fileName+".txt"); + + // Always wrap FileReader in BufferedReader. + BufferedReader bufferedReader = new BufferedReader(fileReader); + System.out.print("\n\n\n\n\t\t\t\t........................................ Full Medical History of '"+fileName+"' ........................................\n\n\n\n"); + while((line = bufferedReader.readLine()) != null) + { + System.out.println(line); + } + pressAnyKeyToContinue(); + // Always close files. + bufferedReader.close(); + } + catch(FileNotFoundException ex) { + System.out.println( + "Unable to open file '" + fileName + "'"); + } + catch(IOException ex) { + System.out.println( + "Error reading file '" + fileName + "'"); + } + } +void bill() +{ + getCurrentTimeUsingDate(); + int days; + double wcharge; + double doc; + double ser; +System.out.println("\t\t\t\t\t\t _________________________________________________________________ "); + System.out.print("\n\n\t\t\t\t\t\t\t\t E-HEALTH CARE MANAGEMENT SYSTEM \n\n"); +System.out.println("\t\t\t\t\t\t _________________________________________________________________ "); + System.out.print("Enter the patient's file name to get the Bill: "); + String fileName=scan.next(); + // This will reference one line at a time + String line = null; + try { + // FileReader reads text files in the default encoding. + FileReader fileReader = new FileReader(fileName+".txt"); + PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(fileName+".txt", true))); + + // Always wrap FileReader in BufferedReader. + BufferedReader bufferedReader = new BufferedReader(fileReader); + System.out.print("Date: "+dadm); + System.out.println("\n\n\n\n\t\t\t\tDetails of the patient:\n\n\n\n"); + while((line = bufferedReader.readLine()) != null) + { + System.out.println(line); + } + System.out.print("\t\t\t\t\t\t _________________________________________________________________ "); + System.out.println("\n\t\t\t\t\t\t\t\t\tBill of the patient:"); + System.out.print("\t\t\t\t\t\t _________________________________________________________________ \n\n"); + System.out.print("\t\t\t\t\t\tNo.of days patient stayed:");days=scan.nextInt(); + System.out.print("\t\t\t\t\t\tWard charges/day:");wcharge=scan.nextDouble(); + System.out.print("\n\t\t\t\t\t\tTotal ward charges:"+(wcharge*days)); + System.out.print("\n\t\t\t\t\t\tDoctor's fee:");doc=scan.nextDouble(); + System.out.print("\n\t\t\t\t\t\tService charges:");ser=scan.nextDouble(); + System.out.print("\n\t\t\t\t\t\tTOTAL AMOUNT:"+((wcharge*days)+doc+ser)); + out.println("Total Bill:"+((wcharge*days)+doc+ser)); + System.out.print("\n\t\t\t\t\t\t _________________________________________________________________ \n"); + // Always close files. + out.close(); + bufferedReader.close(); + } + catch(FileNotFoundException ex) { + System.out.println( + "Unable to open file '" + fileName + "'"); + } + catch(IOException ex) { + System.out.println( + "Error reading file '" + fileName + "'"); + } + pressAnyKeyToContinue(); +} +void exit() +{ +System.out.print("\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t\t\n"); +System.out.print("\t\t\t\t\t _______________________________________________________________________________________ \n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| THANK YOU FOR USING |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| E-HEALTH CARE MANAGEMENT SYSTEM |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| |\n"); +System.out.print("\t\t\t\t\t| -Brought To You by Fahad,Omer and Yaseen |\n"); +System.out.print("\t\t\t\t\t|_______________________________________________________________________________________|\n"); +System.out.print("\t\t\t\t\t\n\n\n\n\t\t\t\t\t"); +System.exit(0); +} +void info() +{ + System.out.println("\n\nE-Health care management system is command-driven application that helps to manage the record of the patient's as well as generate their hospital bills."); + System.out.print("\t\t\t\t__________________________________________________________________________________________________________________________________\n"); + System.out.print("\t\t\t\t\tOptions | Description\n"); + System.out.print("\t\t\t\t__________________________________________________________________________________________________________________________________\n"); + System.out.println("\t\t\t\t 1 >> Add New Patient Record | A new patient file can be created by using this module."); + System.out.println("\t\t\t\t 2 >> Add Diagnosis Information | Adding day-to-day evaluation of the patient or the diagnosis report in the existing file."); + System.out.println("\t\t\t\t 3 >> History of the Patient | Check the previous or existing details of particular patient by using their file name."); + System.out.println("\t\t\t\t 4 >> Bill of the patient | Generates the bill of the patient with displaying the details."); + System.out.println("\t\t\t\t 5 >> Help | Provide the help documentation."); + System.out.println("\t\t\t\t 6 >> Exit | Exits the application."); + pressAnyKeyToContinue(); +} +} +public class Ehospital +{ +public static void main (String args[]) +{ + Info i=new Info(); + i.login(); + i.menu(); +} +} diff --git a/E-Health Care Management/Info.class b/E-Health Care Management/Info.class new file mode 100644 index 00000000..9eb706cf Binary files /dev/null and b/E-Health Care Management/Info.class differ diff --git a/E-Health Care Management/~$oject Report 2.docx b/E-Health Care Management/~$oject Report 2.docx new file mode 100644 index 00000000..1c94c6e6 Binary files /dev/null and b/E-Health Care Management/~$oject Report 2.docx differ diff --git a/E-Health Care Management/~$stract2.docx b/E-Health Care Management/~$stract2.docx new file mode 100644 index 00000000..1c94c6e6 Binary files /dev/null and b/E-Health Care Management/~$stract2.docx differ diff --git a/ElectricVehicleRunningTime.java b/ElectricVehicleRunningTime.java new file mode 100644 index 00000000..e5fe4b9a --- /dev/null +++ b/ElectricVehicleRunningTime.java @@ -0,0 +1,21 @@ +public class ElectricVehicleRunningTime { + + public static void main(String[] args) { + + // Create an array to store the on and off times of the electric vehicle + int[] evTimes = {850, 945, 1145, 1155, 1230, 1245, 1330, 1340, 1425, 1445}; + + // Calculate the total running time in minutes + int runningTime = 0; + for (int i = 1; i < evTimes.length; i += 2) { + runningTime += evTimes[i] - evTimes[i - 1]; + } + + // Convert the running time to hours and minutes + int hours = runningTime / 60; + int minutes = runningTime % 60; + + // Display the running time + System.out.println("The running time of the electric vehicle is " + hours + " hour(s) and " + minutes + " minute(s)."); + } +} \ No newline at end of file diff --git a/Email_Generator/.DS_Store b/Email_Generator/.DS_Store new file mode 100644 index 00000000..6b591f2e Binary files /dev/null and b/Email_Generator/.DS_Store differ diff --git a/Email_Generator/README.md b/Email_Generator/README.md new file mode 100644 index 00000000..7c8c2386 --- /dev/null +++ b/Email_Generator/README.md @@ -0,0 +1,12 @@ +## Email_Generator +This is basically Email Generator Application Program in Java. +
This program will Generate an email like this syntax: firstname.lastname@department.company.com +
You can select the department name, change the password, set the mailbox capacity and define an alternate email address +
It will Generate a random String for a password. + +## How To Run this Project +1. Download zip +2. After Download Extract it. +3. Right click +4. Open folder as intellij idea project or Open folder as project eclipse +5. Than, Open Src and also open .java files and Run. diff --git a/Email_Generator/bin/emailgenerator/EmailBackProgram.class b/Email_Generator/bin/emailgenerator/EmailBackProgram.class new file mode 100644 index 00000000..42c877a7 Binary files /dev/null and b/Email_Generator/bin/emailgenerator/EmailBackProgram.class differ diff --git a/Email_Generator/bin/emailgenerator/EmailMainProgram.class b/Email_Generator/bin/emailgenerator/EmailMainProgram.class new file mode 100644 index 00000000..a9963525 Binary files /dev/null and b/Email_Generator/bin/emailgenerator/EmailMainProgram.class differ diff --git a/Email_Generator/src/emailgenerator/EmailBackProgram.java b/Email_Generator/src/emailgenerator/EmailBackProgram.java new file mode 100644 index 00000000..72832065 --- /dev/null +++ b/Email_Generator/src/emailgenerator/EmailBackProgram.java @@ -0,0 +1,125 @@ +package Email_App; + +import java.util.Scanner; + +public class Email { + private String firstName; + private String lastName; + private String password; + private String department; + private String email; + private int defaultPasswordLength=8; + private int codelen=5; + private String Vcode; + private String company="drngpit.ac.in"; + private String name; + + public Email(String firstName, String lastName) { + this.firstName = firstName; + this.lastName = lastName; + System.out.println("Kindly ! Enter department for email creation dear "+this.firstName+" "+this.lastName); + //dept + this.department=setDepartment(); + System.out.println("Department:"+department); + //pass + this.password=randomPass(defaultPasswordLength); + System.out.println("New Password :"+password); + //clipping name as one + this.name=firstName+lastName; + //verification code + this.Vcode=vcode(codelen); + System.out.println("Your verification code : "+Vcode); + + //Binding + email=name.toLowerCase()+"."+department+"@"+company; + System.out.println("Official mail :"+email); + } + + private String setDepartment(){ + System.out.println("Enter the department Id\nSales : 1\nDevelopment : 2\nAccounting : 3"); + Scanner in=new Scanner(System.in); + int dep=in.nextInt(); + if(dep==1){ + return "sales"; + } + else if(dep==2){ + return"dev"; + } + else if(dep==3){ + return "acc"; + } + return""; + } + + private String randomPass(int length){ + String password="ABCEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%"; + char[]pass=new char[length]; + for(int i=0;i"); + Scanner sc=new Scanner(System.in); + +// String x=sc.nextLine(); + System.out.println("Generating the email..."); + System.out.println("Enter firstname :"); + String first=sc.nextLine(); + System.out.println("Enter Lastname :"); + String second=sc.nextLine(); + + Email em=new Email(first,second); + + while(true) { + System.out.println("1 : Information "); + System.out.println("2 : Change Email"); + System.out.println("3 : Change Password"); + System.out.println("4 : Disclose Password"); + System.out.println("5 : Exit"); + System.out.println("Enter operation code :"); + int a = sc.nextInt(); + switch (a) { + case 1: + System.out.println(em.showInfo()); + break; + case 2: + System.out.println("Enter alternate email prefix :"); + sc.nextLine(); + String alt = sc.nextLine(); + em.setEmail(alt+"@drngpit.ac.in"); + break; + case 3: + System.out.println("Enter the verification code :"); + sc.nextLine(); + String s = sc.nextLine(); + if (s.equals(em.getVcode())) { + System.out.println("Enter alternate password :"); + String p = sc.nextLine(); + em.setPassword(p); + } else { + System.out.println("Please Enter valid verification code !!!"); + } + System.out.println("Password updated successfully !!!"); + break; + case 4: + System.out.println("Password disclose warning !!!"); + System.out.println("Enter the verification code :"); + sc.nextLine(); + String s1 = sc.nextLine(); + if (s1.equals(em.getVcode())) { + System.out.println("Your password : " + em.getPassword()); + } else { + System.out.println("Please Enter valid verification code !!!"); + } + case 5: + System.out.println("Have a great day ahead ! BYE "); + return ; + } + } + } +} \ No newline at end of file diff --git a/Employee Attendance System.java b/Employee Attendance System.java new file mode 100644 index 00000000..672400af --- /dev/null +++ b/Employee Attendance System.java @@ -0,0 +1,106 @@ +import java.util.*; +import java.text.SimpleDateFormat; + +class Employee { + private String name; + private int id; + private List attendance; + + public Employee(int id, String name) { + this.id = id; + this.name = name; + this.attendance = new ArrayList<>(); + } + + public void markAttendance() { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date date = new Date(); + attendance.add(dateFormat.format(date)); + } + + public List getAttendance() { + return attendance; + } + + public String getName() { + return name; + } + + public int getId() { + return id; + } +} + +public class AttendanceSystem { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + List employees = new ArrayList<>(); + int employeeIdCounter = 1; + + while (true) { + System.out.println("Employee Attendance System Menu:"); + System.out.println("1. Add Employee"); + System.out.println("2. Mark Attendance"); + System.out.println("3. View Attendance"); + System.out.println("4. Exit"); + System.out.print("Select an option (1/2/3/4): "); + + int option = scanner.nextInt(); + + switch (option) { + case 1: + scanner.nextLine(); + System.out.print("Enter the employee's name: "); + String name = scanner.nextLine(); + employees.add(new Employee(employeeIdCounter, name)); + employeeIdCounter++; + System.out.println("Employee added successfully."); + break; + case 2: + System.out.print("Enter employee ID to mark attendance: "); + int employeeId = scanner.nextInt(); + Employee employee = findEmployeeById(employees, employeeId); + if (employee != null) { + employee.markAttendance(); + System.out.println("Attendance marked for " + employee.getName()); + } else { + System.out.println("Employee not found."); + } + break; + case 3: + System.out.print("Enter employee ID to view attendance: "); + int idToView = scanner.nextInt(); + Employee empToView = findEmployeeById(employees, idToView); + if (empToView != null) { + List attendance = empToView.getAttendance(); + if (attendance.isEmpty()) { + System.out.println(empToView.getName() + " has no attendance records."); + } else { + System.out.println("Attendance records for " + empToView.getName() + ":"); + for (String record : attendance) { + System.out.println(record); + } + } + } else { + System.out.println("Employee not found."); + } + break; + case 4: + System.out.println("Exiting the Attendance System."); + scanner.close(); + System.exit(0); + default: + System.out.println("Invalid option. Please select 1, 2, 3, or 4."); + } + } + } + + private static Employee findEmployeeById(List employees, int id) { + for (Employee employee : employees) { + if (employee.getId() == id) { + return employee; + } + } + return null; + } +} diff --git a/Encrypt-the-Password/password_encryption.java b/Encrypt-the-Password/password_encryption.java new file mode 100644 index 00000000..953b179c --- /dev/null +++ b/Encrypt-the-Password/password_encryption.java @@ -0,0 +1,49 @@ +import java.math.BigInteger; +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +public class password_encryption +{ + public static byte[] getSHA(String input) throws NoSuchAlgorithmException + { + /* MessageDigest instance for hashing using SHA512*/ + MessageDigest md = MessageDigest.getInstance("SHA-512"); + + /* digest() method called to calculate message digest of an input and return array of byte */ + return md.digest(input.getBytes(StandardCharsets.UTF_8)); + } + + public static String toHexString(byte[] hash) + { + /* Convert byte array of hash into digest */ + BigInteger number = new BigInteger(1, hash); + + /* Convert the digest into hex value */ + StringBuilder hexString = new StringBuilder(number.toString(16)); + + while (hexString.length() < 32) + { + hexString.insert(0, '0'); + } + + return hexString.toString(); + } + + /* Driver code */ + public static void main(String args[]) + { + try + { + String string1 = "examplePassword123"; + System.out.println("\n" + string1 + " : " + toHexString(getSHA(string1))); + + String string2 = "hashtrial"; + System.out.println("\n" + string2 + " : " + toHexString(getSHA(string2))); + } + catch (NoSuchAlgorithmException e) + { + System.out.println("Exception thrown for incorrect algorithm: " + e); + } + } +} diff --git a/Eng_Dictionary/README.md b/Eng_Dictionary/README.md new file mode 100644 index 00000000..9a9c2a9c --- /dev/null +++ b/Eng_Dictionary/README.md @@ -0,0 +1,14 @@ +# Eng_Dictionary +An interactive dictionary UI which provides meanings, synonyms and pronounces the word. + +## features : +* provides meaning, pronunciation and synonyms along with examples. +* a pronunciation button which tells how to pronunce the word. +* clicking on synonym provides the meaning of that word. + +## limitations: +* only one meaning is provided. +* API used has a lot of missing informations. + +## ScreenShort: +![Screenshot (219)](https://github.com/replyre/Eng_Dictionary/assets/121796450/74219858-7bcd-48fa-9b67-dc56a4daedd8) diff --git a/Eng_Dictionary/dictionary.png b/Eng_Dictionary/dictionary.png new file mode 100644 index 00000000..41d5fa56 Binary files /dev/null and b/Eng_Dictionary/dictionary.png differ diff --git a/Eng_Dictionary/index.html b/Eng_Dictionary/index.html new file mode 100644 index 00000000..fc415d6c --- /dev/null +++ b/Eng_Dictionary/index.html @@ -0,0 +1,65 @@ + + + + + + English Dictionary + + + + + + + +

+
English Dictionary
+ +

Type the word and press enter

+
    +
  • +
    +

    _

    + __ +
    + +
  • + +
    +
  • +
    +

    Meaning

    + __ +
    +
  • + +
  • +
    +

    Example

    + __ +
    +
  • +
  • +
    +

    Synonyms

    +
    +
    +
  • +
    +
+
+ + + diff --git a/Eng_Dictionary/script.js b/Eng_Dictionary/script.js new file mode 100644 index 00000000..dc94fd84 --- /dev/null +++ b/Eng_Dictionary/script.js @@ -0,0 +1,91 @@ +const wrapper = document.querySelector(".wrapper"); +const searchInput = wrapper.querySelector("input"); +const infoText = wrapper.querySelector(".info-text"); +const synonyms = wrapper.querySelector(".synonyms .list"); +const volumeIcon = wrapper.querySelector(".word i"); +const removeIcon = wrapper.querySelector(".search span"); +let audio; + +function data(result, word) { + wrapper.classList.remove("active"); + wrapper.offsetWidth; + if (result.title) { + infoText.innerHTML = `Can't find the meaning of ${word}. Please search another word.`; + } else { + wrapper.classList.add("active"); + document.querySelector(".word p").innerText = result[0].word; + phonetics = ""; + if (result[0].phonetics[0] !== undefined) + phonetics = result[0].phonetics[0].text; + document.querySelector( + ".word span" + ).innerText = `${result[0].meanings[0].partOfSpeech} ${phonetics}`; + document.querySelector(".meaning span").innerText = + result[0].meanings[0].definitions[0].definition.split(";")[0]; + document.querySelector(".example span").innerText = + result[0].meanings[0].definitions[0].example || "Not Available"; + + audio = new Audio(result[0].phonetics[0].audio); + if (result[0].meanings[0].synonyms.length === 0) { + synonyms.parentElement.style.display = "none"; + } else synonyms.parentElement.style.display = "block"; + + synonyms.innerHTML = ""; + for (let i = 0; i < 5; i++) { + let tag = `${result[0].meanings[0].synonyms[i] || ""}`; + + synonyms.insertAdjacentHTML("beforeend", tag); + } + } +} + +function fetchAPI(word) { + wrapper.classList.remove("active"); + infoText.style.cssText = " padding: 12px; color:black"; + infoText.innerHTML = `Searching the meaning of ${word}`; + let url = `https://api.dictionaryapi.dev/api/v2/entries/en/${word}`; + + fetch(url) + .then((res) => res.json()) + .catch((error) => { + infoText.style.color = "red"; + infoText.innerHTML = "Something went wrong.
Error: " + error.message; + }) + .then((result) => data(result, word)); +} + +searchInput.addEventListener("keyup", (e) => { + if (e.key === "Enter" && e.target.value) { + fetchAPI(e.target.value); + } +}); + +volumeIcon.addEventListener("click", () => { + if (audio.attributes[1].nodeValue.length === 0) { + no_audio1 = new Audio( + "https://api.dictionaryapi.dev/media/pronunciations/en/not-us.mp3" + ); + no_audio2 = new Audio( + "https://api.dictionaryapi.dev/media/pronunciations/en/available-us.mp3" + ); + no_audio1.play(); + setTimeout(() => { + no_audio2.play(); + }, 150); + } else audio.play(); +}); + +function search(word) { + searchInput.value = word; + fetchAPI(word); +} + +removeIcon.addEventListener("click", () => { + searchInput.value = ""; + searchInput.focus(); + wrapper.classList.remove("active"); + infoText.innerHTML = "Type the word and press enter"; + infoText.style.cssText = " padding: 0px; color:#9a9a9a"; +}); diff --git a/Eng_Dictionary/styles.css b/Eng_Dictionary/styles.css new file mode 100644 index 00000000..db138622 --- /dev/null +++ b/Eng_Dictionary/styles.css @@ -0,0 +1,167 @@ +@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@200&display=swap"); + +* { + margin: 0; + padding: 0; + box-sizing: border-box; + font-family: "Poppins", sans-serif; + font-weight: bold; +} + +body { + display: flex; + align-items: center; + justify-content: center; + min-height: 100vh; + background-image: linear-gradient(to top left, lightblue, cyan, lightblue); +} + +.wrapper { + width: 420px; + background-color: rgba(255, 255, 255, 0.7); + border-radius: 20px; + padding: 28px 28px 45px; +} + +.wrapper header { + font-size: 28px; + font-weight: 500; + font-family: monospace; + text-align: center; +} + +.wrapper .search { + position: relative; + margin: 35px 0 18px; +} + +.search input { + height: 53px; + width: 100%; + font-size: 16px; + outline: none; + padding: 0 42px; + border: 1px solid #999; + border-radius: 5px; +} +.search input:focus { + padding: 0 41px; + border: 2px solid black; +} + +.search input::placeholder { + color: #b8b8b8; +} +.search :where(i, span) { + position: absolute; + top: 50%; + color: #999; + transform: translateY(-50%); +} + +.search i { + left: 18px; + font-size: 16px; + pointer-events: none; +} +.search input:focus ~ i { + color: rgb(35, 182, 231); +} +.search span { + right: 15px; + font-size: 1; + cursor: pointer; + display: none; +} + +.search input:valid ~ span { + display: block; +} + +.wrapper .info-text { + position: relative; + font-size: 12px; + color: #9a9a9a; + top: -15px; + left: 15px; +} +.wrapper.active .info-text { + display: none; +} +.info-text span { + font-weight: bold; +} + +.wrapper ul li { + display: flex; + margin-bottom: 14px; + padding-bottom: 17px; + border-bottom: 1px solid #ccc; + align-items: center; + justify-content: space-between; +} + +.wrapper ul { + height: 0; + opacity: 0; + overflow: hidden; + transition: all 0.2s ease; +} + +.wrapper.active ul { + height: fit-content; + opacity: 1; +} +ul li:last-child { + margin: 0px; + padding: 0px; + border-bottom: 0px; +} +ul .word p { + font-size: 22px; + font-weight: bold; +} + +ul .word span { + font-size: 12px; + color: #6f6e6e; + font-style: italic; +} + +ul .word i { + cursor: pointer; + font-size: 15px; + color: #999; +} + +.content li .details { + padding-left: 10px; + border-radius: 4px 0 0 4px; + border-left: 3px solid rgb(35, 182, 231); +} + +.content li .details p { + font-size: 17px; + font-weight: bolder; +} +.content li .details span { + font-size: 15px; + font-weight: 500; +} + +.content li .details span { + display: block; + max-height: 45px; + overflow: scroll; +} + +.synonyms .details .list { + display: flex; + flex-wrap: wrap; + gap: 5px; + text-decoration: underline; +} + +.synonyms .details .list span { + cursor: pointer; +} diff --git a/Exchange-Indian-Currency/Exchange.java b/Exchange-Indian-Currency/Exchange.java new file mode 100644 index 00000000..eebfc1ec --- /dev/null +++ b/Exchange-Indian-Currency/Exchange.java @@ -0,0 +1,38 @@ +import java.util.*; + +public class Exchange { + public static void main(String[] args) { + + Scanner sc = new Scanner(System.in); + System.out.print("Enter the amount for Exchange: "); + int V = sc.nextInt(); + exchanger(V); + + sc.close(); + + } + + public static void exchanger(int V) { + int[] coins = { 1, 2, 5, 10, 20, 50, 100, 200, 500, 2000 }; + int[] minCoins = new int[V + 1]; + int[] lastCoin = new int[V + 1]; + + for (int i = 1; i <= V; i++) { + minCoins[i] = Integer.MAX_VALUE; + for (int j = 0; j < coins.length; j++) { + if (coins[j] <= i && minCoins[i - coins[j]] + 1 < minCoins[i]) { + minCoins[i] = minCoins[i - coins[j]] + 1; + lastCoin[i] = coins[j]; + } + } + } + + System.out.println("Minimum number of coins: " + minCoins[V]); + System.out.print("Coins: "); + while (V > 0) { + System.out.print(lastCoin[V] + " "); + V -= lastCoin[V]; + } + System.out.println(); + } +} diff --git a/ExitListener.class b/ExitListener.class new file mode 100644 index 00000000..4be3024b Binary files /dev/null and b/ExitListener.class differ diff --git a/ExitListener.java b/ExitListener.java new file mode 100644 index 00000000..b7dd0b14 --- /dev/null +++ b/ExitListener.java @@ -0,0 +1,10 @@ +import java.awt.*; +import java.awt.event.*; + +public class ExitListener extends WindowAdapter +{ + public void windowClosing(WindowEvent event) + { + System.exit(0); + } +} \ No newline at end of file diff --git a/ExpenseTracker.java b/ExpenseTracker.java new file mode 100644 index 00000000..42b43cd5 --- /dev/null +++ b/ExpenseTracker.java @@ -0,0 +1,74 @@ +import java.util.ArrayList; +import java.util.List; +import java.util.Scanner; + +class Expense { + private String description; + private double amount; + + public Expense(String description, double amount) { + this.description = description; + this.amount = amount; + } + + public String getDescription() { + return description; + } + + public double getAmount() { + return amount; + } + + @Override + public String toString() { + return "Description: " + description + ", Amount: $" + amount; + } +} + +public class ExpenseTracker { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + List expenses = new ArrayList<>(); + double totalExpenses = 0.0; + + while (true) { + System.out.println("Expense Tracker Menu:"); + System.out.println("1. Add an expense"); + System.out.println("2. View expenses"); + System.out.println("3. Exit"); + System.out.print("Select an option (1/2/3): "); + + int option = scanner.nextInt(); + + switch (option) { + case 1: + scanner.nextLine(); // Consume the newline character + System.out.print("Enter expense description: "); + String description = scanner.nextLine(); + System.out.print("Enter expense amount: $"); + double amount = scanner.nextDouble(); + expenses.add(new Expense(description, amount)); + totalExpenses += amount; + System.out.println("Expense added successfully."); + break; + case 2: + if (expenses.isEmpty()) { + System.out.println("No expenses recorded yet."); + } else { + System.out.println("List of Expenses:"); + for (Expense expense : expenses) { + System.out.println(expense); + } + System.out.println("Total Expenses: $" + totalExpenses); + } + break; + case 3: + System.out.println("Exiting the Expense Tracker."); + scanner.close(); + System.exit(0); + default: + System.out.println("Invalid option. Please select 1, 2, or 3."); + } + } + } +} diff --git a/Face Recognition Using Python/Face.py b/Face Recognition Using Python/Face.py new file mode 100644 index 00000000..d4abfb6e --- /dev/null +++ b/Face Recognition Using Python/Face.py @@ -0,0 +1,25 @@ +import cv2 + +cap = cv2.VideoCapture(0) + +face_cascade = cv2.CascadeClassifier( + cv2.data.haarcascades + "haarcascade_frontalface_default.xml") +body_cascade = cv2.CascadeClassifier( + cv2.data.haarcascades + "haarcascade_fullbody.xml") + +while True: + _, frame = cap.read() + + gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) + faces = face_cascade.detectMultiScale(gray, 1.3, 5) + + for (x, y, width, height) in faces: + cv2.rectangle(frame, (x, y), (x + width, y + height), (255, 0, 0), 3) + + cv2.imshow("Camera", frame) + + if cv2.waitKey(1) == ord('q'): + break + +cap.release() +cv2.destroyAllWindows() diff --git a/Factorial.py b/Factorial.py new file mode 100644 index 00000000..60a75d64 --- /dev/null +++ b/Factorial.py @@ -0,0 +1,8 @@ +n=int(input("enter no\n")) +count=n +res=1 +while count>0: + res=res*count + count-=1 + +print("factorial of ",n,"is",res) diff --git a/Factorial_prime_avg.java b/Factorial_prime_avg.java new file mode 100644 index 00000000..9ec2396c --- /dev/null +++ b/Factorial_prime_avg.java @@ -0,0 +1,94 @@ +package calculate; +import java.util.Scanner; +public class lab2 { + + public static void Factorial(int n) + { + int fact = 1; + if(n==0) + return; + for(int i= 1; i<=n; i++) + { + fact = fact*i; + } + System.out.println("Factorial of "+n+" is "+fact+" "); + + } + public static void Average(int n) + { + int sum = 0; + for(int i=0; i<=n; i++) + { + sum = sum + i ; + } + int avg = sum/n; + System.out.println("Sum: "+sum+" "); + System.out.println("Average: "+avg+" "); + } + public static void Prime() + { + int counter = 0; + int i=2; + + for(i=2; i<=50; i++) + { + + for(int j=1; j<=i; j++) + { + if(i%j==0) + counter++; + } + if(counter<=2) + { + System.out.print(i+" "); + counter =0; + } + else + counter=0; + + } + System.out.println(""); + + } + + + public static void main(String[] args) + { + Scanner s = new Scanner(System.in); + int opt,n; + boolean flag = true; + + while(flag) + { + System.out.println("choose a option from following: "); + System.out.println("1. Factorial"); + System.out.println("2. Prime numbers"); + System.out.println("3. Average"); + System.out.println("4 for exit"); + opt = s.nextInt(); + switch(opt) + { + case 1: + System.out.print("Enter number to find factorial: "); + n = s.nextInt(); + Factorial(n); + break; + + case 2: + Prime(); + break; + + case 3: + System.out.print("Enter number of itiration: "); + n = s.nextInt(); + Average(n); + break; + + case 4: + flag = false; + break; + } + } + } + } + diff --git a/Fee Management System/.DS_Store b/Fee Management System/.DS_Store new file mode 100644 index 00000000..b4adbbb5 Binary files /dev/null and b/Fee Management System/.DS_Store differ diff --git a/Fee Management System/WebContent/AccountantLoginForm.html b/Fee Management System/WebContent/AccountantLoginForm.html new file mode 100644 index 00000000..5ba3a8a7 --- /dev/null +++ b/Fee Management System/WebContent/AccountantLoginForm.html @@ -0,0 +1,7 @@ +
+
+ + + +
Email:
Password:
+ \ No newline at end of file diff --git a/Fee Management System/WebContent/AddAccountantForm.html b/Fee Management System/WebContent/AddAccountantForm.html new file mode 100644 index 00000000..1347c722 --- /dev/null +++ b/Fee Management System/WebContent/AddAccountantForm.html @@ -0,0 +1,10 @@ +
+ + + + + + + +
Name:
Password:
Email:
Address:
Contact:
+
\ No newline at end of file diff --git a/Fee Management System/WebContent/AddStudentForm.html b/Fee Management System/WebContent/AddStudentForm.html new file mode 100644 index 00000000..f5865363 --- /dev/null +++ b/Fee Management System/WebContent/AddStudentForm.html @@ -0,0 +1,27 @@ +

Add Student Form

+
+ + + + + + + + + + + +
Name:
Email:
Sex: + Male + Female +
Course: + +
Fee:
Paid:
Due:
Address:
Contact No:
+
diff --git a/Fee Management System/WebContent/AdminLoginForm.html b/Fee Management System/WebContent/AdminLoginForm.html new file mode 100644 index 00000000..6c7bedb7 --- /dev/null +++ b/Fee Management System/WebContent/AdminLoginForm.html @@ -0,0 +1,7 @@ +
+ + + + +
Email:
Password:
+
\ No newline at end of file diff --git a/Fee Management System/WebContent/META-INF/MANIFEST.MF b/Fee Management System/WebContent/META-INF/MANIFEST.MF new file mode 100644 index 00000000..254272e1 --- /dev/null +++ b/Fee Management System/WebContent/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/Fee Management System/WebContent/SearchStudentForm.html b/Fee Management System/WebContent/SearchStudentForm.html new file mode 100644 index 00000000..4380a724 --- /dev/null +++ b/Fee Management System/WebContent/SearchStudentForm.html @@ -0,0 +1,7 @@ +

Search Student Form

+
+ + + +
Rollno:
+
\ No newline at end of file diff --git a/Fee Management System/WebContent/accountanthome.html b/Fee Management System/WebContent/accountanthome.html new file mode 100644 index 00000000..a3c62a0a --- /dev/null +++ b/Fee Management System/WebContent/accountanthome.html @@ -0,0 +1,23 @@ + \ No newline at end of file diff --git a/Fee Management System/WebContent/adminhome.html b/Fee Management System/WebContent/adminhome.html new file mode 100644 index 00000000..bdc4940d --- /dev/null +++ b/Fee Management System/WebContent/adminhome.html @@ -0,0 +1,23 @@ + \ No newline at end of file diff --git a/Fee Management System/WebContent/db.sql b/Fee Management System/WebContent/db.sql new file mode 100644 index 00000000..25ec89ec --- /dev/null +++ b/Fee Management System/WebContent/db.sql @@ -0,0 +1,25 @@ +CREATE TABLE "FEE_STUDENT" + ("ROLLNO" VARCHAR2(4000), + "NAME" VARCHAR2(4000), + "EMAIL" VARCHAR2(4000), + "SEX" VARCHAR2(4000), + "COURSE" VARCHAR2(4000), + "FEE" NUMBER, + "PAID" NUMBER, + "DUE" NUMBER, + "ADDRESS" VARCHAR2(4000), + "CONTACT" VARCHAR2(4000), + CONSTRAINT "FEE_STUDENT_PK" PRIMARY KEY ("ROLLNO") ENABLE + ) +/ + +CREATE TABLE "FEE_ACCOUNTANT" + ( "ID" NUMBER, + "NAME" VARCHAR2(4000), + "EMAIL" VARCHAR2(4000), + "PASSWORD" VARCHAR2(4000), + "ADDRESS" VARCHAR2(4000), + "CONTACT" VARCHAR2(4000), + CONSTRAINT "FEE_ACCOUNTANT_PK" PRIMARY KEY ("ID") ENABLE + ) +/ \ No newline at end of file diff --git a/Fee Management System/WebContent/footer.html b/Fee Management System/WebContent/footer.html new file mode 100644 index 00000000..a4350995 --- /dev/null +++ b/Fee Management System/WebContent/footer.html @@ -0,0 +1,5 @@ + + + diff --git a/Fee Management System/WebContent/index.html b/Fee Management System/WebContent/index.html new file mode 100644 index 00000000..28e7b1ec --- /dev/null +++ b/Fee Management System/WebContent/index.html @@ -0,0 +1,67 @@ + + + + +Fee Report + + + + + + + +
+
+
+

Admin Login Form

+
+ + + + +
Email:
Password:
+
+
+ +
+

Accountant Login Form

+
+ + + + +
Email:
Password:
+
+
+
+ +
+ + + + + + \ No newline at end of file diff --git a/Fee Management System/WebContent/navaccountant.html b/Fee Management System/WebContent/navaccountant.html new file mode 100644 index 00000000..5dc2e149 --- /dev/null +++ b/Fee Management System/WebContent/navaccountant.html @@ -0,0 +1,27 @@ + \ No newline at end of file diff --git a/Fee Management System/WebContent/navadmin.html b/Fee Management System/WebContent/navadmin.html new file mode 100644 index 00000000..57536294 --- /dev/null +++ b/Fee Management System/WebContent/navadmin.html @@ -0,0 +1,26 @@ + \ No newline at end of file diff --git a/Fee Management System/WebContent/navhome.html b/Fee Management System/WebContent/navhome.html new file mode 100644 index 00000000..795375e4 --- /dev/null +++ b/Fee Management System/WebContent/navhome.html @@ -0,0 +1,22 @@ + \ No newline at end of file diff --git a/Fee Management System/WebContent/resources/bootstrap.min.css b/Fee Management System/WebContent/resources/bootstrap.min.css new file mode 100644 index 00000000..4cf729e4 --- /dev/null +++ b/Fee Management System/WebContent/resources/bootstrap.min.css @@ -0,0 +1,6 @@ +/*! + * Bootstrap v3.3.6 (http://getbootstrap.com) + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + *//*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{margin:.67em 0;font-size:2em}mark{color:#000;background:#ff0}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{height:0;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{margin:0;font:inherit;color:inherit}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0}input{line-height:normal}input[type=checkbox],input[type=radio]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:textfield}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{padding:.35em .625em .75em;margin:0 2px;border:1px solid silver}legend{padding:0;border:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-spacing:0;border-collapse:collapse}td,th{padding:0}/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */@media print{*,:after,:before{color:#000!important;text-shadow:none!important;background:0 0!important;-webkit-box-shadow:none!important;box-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}a[href^="javascript:"]:after,a[href^="#"]:after{content:""}blockquote,pre{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}img,tr{page-break-inside:avoid}img{max-width:100%!important}h2,h3,p{orphans:3;widows:3}h2,h3{page-break-after:avoid}.navbar{display:none}.btn>.caret,.dropup>.btn>.caret{border-top-color:#000!important}.label{border:1px solid #000}.table{border-collapse:collapse!important}.table td,.table th{background-color:#fff!important}.table-bordered td,.table-bordered th{border:1px solid #ddd!important}}@font-face{font-family:'Glyphicons Halflings';src:url(../fonts/glyphicons-halflings-regular.eot);src:url(../fonts/glyphicons-halflings-regular.eot?#iefix) format('embedded-opentype'),url(../fonts/glyphicons-halflings-regular.woff2) format('woff2'),url(../fonts/glyphicons-halflings-regular.woff) format('woff'),url(../fonts/glyphicons-halflings-regular.ttf) format('truetype'),url(../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular) format('svg')}.glyphicon{position:relative;top:1px;display:inline-block;font-family:'Glyphicons Halflings';font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.glyphicon-asterisk:before{content:"\002a"}.glyphicon-plus:before{content:"\002b"}.glyphicon-eur:before,.glyphicon-euro:before{content:"\20ac"}.glyphicon-minus:before{content:"\2212"}.glyphicon-cloud:before{content:"\2601"}.glyphicon-envelope:before{content:"\2709"}.glyphicon-pencil:before{content:"\270f"}.glyphicon-glass:before{content:"\e001"}.glyphicon-music:before{content:"\e002"}.glyphicon-search:before{content:"\e003"}.glyphicon-heart:before{content:"\e005"}.glyphicon-star:before{content:"\e006"}.glyphicon-star-empty:before{content:"\e007"}.glyphicon-user:before{content:"\e008"}.glyphicon-film:before{content:"\e009"}.glyphicon-th-large:before{content:"\e010"}.glyphicon-th:before{content:"\e011"}.glyphicon-th-list:before{content:"\e012"}.glyphicon-ok:before{content:"\e013"}.glyphicon-remove:before{content:"\e014"}.glyphicon-zoom-in:before{content:"\e015"}.glyphicon-zoom-out:before{content:"\e016"}.glyphicon-off:before{content:"\e017"}.glyphicon-signal:before{content:"\e018"}.glyphicon-cog:before{content:"\e019"}.glyphicon-trash:before{content:"\e020"}.glyphicon-home:before{content:"\e021"}.glyphicon-file:before{content:"\e022"}.glyphicon-time:before{content:"\e023"}.glyphicon-road:before{content:"\e024"}.glyphicon-download-alt:before{content:"\e025"}.glyphicon-download:before{content:"\e026"}.glyphicon-upload:before{content:"\e027"}.glyphicon-inbox:before{content:"\e028"}.glyphicon-play-circle:before{content:"\e029"}.glyphicon-repeat:before{content:"\e030"}.glyphicon-refresh:before{content:"\e031"}.glyphicon-list-alt:before{content:"\e032"}.glyphicon-lock:before{content:"\e033"}.glyphicon-flag:before{content:"\e034"}.glyphicon-headphones:before{content:"\e035"}.glyphicon-volume-off:before{content:"\e036"}.glyphicon-volume-down:before{content:"\e037"}.glyphicon-volume-up:before{content:"\e038"}.glyphicon-qrcode:before{content:"\e039"}.glyphicon-barcode:before{content:"\e040"}.glyphicon-tag:before{content:"\e041"}.glyphicon-tags:before{content:"\e042"}.glyphicon-book:before{content:"\e043"}.glyphicon-bookmark:before{content:"\e044"}.glyphicon-print:before{content:"\e045"}.glyphicon-camera:before{content:"\e046"}.glyphicon-font:before{content:"\e047"}.glyphicon-bold:before{content:"\e048"}.glyphicon-italic:before{content:"\e049"}.glyphicon-text-height:before{content:"\e050"}.glyphicon-text-width:before{content:"\e051"}.glyphicon-align-left:before{content:"\e052"}.glyphicon-align-center:before{content:"\e053"}.glyphicon-align-right:before{content:"\e054"}.glyphicon-align-justify:before{content:"\e055"}.glyphicon-list:before{content:"\e056"}.glyphicon-indent-left:before{content:"\e057"}.glyphicon-indent-right:before{content:"\e058"}.glyphicon-facetime-video:before{content:"\e059"}.glyphicon-picture:before{content:"\e060"}.glyphicon-map-marker:before{content:"\e062"}.glyphicon-adjust:before{content:"\e063"}.glyphicon-tint:before{content:"\e064"}.glyphicon-edit:before{content:"\e065"}.glyphicon-share:before{content:"\e066"}.glyphicon-check:before{content:"\e067"}.glyphicon-move:before{content:"\e068"}.glyphicon-step-backward:before{content:"\e069"}.glyphicon-fast-backward:before{content:"\e070"}.glyphicon-backward:before{content:"\e071"}.glyphicon-play:before{content:"\e072"}.glyphicon-pause:before{content:"\e073"}.glyphicon-stop:before{content:"\e074"}.glyphicon-forward:before{content:"\e075"}.glyphicon-fast-forward:before{content:"\e076"}.glyphicon-step-forward:before{content:"\e077"}.glyphicon-eject:before{content:"\e078"}.glyphicon-chevron-left:before{content:"\e079"}.glyphicon-chevron-right:before{content:"\e080"}.glyphicon-plus-sign:before{content:"\e081"}.glyphicon-minus-sign:before{content:"\e082"}.glyphicon-remove-sign:before{content:"\e083"}.glyphicon-ok-sign:before{content:"\e084"}.glyphicon-question-sign:before{content:"\e085"}.glyphicon-info-sign:before{content:"\e086"}.glyphicon-screenshot:before{content:"\e087"}.glyphicon-remove-circle:before{content:"\e088"}.glyphicon-ok-circle:before{content:"\e089"}.glyphicon-ban-circle:before{content:"\e090"}.glyphicon-arrow-left:before{content:"\e091"}.glyphicon-arrow-right:before{content:"\e092"}.glyphicon-arrow-up:before{content:"\e093"}.glyphicon-arrow-down:before{content:"\e094"}.glyphicon-share-alt:before{content:"\e095"}.glyphicon-resize-full:before{content:"\e096"}.glyphicon-resize-small:before{content:"\e097"}.glyphicon-exclamation-sign:before{content:"\e101"}.glyphicon-gift:before{content:"\e102"}.glyphicon-leaf:before{content:"\e103"}.glyphicon-fire:before{content:"\e104"}.glyphicon-eye-open:before{content:"\e105"}.glyphicon-eye-close:before{content:"\e106"}.glyphicon-warning-sign:before{content:"\e107"}.glyphicon-plane:before{content:"\e108"}.glyphicon-calendar:before{content:"\e109"}.glyphicon-random:before{content:"\e110"}.glyphicon-comment:before{content:"\e111"}.glyphicon-magnet:before{content:"\e112"}.glyphicon-chevron-up:before{content:"\e113"}.glyphicon-chevron-down:before{content:"\e114"}.glyphicon-retweet:before{content:"\e115"}.glyphicon-shopping-cart:before{content:"\e116"}.glyphicon-folder-close:before{content:"\e117"}.glyphicon-folder-open:before{content:"\e118"}.glyphicon-resize-vertical:before{content:"\e119"}.glyphicon-resize-horizontal:before{content:"\e120"}.glyphicon-hdd:before{content:"\e121"}.glyphicon-bullhorn:before{content:"\e122"}.glyphicon-bell:before{content:"\e123"}.glyphicon-certificate:before{content:"\e124"}.glyphicon-thumbs-up:before{content:"\e125"}.glyphicon-thumbs-down:before{content:"\e126"}.glyphicon-hand-right:before{content:"\e127"}.glyphicon-hand-left:before{content:"\e128"}.glyphicon-hand-up:before{content:"\e129"}.glyphicon-hand-down:before{content:"\e130"}.glyphicon-circle-arrow-right:before{content:"\e131"}.glyphicon-circle-arrow-left:before{content:"\e132"}.glyphicon-circle-arrow-up:before{content:"\e133"}.glyphicon-circle-arrow-down:before{content:"\e134"}.glyphicon-globe:before{content:"\e135"}.glyphicon-wrench:before{content:"\e136"}.glyphicon-tasks:before{content:"\e137"}.glyphicon-filter:before{content:"\e138"}.glyphicon-briefcase:before{content:"\e139"}.glyphicon-fullscreen:before{content:"\e140"}.glyphicon-dashboard:before{content:"\e141"}.glyphicon-paperclip:before{content:"\e142"}.glyphicon-heart-empty:before{content:"\e143"}.glyphicon-link:before{content:"\e144"}.glyphicon-phone:before{content:"\e145"}.glyphicon-pushpin:before{content:"\e146"}.glyphicon-usd:before{content:"\e148"}.glyphicon-gbp:before{content:"\e149"}.glyphicon-sort:before{content:"\e150"}.glyphicon-sort-by-alphabet:before{content:"\e151"}.glyphicon-sort-by-alphabet-alt:before{content:"\e152"}.glyphicon-sort-by-order:before{content:"\e153"}.glyphicon-sort-by-order-alt:before{content:"\e154"}.glyphicon-sort-by-attributes:before{content:"\e155"}.glyphicon-sort-by-attributes-alt:before{content:"\e156"}.glyphicon-unchecked:before{content:"\e157"}.glyphicon-expand:before{content:"\e158"}.glyphicon-collapse-down:before{content:"\e159"}.glyphicon-collapse-up:before{content:"\e160"}.glyphicon-log-in:before{content:"\e161"}.glyphicon-flash:before{content:"\e162"}.glyphicon-log-out:before{content:"\e163"}.glyphicon-new-window:before{content:"\e164"}.glyphicon-record:before{content:"\e165"}.glyphicon-save:before{content:"\e166"}.glyphicon-open:before{content:"\e167"}.glyphicon-saved:before{content:"\e168"}.glyphicon-import:before{content:"\e169"}.glyphicon-export:before{content:"\e170"}.glyphicon-send:before{content:"\e171"}.glyphicon-floppy-disk:before{content:"\e172"}.glyphicon-floppy-saved:before{content:"\e173"}.glyphicon-floppy-remove:before{content:"\e174"}.glyphicon-floppy-save:before{content:"\e175"}.glyphicon-floppy-open:before{content:"\e176"}.glyphicon-credit-card:before{content:"\e177"}.glyphicon-transfer:before{content:"\e178"}.glyphicon-cutlery:before{content:"\e179"}.glyphicon-header:before{content:"\e180"}.glyphicon-compressed:before{content:"\e181"}.glyphicon-earphone:before{content:"\e182"}.glyphicon-phone-alt:before{content:"\e183"}.glyphicon-tower:before{content:"\e184"}.glyphicon-stats:before{content:"\e185"}.glyphicon-sd-video:before{content:"\e186"}.glyphicon-hd-video:before{content:"\e187"}.glyphicon-subtitles:before{content:"\e188"}.glyphicon-sound-stereo:before{content:"\e189"}.glyphicon-sound-dolby:before{content:"\e190"}.glyphicon-sound-5-1:before{content:"\e191"}.glyphicon-sound-6-1:before{content:"\e192"}.glyphicon-sound-7-1:before{content:"\e193"}.glyphicon-copyright-mark:before{content:"\e194"}.glyphicon-registration-mark:before{content:"\e195"}.glyphicon-cloud-download:before{content:"\e197"}.glyphicon-cloud-upload:before{content:"\e198"}.glyphicon-tree-conifer:before{content:"\e199"}.glyphicon-tree-deciduous:before{content:"\e200"}.glyphicon-cd:before{content:"\e201"}.glyphicon-save-file:before{content:"\e202"}.glyphicon-open-file:before{content:"\e203"}.glyphicon-level-up:before{content:"\e204"}.glyphicon-copy:before{content:"\e205"}.glyphicon-paste:before{content:"\e206"}.glyphicon-alert:before{content:"\e209"}.glyphicon-equalizer:before{content:"\e210"}.glyphicon-king:before{content:"\e211"}.glyphicon-queen:before{content:"\e212"}.glyphicon-pawn:before{content:"\e213"}.glyphicon-bishop:before{content:"\e214"}.glyphicon-knight:before{content:"\e215"}.glyphicon-baby-formula:before{content:"\e216"}.glyphicon-tent:before{content:"\26fa"}.glyphicon-blackboard:before{content:"\e218"}.glyphicon-bed:before{content:"\e219"}.glyphicon-apple:before{content:"\f8ff"}.glyphicon-erase:before{content:"\e221"}.glyphicon-hourglass:before{content:"\231b"}.glyphicon-lamp:before{content:"\e223"}.glyphicon-duplicate:before{content:"\e224"}.glyphicon-piggy-bank:before{content:"\e225"}.glyphicon-scissors:before{content:"\e226"}.glyphicon-bitcoin:before{content:"\e227"}.glyphicon-btc:before{content:"\e227"}.glyphicon-xbt:before{content:"\e227"}.glyphicon-yen:before{content:"\00a5"}.glyphicon-jpy:before{content:"\00a5"}.glyphicon-ruble:before{content:"\20bd"}.glyphicon-rub:before{content:"\20bd"}.glyphicon-scale:before{content:"\e230"}.glyphicon-ice-lolly:before{content:"\e231"}.glyphicon-ice-lolly-tasted:before{content:"\e232"}.glyphicon-education:before{content:"\e233"}.glyphicon-option-horizontal:before{content:"\e234"}.glyphicon-option-vertical:before{content:"\e235"}.glyphicon-menu-hamburger:before{content:"\e236"}.glyphicon-modal-window:before{content:"\e237"}.glyphicon-oil:before{content:"\e238"}.glyphicon-grain:before{content:"\e239"}.glyphicon-sunglasses:before{content:"\e240"}.glyphicon-text-size:before{content:"\e241"}.glyphicon-text-color:before{content:"\e242"}.glyphicon-text-background:before{content:"\e243"}.glyphicon-object-align-top:before{content:"\e244"}.glyphicon-object-align-bottom:before{content:"\e245"}.glyphicon-object-align-horizontal:before{content:"\e246"}.glyphicon-object-align-left:before{content:"\e247"}.glyphicon-object-align-vertical:before{content:"\e248"}.glyphicon-object-align-right:before{content:"\e249"}.glyphicon-triangle-right:before{content:"\e250"}.glyphicon-triangle-left:before{content:"\e251"}.glyphicon-triangle-bottom:before{content:"\e252"}.glyphicon-triangle-top:before{content:"\e253"}.glyphicon-console:before{content:"\e254"}.glyphicon-superscript:before{content:"\e255"}.glyphicon-subscript:before{content:"\e256"}.glyphicon-menu-left:before{content:"\e257"}.glyphicon-menu-right:before{content:"\e258"}.glyphicon-menu-down:before{content:"\e259"}.glyphicon-menu-up:before{content:"\e260"}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}:after,:before{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html{font-size:10px;-webkit-tap-highlight-color:rgba(0,0,0,0)}body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.42857143;color:#333;background-color:#fff}button,input,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit}a{color:#337ab7;text-decoration:none}a:focus,a:hover{color:#23527c;text-decoration:underline}a:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}figure{margin:0}img{vertical-align:middle}.carousel-inner>.item>a>img,.carousel-inner>.item>img,.img-responsive,.thumbnail a>img,.thumbnail>img{display:block;max-width:100%;height:auto}.img-rounded{border-radius:6px}.img-thumbnail{display:inline-block;max-width:100%;height:auto;padding:4px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.img-circle{border-radius:50%}hr{margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}[role=button]{cursor:pointer}.h1,.h2,.h3,.h4,.h5,.h6,h1,h2,h3,h4,h5,h6{font-family:inherit;font-weight:500;line-height:1.1;color:inherit}.h1 .small,.h1 small,.h2 .small,.h2 small,.h3 .small,.h3 small,.h4 .small,.h4 small,.h5 .small,.h5 small,.h6 .small,.h6 small,h1 .small,h1 small,h2 .small,h2 small,h3 .small,h3 small,h4 .small,h4 small,h5 .small,h5 small,h6 .small,h6 small{font-weight:400;line-height:1;color:#777}.h1,.h2,.h3,h1,h2,h3{margin-top:20px;margin-bottom:10px}.h1 .small,.h1 small,.h2 .small,.h2 small,.h3 .small,.h3 small,h1 .small,h1 small,h2 .small,h2 small,h3 .small,h3 small{font-size:65%}.h4,.h5,.h6,h4,h5,h6{margin-top:10px;margin-bottom:10px}.h4 .small,.h4 small,.h5 .small,.h5 small,.h6 .small,.h6 small,h4 .small,h4 small,h5 .small,h5 small,h6 .small,h6 small{font-size:75%}.h1,h1{font-size:36px}.h2,h2{font-size:30px}.h3,h3{font-size:24px}.h4,h4{font-size:18px}.h5,h5{font-size:14px}.h6,h6{font-size:12px}p{margin:0 0 10px}.lead{margin-bottom:20px;font-size:16px;font-weight:300;line-height:1.4}@media (min-width:768px){.lead{font-size:21px}}.small,small{font-size:85%}.mark,mark{padding:.2em;background-color:#fcf8e3}.text-left{text-align:left}.text-right{text-align:right}.text-center{text-align:center}.text-justify{text-align:justify}.text-nowrap{white-space:nowrap}.text-lowercase{text-transform:lowercase}.text-uppercase{text-transform:uppercase}.text-capitalize{text-transform:capitalize}.text-muted{color:#777}.text-primary{color:#337ab7}a.text-primary:focus,a.text-primary:hover{color:#286090}.text-success{color:#3c763d}a.text-success:focus,a.text-success:hover{color:#2b542c}.text-info{color:#31708f}a.text-info:focus,a.text-info:hover{color:#245269}.text-warning{color:#8a6d3b}a.text-warning:focus,a.text-warning:hover{color:#66512c}.text-danger{color:#a94442}a.text-danger:focus,a.text-danger:hover{color:#843534}.bg-primary{color:#fff;background-color:#337ab7}a.bg-primary:focus,a.bg-primary:hover{background-color:#286090}.bg-success{background-color:#dff0d8}a.bg-success:focus,a.bg-success:hover{background-color:#c1e2b3}.bg-info{background-color:#d9edf7}a.bg-info:focus,a.bg-info:hover{background-color:#afd9ee}.bg-warning{background-color:#fcf8e3}a.bg-warning:focus,a.bg-warning:hover{background-color:#f7ecb5}.bg-danger{background-color:#f2dede}a.bg-danger:focus,a.bg-danger:hover{background-color:#e4b9b9}.page-header{padding-bottom:9px;margin:40px 0 20px;border-bottom:1px solid #eee}ol,ul{margin-top:0;margin-bottom:10px}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}.list-unstyled{padding-left:0;list-style:none}.list-inline{padding-left:0;margin-left:-5px;list-style:none}.list-inline>li{display:inline-block;padding-right:5px;padding-left:5px}dl{margin-top:0;margin-bottom:20px}dd,dt{line-height:1.42857143}dt{font-weight:700}dd{margin-left:0}@media (min-width:768px){.dl-horizontal dt{float:left;width:160px;overflow:hidden;clear:left;text-align:right;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}}abbr[data-original-title],abbr[title]{cursor:help;border-bottom:1px dotted #777}.initialism{font-size:90%;text-transform:uppercase}blockquote{padding:10px 20px;margin:0 0 20px;font-size:17.5px;border-left:5px solid #eee}blockquote ol:last-child,blockquote p:last-child,blockquote ul:last-child{margin-bottom:0}blockquote .small,blockquote footer,blockquote small{display:block;font-size:80%;line-height:1.42857143;color:#777}blockquote .small:before,blockquote footer:before,blockquote small:before{content:'\2014 \00A0'}.blockquote-reverse,blockquote.pull-right{padding-right:15px;padding-left:0;text-align:right;border-right:5px solid #eee;border-left:0}.blockquote-reverse .small:before,.blockquote-reverse footer:before,.blockquote-reverse small:before,blockquote.pull-right .small:before,blockquote.pull-right footer:before,blockquote.pull-right small:before{content:''}.blockquote-reverse .small:after,.blockquote-reverse footer:after,.blockquote-reverse small:after,blockquote.pull-right .small:after,blockquote.pull-right footer:after,blockquote.pull-right small:after{content:'\00A0 \2014'}address{margin-bottom:20px;font-style:normal;line-height:1.42857143}code,kbd,pre,samp{font-family:Menlo,Monaco,Consolas,"Courier New",monospace}code{padding:2px 4px;font-size:90%;color:#c7254e;background-color:#f9f2f4;border-radius:4px}kbd{padding:2px 4px;font-size:90%;color:#fff;background-color:#333;border-radius:3px;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.25);box-shadow:inset 0 -1px 0 rgba(0,0,0,.25)}kbd kbd{padding:0;font-size:100%;font-weight:700;-webkit-box-shadow:none;box-shadow:none}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:1.42857143;color:#333;word-break:break-all;word-wrap:break-word;background-color:#f5f5f5;border:1px solid #ccc;border-radius:4px}pre code{padding:0;font-size:inherit;color:inherit;white-space:pre-wrap;background-color:transparent;border-radius:0}.pre-scrollable{max-height:340px;overflow-y:scroll}.container{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}@media (min-width:768px){.container{width:750px}}@media (min-width:992px){.container{width:970px}}@media (min-width:1200px){.container{width:1170px}}.container-fluid{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}.row{margin-right:-15px;margin-left:-15px}.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{position:relative;min-height:1px;padding-right:15px;padding-left:15px}.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{float:left}.col-xs-12{width:100%}.col-xs-11{width:91.66666667%}.col-xs-10{width:83.33333333%}.col-xs-9{width:75%}.col-xs-8{width:66.66666667%}.col-xs-7{width:58.33333333%}.col-xs-6{width:50%}.col-xs-5{width:41.66666667%}.col-xs-4{width:33.33333333%}.col-xs-3{width:25%}.col-xs-2{width:16.66666667%}.col-xs-1{width:8.33333333%}.col-xs-pull-12{right:100%}.col-xs-pull-11{right:91.66666667%}.col-xs-pull-10{right:83.33333333%}.col-xs-pull-9{right:75%}.col-xs-pull-8{right:66.66666667%}.col-xs-pull-7{right:58.33333333%}.col-xs-pull-6{right:50%}.col-xs-pull-5{right:41.66666667%}.col-xs-pull-4{right:33.33333333%}.col-xs-pull-3{right:25%}.col-xs-pull-2{right:16.66666667%}.col-xs-pull-1{right:8.33333333%}.col-xs-pull-0{right:auto}.col-xs-push-12{left:100%}.col-xs-push-11{left:91.66666667%}.col-xs-push-10{left:83.33333333%}.col-xs-push-9{left:75%}.col-xs-push-8{left:66.66666667%}.col-xs-push-7{left:58.33333333%}.col-xs-push-6{left:50%}.col-xs-push-5{left:41.66666667%}.col-xs-push-4{left:33.33333333%}.col-xs-push-3{left:25%}.col-xs-push-2{left:16.66666667%}.col-xs-push-1{left:8.33333333%}.col-xs-push-0{left:auto}.col-xs-offset-12{margin-left:100%}.col-xs-offset-11{margin-left:91.66666667%}.col-xs-offset-10{margin-left:83.33333333%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-8{margin-left:66.66666667%}.col-xs-offset-7{margin-left:58.33333333%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-5{margin-left:41.66666667%}.col-xs-offset-4{margin-left:33.33333333%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-2{margin-left:16.66666667%}.col-xs-offset-1{margin-left:8.33333333%}.col-xs-offset-0{margin-left:0}@media (min-width:768px){.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9{float:left}.col-sm-12{width:100%}.col-sm-11{width:91.66666667%}.col-sm-10{width:83.33333333%}.col-sm-9{width:75%}.col-sm-8{width:66.66666667%}.col-sm-7{width:58.33333333%}.col-sm-6{width:50%}.col-sm-5{width:41.66666667%}.col-sm-4{width:33.33333333%}.col-sm-3{width:25%}.col-sm-2{width:16.66666667%}.col-sm-1{width:8.33333333%}.col-sm-pull-12{right:100%}.col-sm-pull-11{right:91.66666667%}.col-sm-pull-10{right:83.33333333%}.col-sm-pull-9{right:75%}.col-sm-pull-8{right:66.66666667%}.col-sm-pull-7{right:58.33333333%}.col-sm-pull-6{right:50%}.col-sm-pull-5{right:41.66666667%}.col-sm-pull-4{right:33.33333333%}.col-sm-pull-3{right:25%}.col-sm-pull-2{right:16.66666667%}.col-sm-pull-1{right:8.33333333%}.col-sm-pull-0{right:auto}.col-sm-push-12{left:100%}.col-sm-push-11{left:91.66666667%}.col-sm-push-10{left:83.33333333%}.col-sm-push-9{left:75%}.col-sm-push-8{left:66.66666667%}.col-sm-push-7{left:58.33333333%}.col-sm-push-6{left:50%}.col-sm-push-5{left:41.66666667%}.col-sm-push-4{left:33.33333333%}.col-sm-push-3{left:25%}.col-sm-push-2{left:16.66666667%}.col-sm-push-1{left:8.33333333%}.col-sm-push-0{left:auto}.col-sm-offset-12{margin-left:100%}.col-sm-offset-11{margin-left:91.66666667%}.col-sm-offset-10{margin-left:83.33333333%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-8{margin-left:66.66666667%}.col-sm-offset-7{margin-left:58.33333333%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-5{margin-left:41.66666667%}.col-sm-offset-4{margin-left:33.33333333%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-2{margin-left:16.66666667%}.col-sm-offset-1{margin-left:8.33333333%}.col-sm-offset-0{margin-left:0}}@media (min-width:992px){.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9{float:left}.col-md-12{width:100%}.col-md-11{width:91.66666667%}.col-md-10{width:83.33333333%}.col-md-9{width:75%}.col-md-8{width:66.66666667%}.col-md-7{width:58.33333333%}.col-md-6{width:50%}.col-md-5{width:41.66666667%}.col-md-4{width:33.33333333%}.col-md-3{width:25%}.col-md-2{width:16.66666667%}.col-md-1{width:8.33333333%}.col-md-pull-12{right:100%}.col-md-pull-11{right:91.66666667%}.col-md-pull-10{right:83.33333333%}.col-md-pull-9{right:75%}.col-md-pull-8{right:66.66666667%}.col-md-pull-7{right:58.33333333%}.col-md-pull-6{right:50%}.col-md-pull-5{right:41.66666667%}.col-md-pull-4{right:33.33333333%}.col-md-pull-3{right:25%}.col-md-pull-2{right:16.66666667%}.col-md-pull-1{right:8.33333333%}.col-md-pull-0{right:auto}.col-md-push-12{left:100%}.col-md-push-11{left:91.66666667%}.col-md-push-10{left:83.33333333%}.col-md-push-9{left:75%}.col-md-push-8{left:66.66666667%}.col-md-push-7{left:58.33333333%}.col-md-push-6{left:50%}.col-md-push-5{left:41.66666667%}.col-md-push-4{left:33.33333333%}.col-md-push-3{left:25%}.col-md-push-2{left:16.66666667%}.col-md-push-1{left:8.33333333%}.col-md-push-0{left:auto}.col-md-offset-12{margin-left:100%}.col-md-offset-11{margin-left:91.66666667%}.col-md-offset-10{margin-left:83.33333333%}.col-md-offset-9{margin-left:75%}.col-md-offset-8{margin-left:66.66666667%}.col-md-offset-7{margin-left:58.33333333%}.col-md-offset-6{margin-left:50%}.col-md-offset-5{margin-left:41.66666667%}.col-md-offset-4{margin-left:33.33333333%}.col-md-offset-3{margin-left:25%}.col-md-offset-2{margin-left:16.66666667%}.col-md-offset-1{margin-left:8.33333333%}.col-md-offset-0{margin-left:0}}@media (min-width:1200px){.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9{float:left}.col-lg-12{width:100%}.col-lg-11{width:91.66666667%}.col-lg-10{width:83.33333333%}.col-lg-9{width:75%}.col-lg-8{width:66.66666667%}.col-lg-7{width:58.33333333%}.col-lg-6{width:50%}.col-lg-5{width:41.66666667%}.col-lg-4{width:33.33333333%}.col-lg-3{width:25%}.col-lg-2{width:16.66666667%}.col-lg-1{width:8.33333333%}.col-lg-pull-12{right:100%}.col-lg-pull-11{right:91.66666667%}.col-lg-pull-10{right:83.33333333%}.col-lg-pull-9{right:75%}.col-lg-pull-8{right:66.66666667%}.col-lg-pull-7{right:58.33333333%}.col-lg-pull-6{right:50%}.col-lg-pull-5{right:41.66666667%}.col-lg-pull-4{right:33.33333333%}.col-lg-pull-3{right:25%}.col-lg-pull-2{right:16.66666667%}.col-lg-pull-1{right:8.33333333%}.col-lg-pull-0{right:auto}.col-lg-push-12{left:100%}.col-lg-push-11{left:91.66666667%}.col-lg-push-10{left:83.33333333%}.col-lg-push-9{left:75%}.col-lg-push-8{left:66.66666667%}.col-lg-push-7{left:58.33333333%}.col-lg-push-6{left:50%}.col-lg-push-5{left:41.66666667%}.col-lg-push-4{left:33.33333333%}.col-lg-push-3{left:25%}.col-lg-push-2{left:16.66666667%}.col-lg-push-1{left:8.33333333%}.col-lg-push-0{left:auto}.col-lg-offset-12{margin-left:100%}.col-lg-offset-11{margin-left:91.66666667%}.col-lg-offset-10{margin-left:83.33333333%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-8{margin-left:66.66666667%}.col-lg-offset-7{margin-left:58.33333333%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-5{margin-left:41.66666667%}.col-lg-offset-4{margin-left:33.33333333%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-2{margin-left:16.66666667%}.col-lg-offset-1{margin-left:8.33333333%}.col-lg-offset-0{margin-left:0}}table{background-color:transparent}caption{padding-top:8px;padding-bottom:8px;color:#777;text-align:left}th{text-align:left}.table{width:100%;max-width:100%;margin-bottom:20px}.table>tbody>tr>td,.table>tbody>tr>th,.table>tfoot>tr>td,.table>tfoot>tr>th,.table>thead>tr>td,.table>thead>tr>th{padding:8px;line-height:1.42857143;vertical-align:top;border-top:1px solid #ddd}.table>thead>tr>th{vertical-align:bottom;border-bottom:2px solid #ddd}.table>caption+thead>tr:first-child>td,.table>caption+thead>tr:first-child>th,.table>colgroup+thead>tr:first-child>td,.table>colgroup+thead>tr:first-child>th,.table>thead:first-child>tr:first-child>td,.table>thead:first-child>tr:first-child>th{border-top:0}.table>tbody+tbody{border-top:2px solid #ddd}.table .table{background-color:#fff}.table-condensed>tbody>tr>td,.table-condensed>tbody>tr>th,.table-condensed>tfoot>tr>td,.table-condensed>tfoot>tr>th,.table-condensed>thead>tr>td,.table-condensed>thead>tr>th{padding:5px}.table-bordered{border:1px solid #ddd}.table-bordered>tbody>tr>td,.table-bordered>tbody>tr>th,.table-bordered>tfoot>tr>td,.table-bordered>tfoot>tr>th,.table-bordered>thead>tr>td,.table-bordered>thead>tr>th{border:1px solid #ddd}.table-bordered>thead>tr>td,.table-bordered>thead>tr>th{border-bottom-width:2px}.table-striped>tbody>tr:nth-of-type(odd){background-color:#f9f9f9}.table-hover>tbody>tr:hover{background-color:#f5f5f5}table col[class*=col-]{position:static;display:table-column;float:none}table td[class*=col-],table th[class*=col-]{position:static;display:table-cell;float:none}.table>tbody>tr.active>td,.table>tbody>tr.active>th,.table>tbody>tr>td.active,.table>tbody>tr>th.active,.table>tfoot>tr.active>td,.table>tfoot>tr.active>th,.table>tfoot>tr>td.active,.table>tfoot>tr>th.active,.table>thead>tr.active>td,.table>thead>tr.active>th,.table>thead>tr>td.active,.table>thead>tr>th.active{background-color:#f5f5f5}.table-hover>tbody>tr.active:hover>td,.table-hover>tbody>tr.active:hover>th,.table-hover>tbody>tr:hover>.active,.table-hover>tbody>tr>td.active:hover,.table-hover>tbody>tr>th.active:hover{background-color:#e8e8e8}.table>tbody>tr.success>td,.table>tbody>tr.success>th,.table>tbody>tr>td.success,.table>tbody>tr>th.success,.table>tfoot>tr.success>td,.table>tfoot>tr.success>th,.table>tfoot>tr>td.success,.table>tfoot>tr>th.success,.table>thead>tr.success>td,.table>thead>tr.success>th,.table>thead>tr>td.success,.table>thead>tr>th.success{background-color:#dff0d8}.table-hover>tbody>tr.success:hover>td,.table-hover>tbody>tr.success:hover>th,.table-hover>tbody>tr:hover>.success,.table-hover>tbody>tr>td.success:hover,.table-hover>tbody>tr>th.success:hover{background-color:#d0e9c6}.table>tbody>tr.info>td,.table>tbody>tr.info>th,.table>tbody>tr>td.info,.table>tbody>tr>th.info,.table>tfoot>tr.info>td,.table>tfoot>tr.info>th,.table>tfoot>tr>td.info,.table>tfoot>tr>th.info,.table>thead>tr.info>td,.table>thead>tr.info>th,.table>thead>tr>td.info,.table>thead>tr>th.info{background-color:#d9edf7}.table-hover>tbody>tr.info:hover>td,.table-hover>tbody>tr.info:hover>th,.table-hover>tbody>tr:hover>.info,.table-hover>tbody>tr>td.info:hover,.table-hover>tbody>tr>th.info:hover{background-color:#c4e3f3}.table>tbody>tr.warning>td,.table>tbody>tr.warning>th,.table>tbody>tr>td.warning,.table>tbody>tr>th.warning,.table>tfoot>tr.warning>td,.table>tfoot>tr.warning>th,.table>tfoot>tr>td.warning,.table>tfoot>tr>th.warning,.table>thead>tr.warning>td,.table>thead>tr.warning>th,.table>thead>tr>td.warning,.table>thead>tr>th.warning{background-color:#fcf8e3}.table-hover>tbody>tr.warning:hover>td,.table-hover>tbody>tr.warning:hover>th,.table-hover>tbody>tr:hover>.warning,.table-hover>tbody>tr>td.warning:hover,.table-hover>tbody>tr>th.warning:hover{background-color:#faf2cc}.table>tbody>tr.danger>td,.table>tbody>tr.danger>th,.table>tbody>tr>td.danger,.table>tbody>tr>th.danger,.table>tfoot>tr.danger>td,.table>tfoot>tr.danger>th,.table>tfoot>tr>td.danger,.table>tfoot>tr>th.danger,.table>thead>tr.danger>td,.table>thead>tr.danger>th,.table>thead>tr>td.danger,.table>thead>tr>th.danger{background-color:#f2dede}.table-hover>tbody>tr.danger:hover>td,.table-hover>tbody>tr.danger:hover>th,.table-hover>tbody>tr:hover>.danger,.table-hover>tbody>tr>td.danger:hover,.table-hover>tbody>tr>th.danger:hover{background-color:#ebcccc}.table-responsive{min-height:.01%;overflow-x:auto}@media screen and (max-width:767px){.table-responsive{width:100%;margin-bottom:15px;overflow-y:hidden;-ms-overflow-style:-ms-autohiding-scrollbar;border:1px solid #ddd}.table-responsive>.table{margin-bottom:0}.table-responsive>.table>tbody>tr>td,.table-responsive>.table>tbody>tr>th,.table-responsive>.table>tfoot>tr>td,.table-responsive>.table>tfoot>tr>th,.table-responsive>.table>thead>tr>td,.table-responsive>.table>thead>tr>th{white-space:nowrap}.table-responsive>.table-bordered{border:0}.table-responsive>.table-bordered>tbody>tr>td:first-child,.table-responsive>.table-bordered>tbody>tr>th:first-child,.table-responsive>.table-bordered>tfoot>tr>td:first-child,.table-responsive>.table-bordered>tfoot>tr>th:first-child,.table-responsive>.table-bordered>thead>tr>td:first-child,.table-responsive>.table-bordered>thead>tr>th:first-child{border-left:0}.table-responsive>.table-bordered>tbody>tr>td:last-child,.table-responsive>.table-bordered>tbody>tr>th:last-child,.table-responsive>.table-bordered>tfoot>tr>td:last-child,.table-responsive>.table-bordered>tfoot>tr>th:last-child,.table-responsive>.table-bordered>thead>tr>td:last-child,.table-responsive>.table-bordered>thead>tr>th:last-child{border-right:0}.table-responsive>.table-bordered>tbody>tr:last-child>td,.table-responsive>.table-bordered>tbody>tr:last-child>th,.table-responsive>.table-bordered>tfoot>tr:last-child>td,.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:inherit;color:#333;border:0;border-bottom:1px solid #e5e5e5}label{display:inline-block;max-width:100%;margin-bottom:5px;font-weight:700}input[type=search]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}input[type=checkbox],input[type=radio]{margin:4px 0 0;margin-top:1px\9;line-height:normal}input[type=file]{display:block}input[type=range]{display:block;width:100%}select[multiple],select[size]{height:auto}input[type=file]:focus,input[type=checkbox]:focus,input[type=radio]:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}output{display:block;padding-top:7px;font-size:14px;line-height:1.42857143;color:#555}.form-control{display:block;width:100%;height:34px;padding:6px 12px;font-size:14px;line-height:1.42857143;color:#555;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-webkit-transition:border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;-o-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.form-control::-moz-placeholder{color:#999;opacity:1}.form-control:-ms-input-placeholder{color:#999}.form-control::-webkit-input-placeholder{color:#999}.form-control::-ms-expand{background-color:transparent;border:0}.form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{background-color:#eee;opacity:1}.form-control[disabled],fieldset[disabled] .form-control{cursor:not-allowed}textarea.form-control{height:auto}input[type=search]{-webkit-appearance:none}@media screen and (-webkit-min-device-pixel-ratio:0){input[type=date].form-control,input[type=time].form-control,input[type=datetime-local].form-control,input[type=month].form-control{line-height:34px}.input-group-sm input[type=date],.input-group-sm input[type=time],.input-group-sm input[type=datetime-local],.input-group-sm input[type=month],input[type=date].input-sm,input[type=time].input-sm,input[type=datetime-local].input-sm,input[type=month].input-sm{line-height:30px}.input-group-lg input[type=date],.input-group-lg input[type=time],.input-group-lg input[type=datetime-local],.input-group-lg input[type=month],input[type=date].input-lg,input[type=time].input-lg,input[type=datetime-local].input-lg,input[type=month].input-lg{line-height:46px}}.form-group{margin-bottom:15px}.checkbox,.radio{position:relative;display:block;margin-top:10px;margin-bottom:10px}.checkbox label,.radio label{min-height:20px;padding-left:20px;margin-bottom:0;font-weight:400;cursor:pointer}.checkbox input[type=checkbox],.checkbox-inline input[type=checkbox],.radio input[type=radio],.radio-inline input[type=radio]{position:absolute;margin-top:4px\9;margin-left:-20px}.checkbox+.checkbox,.radio+.radio{margin-top:-5px}.checkbox-inline,.radio-inline{position:relative;display:inline-block;padding-left:20px;margin-bottom:0;font-weight:400;vertical-align:middle;cursor:pointer}.checkbox-inline+.checkbox-inline,.radio-inline+.radio-inline{margin-top:0;margin-left:10px}fieldset[disabled] input[type=checkbox],fieldset[disabled] input[type=radio],input[type=checkbox].disabled,input[type=checkbox][disabled],input[type=radio].disabled,input[type=radio][disabled]{cursor:not-allowed}.checkbox-inline.disabled,.radio-inline.disabled,fieldset[disabled] .checkbox-inline,fieldset[disabled] .radio-inline{cursor:not-allowed}.checkbox.disabled label,.radio.disabled label,fieldset[disabled] .checkbox label,fieldset[disabled] .radio label{cursor:not-allowed}.form-control-static{min-height:34px;padding-top:7px;padding-bottom:7px;margin-bottom:0}.form-control-static.input-lg,.form-control-static.input-sm{padding-right:0;padding-left:0}.input-sm{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-sm{height:30px;line-height:30px}select[multiple].input-sm,textarea.input-sm{height:auto}.form-group-sm .form-control{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.form-group-sm select.form-control{height:30px;line-height:30px}.form-group-sm select[multiple].form-control,.form-group-sm textarea.form-control{height:auto}.form-group-sm .form-control-static{height:30px;min-height:32px;padding:6px 10px;font-size:12px;line-height:1.5}.input-lg{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}select.input-lg{height:46px;line-height:46px}select[multiple].input-lg,textarea.input-lg{height:auto}.form-group-lg .form-control{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}.form-group-lg select.form-control{height:46px;line-height:46px}.form-group-lg select[multiple].form-control,.form-group-lg textarea.form-control{height:auto}.form-group-lg .form-control-static{height:46px;min-height:38px;padding:11px 16px;font-size:18px;line-height:1.3333333}.has-feedback{position:relative}.has-feedback .form-control{padding-right:42.5px}.form-control-feedback{position:absolute;top:0;right:0;z-index:2;display:block;width:34px;height:34px;line-height:34px;text-align:center;pointer-events:none}.form-group-lg .form-control+.form-control-feedback,.input-group-lg+.form-control-feedback,.input-lg+.form-control-feedback{width:46px;height:46px;line-height:46px}.form-group-sm .form-control+.form-control-feedback,.input-group-sm+.form-control-feedback,.input-sm+.form-control-feedback{width:30px;height:30px;line-height:30px}.has-success .checkbox,.has-success .checkbox-inline,.has-success .control-label,.has-success .help-block,.has-success .radio,.has-success .radio-inline,.has-success.checkbox label,.has-success.checkbox-inline label,.has-success.radio label,.has-success.radio-inline label{color:#3c763d}.has-success .form-control{border-color:#3c763d;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-success .form-control:focus{border-color:#2b542c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168}.has-success .input-group-addon{color:#3c763d;background-color:#dff0d8;border-color:#3c763d}.has-success .form-control-feedback{color:#3c763d}.has-warning .checkbox,.has-warning .checkbox-inline,.has-warning .control-label,.has-warning .help-block,.has-warning .radio,.has-warning .radio-inline,.has-warning.checkbox label,.has-warning.checkbox-inline label,.has-warning.radio label,.has-warning.radio-inline label{color:#8a6d3b}.has-warning .form-control{border-color:#8a6d3b;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-warning .form-control:focus{border-color:#66512c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b}.has-warning .input-group-addon{color:#8a6d3b;background-color:#fcf8e3;border-color:#8a6d3b}.has-warning .form-control-feedback{color:#8a6d3b}.has-error .checkbox,.has-error .checkbox-inline,.has-error .control-label,.has-error .help-block,.has-error .radio,.has-error .radio-inline,.has-error.checkbox label,.has-error.checkbox-inline label,.has-error.radio label,.has-error.radio-inline label{color:#a94442}.has-error .form-control{border-color:#a94442;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-error .form-control:focus{border-color:#843534;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483}.has-error .input-group-addon{color:#a94442;background-color:#f2dede;border-color:#a94442}.has-error .form-control-feedback{color:#a94442}.has-feedback label~.form-control-feedback{top:25px}.has-feedback label.sr-only~.form-control-feedback{top:0}.help-block{display:block;margin-top:5px;margin-bottom:10px;color:#737373}@media (min-width:768px){.form-inline .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.form-inline .form-control{display:inline-block;width:auto;vertical-align:middle}.form-inline .form-control-static{display:inline-block}.form-inline .input-group{display:inline-table;vertical-align:middle}.form-inline .input-group .form-control,.form-inline .input-group .input-group-addon,.form-inline .input-group .input-group-btn{width:auto}.form-inline .input-group>.form-control{width:100%}.form-inline .control-label{margin-bottom:0;vertical-align:middle}.form-inline .checkbox,.form-inline .radio{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.form-inline .checkbox label,.form-inline .radio label{padding-left:0}.form-inline .checkbox input[type=checkbox],.form-inline .radio input[type=radio]{position:relative;margin-left:0}.form-inline .has-feedback .form-control-feedback{top:0}}.form-horizontal .checkbox,.form-horizontal .checkbox-inline,.form-horizontal .radio,.form-horizontal .radio-inline{padding-top:7px;margin-top:0;margin-bottom:0}.form-horizontal .checkbox,.form-horizontal .radio{min-height:27px}.form-horizontal .form-group{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.form-horizontal .control-label{padding-top:7px;margin-bottom:0;text-align:right}}.form-horizontal .has-feedback .form-control-feedback{right:15px}@media (min-width:768px){.form-horizontal .form-group-lg .control-label{padding-top:11px;font-size:18px}}@media (min-width:768px){.form-horizontal .form-group-sm .control-label{padding-top:6px;font-size:12px}}.btn{display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-image:none;border:1px solid transparent;border-radius:4px}.btn.active.focus,.btn.active:focus,.btn.focus,.btn:active.focus,.btn:active:focus,.btn:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn.focus,.btn:focus,.btn:hover{color:#333;text-decoration:none}.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn.disabled,.btn[disabled],fieldset[disabled] .btn{cursor:not-allowed;filter:alpha(opacity=65);-webkit-box-shadow:none;box-shadow:none;opacity:.65}a.btn.disabled,fieldset[disabled] a.btn{pointer-events:none}.btn-default{color:#333;background-color:#fff;border-color:#ccc}.btn-default.focus,.btn-default:focus{color:#333;background-color:#e6e6e6;border-color:#8c8c8c}.btn-default:hover{color:#333;background-color:#e6e6e6;border-color:#adadad}.btn-default.active,.btn-default:active,.open>.dropdown-toggle.btn-default{color:#333;background-color:#e6e6e6;border-color:#adadad}.btn-default.active.focus,.btn-default.active:focus,.btn-default.active:hover,.btn-default:active.focus,.btn-default:active:focus,.btn-default:active:hover,.open>.dropdown-toggle.btn-default.focus,.open>.dropdown-toggle.btn-default:focus,.open>.dropdown-toggle.btn-default:hover{color:#333;background-color:#d4d4d4;border-color:#8c8c8c}.btn-default.active,.btn-default:active,.open>.dropdown-toggle.btn-default{background-image:none}.btn-default.disabled.focus,.btn-default.disabled:focus,.btn-default.disabled:hover,.btn-default[disabled].focus,.btn-default[disabled]:focus,.btn-default[disabled]:hover,fieldset[disabled] .btn-default.focus,fieldset[disabled] .btn-default:focus,fieldset[disabled] .btn-default:hover{background-color:#fff;border-color:#ccc}.btn-default .badge{color:#fff;background-color:#333}.btn-primary{color:#fff;background-color:#337ab7;border-color:#2e6da4}.btn-primary.focus,.btn-primary:focus{color:#fff;background-color:#286090;border-color:#122b40}.btn-primary:hover{color:#fff;background-color:#286090;border-color:#204d74}.btn-primary.active,.btn-primary:active,.open>.dropdown-toggle.btn-primary{color:#fff;background-color:#286090;border-color:#204d74}.btn-primary.active.focus,.btn-primary.active:focus,.btn-primary.active:hover,.btn-primary:active.focus,.btn-primary:active:focus,.btn-primary:active:hover,.open>.dropdown-toggle.btn-primary.focus,.open>.dropdown-toggle.btn-primary:focus,.open>.dropdown-toggle.btn-primary:hover{color:#fff;background-color:#204d74;border-color:#122b40}.btn-primary.active,.btn-primary:active,.open>.dropdown-toggle.btn-primary{background-image:none}.btn-primary.disabled.focus,.btn-primary.disabled:focus,.btn-primary.disabled:hover,.btn-primary[disabled].focus,.btn-primary[disabled]:focus,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary.focus,fieldset[disabled] .btn-primary:focus,fieldset[disabled] .btn-primary:hover{background-color:#337ab7;border-color:#2e6da4}.btn-primary .badge{color:#337ab7;background-color:#fff}.btn-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.btn-success.focus,.btn-success:focus{color:#fff;background-color:#449d44;border-color:#255625}.btn-success:hover{color:#fff;background-color:#449d44;border-color:#398439}.btn-success.active,.btn-success:active,.open>.dropdown-toggle.btn-success{color:#fff;background-color:#449d44;border-color:#398439}.btn-success.active.focus,.btn-success.active:focus,.btn-success.active:hover,.btn-success:active.focus,.btn-success:active:focus,.btn-success:active:hover,.open>.dropdown-toggle.btn-success.focus,.open>.dropdown-toggle.btn-success:focus,.open>.dropdown-toggle.btn-success:hover{color:#fff;background-color:#398439;border-color:#255625}.btn-success.active,.btn-success:active,.open>.dropdown-toggle.btn-success{background-image:none}.btn-success.disabled.focus,.btn-success.disabled:focus,.btn-success.disabled:hover,.btn-success[disabled].focus,.btn-success[disabled]:focus,.btn-success[disabled]:hover,fieldset[disabled] .btn-success.focus,fieldset[disabled] .btn-success:focus,fieldset[disabled] .btn-success:hover{background-color:#5cb85c;border-color:#4cae4c}.btn-success .badge{color:#5cb85c;background-color:#fff}.btn-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.btn-info.focus,.btn-info:focus{color:#fff;background-color:#31b0d5;border-color:#1b6d85}.btn-info:hover{color:#fff;background-color:#31b0d5;border-color:#269abc}.btn-info.active,.btn-info:active,.open>.dropdown-toggle.btn-info{color:#fff;background-color:#31b0d5;border-color:#269abc}.btn-info.active.focus,.btn-info.active:focus,.btn-info.active:hover,.btn-info:active.focus,.btn-info:active:focus,.btn-info:active:hover,.open>.dropdown-toggle.btn-info.focus,.open>.dropdown-toggle.btn-info:focus,.open>.dropdown-toggle.btn-info:hover{color:#fff;background-color:#269abc;border-color:#1b6d85}.btn-info.active,.btn-info:active,.open>.dropdown-toggle.btn-info{background-image:none}.btn-info.disabled.focus,.btn-info.disabled:focus,.btn-info.disabled:hover,.btn-info[disabled].focus,.btn-info[disabled]:focus,.btn-info[disabled]:hover,fieldset[disabled] .btn-info.focus,fieldset[disabled] .btn-info:focus,fieldset[disabled] .btn-info:hover{background-color:#5bc0de;border-color:#46b8da}.btn-info .badge{color:#5bc0de;background-color:#fff}.btn-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.btn-warning.focus,.btn-warning:focus{color:#fff;background-color:#ec971f;border-color:#985f0d}.btn-warning:hover{color:#fff;background-color:#ec971f;border-color:#d58512}.btn-warning.active,.btn-warning:active,.open>.dropdown-toggle.btn-warning{color:#fff;background-color:#ec971f;border-color:#d58512}.btn-warning.active.focus,.btn-warning.active:focus,.btn-warning.active:hover,.btn-warning:active.focus,.btn-warning:active:focus,.btn-warning:active:hover,.open>.dropdown-toggle.btn-warning.focus,.open>.dropdown-toggle.btn-warning:focus,.open>.dropdown-toggle.btn-warning:hover{color:#fff;background-color:#d58512;border-color:#985f0d}.btn-warning.active,.btn-warning:active,.open>.dropdown-toggle.btn-warning{background-image:none}.btn-warning.disabled.focus,.btn-warning.disabled:focus,.btn-warning.disabled:hover,.btn-warning[disabled].focus,.btn-warning[disabled]:focus,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning.focus,fieldset[disabled] .btn-warning:focus,fieldset[disabled] .btn-warning:hover{background-color:#f0ad4e;border-color:#eea236}.btn-warning .badge{color:#f0ad4e;background-color:#fff}.btn-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.btn-danger.focus,.btn-danger:focus{color:#fff;background-color:#c9302c;border-color:#761c19}.btn-danger:hover{color:#fff;background-color:#c9302c;border-color:#ac2925}.btn-danger.active,.btn-danger:active,.open>.dropdown-toggle.btn-danger{color:#fff;background-color:#c9302c;border-color:#ac2925}.btn-danger.active.focus,.btn-danger.active:focus,.btn-danger.active:hover,.btn-danger:active.focus,.btn-danger:active:focus,.btn-danger:active:hover,.open>.dropdown-toggle.btn-danger.focus,.open>.dropdown-toggle.btn-danger:focus,.open>.dropdown-toggle.btn-danger:hover{color:#fff;background-color:#ac2925;border-color:#761c19}.btn-danger.active,.btn-danger:active,.open>.dropdown-toggle.btn-danger{background-image:none}.btn-danger.disabled.focus,.btn-danger.disabled:focus,.btn-danger.disabled:hover,.btn-danger[disabled].focus,.btn-danger[disabled]:focus,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger.focus,fieldset[disabled] .btn-danger:focus,fieldset[disabled] .btn-danger:hover{background-color:#d9534f;border-color:#d43f3a}.btn-danger .badge{color:#d9534f;background-color:#fff}.btn-link{font-weight:400;color:#337ab7;border-radius:0}.btn-link,.btn-link.active,.btn-link:active,.btn-link[disabled],fieldset[disabled] .btn-link{background-color:transparent;-webkit-box-shadow:none;box-shadow:none}.btn-link,.btn-link:active,.btn-link:focus,.btn-link:hover{border-color:transparent}.btn-link:focus,.btn-link:hover{color:#23527c;text-decoration:underline;background-color:transparent}.btn-link[disabled]:focus,.btn-link[disabled]:hover,fieldset[disabled] .btn-link:focus,fieldset[disabled] .btn-link:hover{color:#777;text-decoration:none}.btn-group-lg>.btn,.btn-lg{padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}.btn-group-sm>.btn,.btn-sm{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.btn-group-xs>.btn,.btn-xs{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.btn-block{display:block;width:100%}.btn-block+.btn-block{margin-top:5px}input[type=button].btn-block,input[type=reset].btn-block,input[type=submit].btn-block{width:100%}.fade{opacity:0;-webkit-transition:opacity .15s linear;-o-transition:opacity .15s linear;transition:opacity .15s linear}.fade.in{opacity:1}.collapse{display:none}.collapse.in{display:block}tr.collapse.in{display:table-row}tbody.collapse.in{display:table-row-group}.collapsing{position:relative;height:0;overflow:hidden;-webkit-transition-timing-function:ease;-o-transition-timing-function:ease;transition-timing-function:ease;-webkit-transition-duration:.35s;-o-transition-duration:.35s;transition-duration:.35s;-webkit-transition-property:height,visibility;-o-transition-property:height,visibility;transition-property:height,visibility}.caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px dashed;border-top:4px solid\9;border-right:4px solid transparent;border-left:4px solid transparent}.dropdown,.dropup{position:relative}.dropdown-toggle:focus{outline:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;font-size:14px;text-align:left;list-style:none;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.15);border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175)}.dropdown-menu.pull-right{right:0;left:auto}.dropdown-menu .divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.42857143;color:#333;white-space:nowrap}.dropdown-menu>li>a:focus,.dropdown-menu>li>a:hover{color:#262626;text-decoration:none;background-color:#f5f5f5}.dropdown-menu>.active>a,.dropdown-menu>.active>a:focus,.dropdown-menu>.active>a:hover{color:#fff;text-decoration:none;background-color:#337ab7;outline:0}.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:focus,.dropdown-menu>.disabled>a:hover{color:#777}.dropdown-menu>.disabled>a:focus,.dropdown-menu>.disabled>a:hover{text-decoration:none;cursor:not-allowed;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.open>.dropdown-menu{display:block}.open>a{outline:0}.dropdown-menu-right{right:0;left:auto}.dropdown-menu-left{right:auto;left:0}.dropdown-header{display:block;padding:3px 20px;font-size:12px;line-height:1.42857143;color:#777;white-space:nowrap}.dropdown-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:990}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{content:"";border-top:0;border-bottom:4px dashed;border-bottom:4px solid\9}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:2px}@media (min-width:768px){.navbar-right .dropdown-menu{right:0;left:auto}.navbar-right .dropdown-menu-left{right:auto;left:0}}.btn-group,.btn-group-vertical{position:relative;display:inline-block;vertical-align:middle}.btn-group-vertical>.btn,.btn-group>.btn{position:relative;float:left}.btn-group-vertical>.btn.active,.btn-group-vertical>.btn:active,.btn-group-vertical>.btn:focus,.btn-group-vertical>.btn:hover,.btn-group>.btn.active,.btn-group>.btn:active,.btn-group>.btn:focus,.btn-group>.btn:hover{z-index:2}.btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group{margin-left:-1px}.btn-toolbar{margin-left:-5px}.btn-toolbar .btn,.btn-toolbar .btn-group,.btn-toolbar .input-group{float:left}.btn-toolbar>.btn,.btn-toolbar>.btn-group,.btn-toolbar>.input-group{margin-left:5px}.btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.btn-group>.btn:first-child{margin-left:0}.btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn:last-child:not(:first-child),.btn-group>.dropdown-toggle:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.btn-group>.btn-group{float:left}.btn-group>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-left-radius:0;border-bottom-left-radius:0}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0}.btn-group>.btn+.dropdown-toggle{padding-right:8px;padding-left:8px}.btn-group>.btn-lg+.dropdown-toggle{padding-right:12px;padding-left:12px}.btn-group.open .dropdown-toggle{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-group.open .dropdown-toggle.btn-link{-webkit-box-shadow:none;box-shadow:none}.btn .caret{margin-left:0}.btn-lg .caret{border-width:5px 5px 0;border-bottom-width:0}.dropup .btn-lg .caret{border-width:0 5px 5px}.btn-group-vertical>.btn,.btn-group-vertical>.btn-group,.btn-group-vertical>.btn-group>.btn{display:block;float:none;width:100%;max-width:100%}.btn-group-vertical>.btn-group>.btn{float:none}.btn-group-vertical>.btn+.btn,.btn-group-vertical>.btn+.btn-group,.btn-group-vertical>.btn-group+.btn,.btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:not(:first-child):not(:last-child){border-radius:0}.btn-group-vertical>.btn:first-child:not(:last-child){border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn:last-child:not(:first-child){border-top-left-radius:0;border-top-right-radius:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px}.btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group-vertical>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group-vertical>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-left-radius:0;border-top-right-radius:0}.btn-group-justified{display:table;width:100%;table-layout:fixed;border-collapse:separate}.btn-group-justified>.btn,.btn-group-justified>.btn-group{display:table-cell;float:none;width:1%}.btn-group-justified>.btn-group .btn{width:100%}.btn-group-justified>.btn-group .dropdown-menu{left:auto}[data-toggle=buttons]>.btn input[type=checkbox],[data-toggle=buttons]>.btn input[type=radio],[data-toggle=buttons]>.btn-group>.btn input[type=checkbox],[data-toggle=buttons]>.btn-group>.btn input[type=radio]{position:absolute;clip:rect(0,0,0,0);pointer-events:none}.input-group{position:relative;display:table;border-collapse:separate}.input-group[class*=col-]{float:none;padding-right:0;padding-left:0}.input-group .form-control{position:relative;z-index:2;float:left;width:100%;margin-bottom:0}.input-group .form-control:focus{z-index:3}.input-group-lg>.form-control,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.btn{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}select.input-group-lg>.form-control,select.input-group-lg>.input-group-addon,select.input-group-lg>.input-group-btn>.btn{height:46px;line-height:46px}select[multiple].input-group-lg>.form-control,select[multiple].input-group-lg>.input-group-addon,select[multiple].input-group-lg>.input-group-btn>.btn,textarea.input-group-lg>.form-control,textarea.input-group-lg>.input-group-addon,textarea.input-group-lg>.input-group-btn>.btn{height:auto}.input-group-sm>.form-control,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.btn{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-group-sm>.form-control,select.input-group-sm>.input-group-addon,select.input-group-sm>.input-group-btn>.btn{height:30px;line-height:30px}select[multiple].input-group-sm>.form-control,select[multiple].input-group-sm>.input-group-addon,select[multiple].input-group-sm>.input-group-btn>.btn,textarea.input-group-sm>.form-control,textarea.input-group-sm>.input-group-addon,textarea.input-group-sm>.input-group-btn>.btn{height:auto}.input-group .form-control,.input-group-addon,.input-group-btn{display:table-cell}.input-group .form-control:not(:first-child):not(:last-child),.input-group-addon:not(:first-child):not(:last-child),.input-group-btn:not(:first-child):not(:last-child){border-radius:0}.input-group-addon,.input-group-btn{width:1%;white-space:nowrap;vertical-align:middle}.input-group-addon{padding:6px 12px;font-size:14px;font-weight:400;line-height:1;color:#555;text-align:center;background-color:#eee;border:1px solid #ccc;border-radius:4px}.input-group-addon.input-sm{padding:5px 10px;font-size:12px;border-radius:3px}.input-group-addon.input-lg{padding:10px 16px;font-size:18px;border-radius:6px}.input-group-addon input[type=checkbox],.input-group-addon input[type=radio]{margin-top:0}.input-group .form-control:first-child,.input-group-addon:first-child,.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group>.btn,.input-group-btn:first-child>.dropdown-toggle,.input-group-btn:last-child>.btn-group:not(:last-child)>.btn,.input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.input-group-addon:first-child{border-right:0}.input-group .form-control:last-child,.input-group-addon:last-child,.input-group-btn:first-child>.btn-group:not(:first-child)>.btn,.input-group-btn:first-child>.btn:not(:first-child),.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group>.btn,.input-group-btn:last-child>.dropdown-toggle{border-top-left-radius:0;border-bottom-left-radius:0}.input-group-addon:last-child{border-left:0}.input-group-btn{position:relative;font-size:0;white-space:nowrap}.input-group-btn>.btn{position:relative}.input-group-btn>.btn+.btn{margin-left:-1px}.input-group-btn>.btn:active,.input-group-btn>.btn:focus,.input-group-btn>.btn:hover{z-index:2}.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group{margin-right:-1px}.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group{z-index:2;margin-left:-1px}.nav{padding-left:0;margin-bottom:0;list-style:none}.nav>li{position:relative;display:block}.nav>li>a{position:relative;display:block;padding:10px 15px}.nav>li>a:focus,.nav>li>a:hover{text-decoration:none;background-color:#eee}.nav>li.disabled>a{color:#777}.nav>li.disabled>a:focus,.nav>li.disabled>a:hover{color:#777;text-decoration:none;cursor:not-allowed;background-color:transparent}.nav .open>a,.nav .open>a:focus,.nav .open>a:hover{background-color:#eee;border-color:#337ab7}.nav .nav-divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.nav>li>a>img{max-width:none}.nav-tabs{border-bottom:1px solid #ddd}.nav-tabs>li{float:left;margin-bottom:-1px}.nav-tabs>li>a{margin-right:2px;line-height:1.42857143;border:1px solid transparent;border-radius:4px 4px 0 0}.nav-tabs>li>a:hover{border-color:#eee #eee #ddd}.nav-tabs>li.active>a,.nav-tabs>li.active>a:focus,.nav-tabs>li.active>a:hover{color:#555;cursor:default;background-color:#fff;border:1px solid #ddd;border-bottom-color:transparent}.nav-tabs.nav-justified{width:100%;border-bottom:0}.nav-tabs.nav-justified>li{float:none}.nav-tabs.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-tabs.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-tabs.nav-justified>li{display:table-cell;width:1%}.nav-tabs.nav-justified>li>a{margin-bottom:0}}.nav-tabs.nav-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:focus,.nav-tabs.nav-justified>.active>a:hover{border:1px solid #ddd}@media (min-width:768px){.nav-tabs.nav-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:focus,.nav-tabs.nav-justified>.active>a:hover{border-bottom-color:#fff}}.nav-pills>li{float:left}.nav-pills>li>a{border-radius:4px}.nav-pills>li+li{margin-left:2px}.nav-pills>li.active>a,.nav-pills>li.active>a:focus,.nav-pills>li.active>a:hover{color:#fff;background-color:#337ab7}.nav-stacked>li{float:none}.nav-stacked>li+li{margin-top:2px;margin-left:0}.nav-justified{width:100%}.nav-justified>li{float:none}.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-justified>li{display:table-cell;width:1%}.nav-justified>li>a{margin-bottom:0}}.nav-tabs-justified{border-bottom:0}.nav-tabs-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:focus,.nav-tabs-justified>.active>a:hover{border:1px solid #ddd}@media (min-width:768px){.nav-tabs-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:focus,.nav-tabs-justified>.active>a:hover{border-bottom-color:#fff}}.tab-content>.tab-pane{display:none}.tab-content>.active{display:block}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-left-radius:0;border-top-right-radius:0}.navbar{position:relative;min-height:50px;margin-bottom:20px;border:1px solid transparent}@media (min-width:768px){.navbar{border-radius:4px}}@media (min-width:768px){.navbar-header{float:left}}.navbar-collapse{padding-right:15px;padding-left:15px;overflow-x:visible;-webkit-overflow-scrolling:touch;border-top:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1)}.navbar-collapse.in{overflow-y:auto}@media (min-width:768px){.navbar-collapse{width:auto;border-top:0;-webkit-box-shadow:none;box-shadow:none}.navbar-collapse.collapse{display:block!important;height:auto!important;padding-bottom:0;overflow:visible!important}.navbar-collapse.in{overflow-y:visible}.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse,.navbar-static-top .navbar-collapse{padding-right:0;padding-left:0}}.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse{max-height:340px}@media (max-device-width:480px) and (orientation:landscape){.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse{max-height:200px}}.container-fluid>.navbar-collapse,.container-fluid>.navbar-header,.container>.navbar-collapse,.container>.navbar-header{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.container-fluid>.navbar-collapse,.container-fluid>.navbar-header,.container>.navbar-collapse,.container>.navbar-header{margin-right:0;margin-left:0}}.navbar-static-top{z-index:1000;border-width:0 0 1px}@media (min-width:768px){.navbar-static-top{border-radius:0}}.navbar-fixed-bottom,.navbar-fixed-top{position:fixed;right:0;left:0;z-index:1030}@media (min-width:768px){.navbar-fixed-bottom,.navbar-fixed-top{border-radius:0}}.navbar-fixed-top{top:0;border-width:0 0 1px}.navbar-fixed-bottom{bottom:0;margin-bottom:0;border-width:1px 0 0}.navbar-brand{float:left;height:50px;padding:15px 15px;font-size:18px;line-height:20px}.navbar-brand:focus,.navbar-brand:hover{text-decoration:none}.navbar-brand>img{display:block}@media (min-width:768px){.navbar>.container .navbar-brand,.navbar>.container-fluid .navbar-brand{margin-left:-15px}}.navbar-toggle{position:relative;float:right;padding:9px 10px;margin-top:8px;margin-right:15px;margin-bottom:8px;background-color:transparent;background-image:none;border:1px solid transparent;border-radius:4px}.navbar-toggle:focus{outline:0}.navbar-toggle .icon-bar{display:block;width:22px;height:2px;border-radius:1px}.navbar-toggle .icon-bar+.icon-bar{margin-top:4px}@media (min-width:768px){.navbar-toggle{display:none}}.navbar-nav{margin:7.5px -15px}.navbar-nav>li>a{padding-top:10px;padding-bottom:10px;line-height:20px}@media (max-width:767px){.navbar-nav .open .dropdown-menu{position:static;float:none;width:auto;margin-top:0;background-color:transparent;border:0;-webkit-box-shadow:none;box-shadow:none}.navbar-nav .open .dropdown-menu .dropdown-header,.navbar-nav .open .dropdown-menu>li>a{padding:5px 15px 5px 25px}.navbar-nav .open .dropdown-menu>li>a{line-height:20px}.navbar-nav .open .dropdown-menu>li>a:focus,.navbar-nav .open .dropdown-menu>li>a:hover{background-image:none}}@media (min-width:768px){.navbar-nav{float:left;margin:0}.navbar-nav>li{float:left}.navbar-nav>li>a{padding-top:15px;padding-bottom:15px}}.navbar-form{padding:10px 15px;margin-top:8px;margin-right:-15px;margin-bottom:8px;margin-left:-15px;border-top:1px solid transparent;border-bottom:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1)}@media (min-width:768px){.navbar-form .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.navbar-form .form-control{display:inline-block;width:auto;vertical-align:middle}.navbar-form .form-control-static{display:inline-block}.navbar-form .input-group{display:inline-table;vertical-align:middle}.navbar-form .input-group .form-control,.navbar-form .input-group .input-group-addon,.navbar-form .input-group .input-group-btn{width:auto}.navbar-form .input-group>.form-control{width:100%}.navbar-form .control-label{margin-bottom:0;vertical-align:middle}.navbar-form .checkbox,.navbar-form .radio{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.navbar-form .checkbox label,.navbar-form .radio label{padding-left:0}.navbar-form .checkbox input[type=checkbox],.navbar-form .radio input[type=radio]{position:relative;margin-left:0}.navbar-form .has-feedback .form-control-feedback{top:0}}@media (max-width:767px){.navbar-form .form-group{margin-bottom:5px}.navbar-form .form-group:last-child{margin-bottom:0}}@media (min-width:768px){.navbar-form{width:auto;padding-top:0;padding-bottom:0;margin-right:0;margin-left:0;border:0;-webkit-box-shadow:none;box-shadow:none}}.navbar-nav>li>.dropdown-menu{margin-top:0;border-top-left-radius:0;border-top-right-radius:0}.navbar-fixed-bottom .navbar-nav>li>.dropdown-menu{margin-bottom:0;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.navbar-btn{margin-top:8px;margin-bottom:8px}.navbar-btn.btn-sm{margin-top:10px;margin-bottom:10px}.navbar-btn.btn-xs{margin-top:14px;margin-bottom:14px}.navbar-text{margin-top:15px;margin-bottom:15px}@media (min-width:768px){.navbar-text{float:left;margin-right:15px;margin-left:15px}}@media (min-width:768px){.navbar-left{float:left!important}.navbar-right{float:right!important;margin-right:-15px}.navbar-right~.navbar-right{margin-right:0}}.navbar-default{background-color:#f8f8f8;border-color:#e7e7e7}.navbar-default .navbar-brand{color:#777}.navbar-default .navbar-brand:focus,.navbar-default .navbar-brand:hover{color:#5e5e5e;background-color:transparent}.navbar-default .navbar-text{color:#777}.navbar-default .navbar-nav>li>a{color:#777}.navbar-default .navbar-nav>li>a:focus,.navbar-default .navbar-nav>li>a:hover{color:#333;background-color:transparent}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:focus,.navbar-default .navbar-nav>.active>a:hover{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav>.disabled>a,.navbar-default .navbar-nav>.disabled>a:focus,.navbar-default .navbar-nav>.disabled>a:hover{color:#ccc;background-color:transparent}.navbar-default .navbar-toggle{border-color:#ddd}.navbar-default .navbar-toggle:focus,.navbar-default .navbar-toggle:hover{background-color:#ddd}.navbar-default .navbar-toggle .icon-bar{background-color:#888}.navbar-default .navbar-collapse,.navbar-default .navbar-form{border-color:#e7e7e7}.navbar-default .navbar-nav>.open>a,.navbar-default .navbar-nav>.open>a:focus,.navbar-default .navbar-nav>.open>a:hover{color:#555;background-color:#e7e7e7}@media (max-width:767px){.navbar-default .navbar-nav .open .dropdown-menu>li>a{color:#777}.navbar-default .navbar-nav .open .dropdown-menu>li>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>li>a:hover{color:#333;background-color:transparent}.navbar-default .navbar-nav .open .dropdown-menu>.active>a,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:hover{color:#ccc;background-color:transparent}}.navbar-default .navbar-link{color:#777}.navbar-default .navbar-link:hover{color:#333}.navbar-default .btn-link{color:#777}.navbar-default .btn-link:focus,.navbar-default .btn-link:hover{color:#333}.navbar-default .btn-link[disabled]:focus,.navbar-default .btn-link[disabled]:hover,fieldset[disabled] .navbar-default .btn-link:focus,fieldset[disabled] .navbar-default .btn-link:hover{color:#ccc}.navbar-inverse{background-color:#222;border-color:#080808}.navbar-inverse .navbar-brand{color:#9d9d9d}.navbar-inverse .navbar-brand:focus,.navbar-inverse .navbar-brand:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-text{color:#9d9d9d}.navbar-inverse .navbar-nav>li>a{color:#9d9d9d}.navbar-inverse .navbar-nav>li>a:focus,.navbar-inverse .navbar-nav>li>a:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.active>a:focus,.navbar-inverse .navbar-nav>.active>a:hover{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav>.disabled>a,.navbar-inverse .navbar-nav>.disabled>a:focus,.navbar-inverse .navbar-nav>.disabled>a:hover{color:#444;background-color:transparent}.navbar-inverse .navbar-toggle{border-color:#333}.navbar-inverse .navbar-toggle:focus,.navbar-inverse .navbar-toggle:hover{background-color:#333}.navbar-inverse .navbar-toggle .icon-bar{background-color:#fff}.navbar-inverse .navbar-collapse,.navbar-inverse .navbar-form{border-color:#101010}.navbar-inverse .navbar-nav>.open>a,.navbar-inverse .navbar-nav>.open>a:focus,.navbar-inverse .navbar-nav>.open>a:hover{color:#fff;background-color:#080808}@media (max-width:767px){.navbar-inverse .navbar-nav .open .dropdown-menu>.dropdown-header{border-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu .divider{background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a{color:#9d9d9d}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:hover{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:hover{color:#444;background-color:transparent}}.navbar-inverse .navbar-link{color:#9d9d9d}.navbar-inverse .navbar-link:hover{color:#fff}.navbar-inverse .btn-link{color:#9d9d9d}.navbar-inverse .btn-link:focus,.navbar-inverse .btn-link:hover{color:#fff}.navbar-inverse .btn-link[disabled]:focus,.navbar-inverse .btn-link[disabled]:hover,fieldset[disabled] .navbar-inverse .btn-link:focus,fieldset[disabled] .navbar-inverse .btn-link:hover{color:#444}.breadcrumb{padding:8px 15px;margin-bottom:20px;list-style:none;background-color:#f5f5f5;border-radius:4px}.breadcrumb>li{display:inline-block}.breadcrumb>li+li:before{padding:0 5px;color:#ccc;content:"/\00a0"}.breadcrumb>.active{color:#777}.pagination{display:inline-block;padding-left:0;margin:20px 0;border-radius:4px}.pagination>li{display:inline}.pagination>li>a,.pagination>li>span{position:relative;float:left;padding:6px 12px;margin-left:-1px;line-height:1.42857143;color:#337ab7;text-decoration:none;background-color:#fff;border:1px solid #ddd}.pagination>li:first-child>a,.pagination>li:first-child>span{margin-left:0;border-top-left-radius:4px;border-bottom-left-radius:4px}.pagination>li:last-child>a,.pagination>li:last-child>span{border-top-right-radius:4px;border-bottom-right-radius:4px}.pagination>li>a:focus,.pagination>li>a:hover,.pagination>li>span:focus,.pagination>li>span:hover{z-index:2;color:#23527c;background-color:#eee;border-color:#ddd}.pagination>.active>a,.pagination>.active>a:focus,.pagination>.active>a:hover,.pagination>.active>span,.pagination>.active>span:focus,.pagination>.active>span:hover{z-index:3;color:#fff;cursor:default;background-color:#337ab7;border-color:#337ab7}.pagination>.disabled>a,.pagination>.disabled>a:focus,.pagination>.disabled>a:hover,.pagination>.disabled>span,.pagination>.disabled>span:focus,.pagination>.disabled>span:hover{color:#777;cursor:not-allowed;background-color:#fff;border-color:#ddd}.pagination-lg>li>a,.pagination-lg>li>span{padding:10px 16px;font-size:18px;line-height:1.3333333}.pagination-lg>li:first-child>a,.pagination-lg>li:first-child>span{border-top-left-radius:6px;border-bottom-left-radius:6px}.pagination-lg>li:last-child>a,.pagination-lg>li:last-child>span{border-top-right-radius:6px;border-bottom-right-radius:6px}.pagination-sm>li>a,.pagination-sm>li>span{padding:5px 10px;font-size:12px;line-height:1.5}.pagination-sm>li:first-child>a,.pagination-sm>li:first-child>span{border-top-left-radius:3px;border-bottom-left-radius:3px}.pagination-sm>li:last-child>a,.pagination-sm>li:last-child>span{border-top-right-radius:3px;border-bottom-right-radius:3px}.pager{padding-left:0;margin:20px 0;text-align:center;list-style:none}.pager li{display:inline}.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;border-radius:15px}.pager li>a:focus,.pager li>a:hover{text-decoration:none;background-color:#eee}.pager .next>a,.pager .next>span{float:right}.pager .previous>a,.pager .previous>span{float:left}.pager .disabled>a,.pager .disabled>a:focus,.pager .disabled>a:hover,.pager .disabled>span{color:#777;cursor:not-allowed;background-color:#fff}.label{display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em}a.label:focus,a.label:hover{color:#fff;text-decoration:none;cursor:pointer}.label:empty{display:none}.btn .label{position:relative;top:-1px}.label-default{background-color:#777}.label-default[href]:focus,.label-default[href]:hover{background-color:#5e5e5e}.label-primary{background-color:#337ab7}.label-primary[href]:focus,.label-primary[href]:hover{background-color:#286090}.label-success{background-color:#5cb85c}.label-success[href]:focus,.label-success[href]:hover{background-color:#449d44}.label-info{background-color:#5bc0de}.label-info[href]:focus,.label-info[href]:hover{background-color:#31b0d5}.label-warning{background-color:#f0ad4e}.label-warning[href]:focus,.label-warning[href]:hover{background-color:#ec971f}.label-danger{background-color:#d9534f}.label-danger[href]:focus,.label-danger[href]:hover{background-color:#c9302c}.badge{display:inline-block;min-width:10px;padding:3px 7px;font-size:12px;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:middle;background-color:#777;border-radius:10px}.badge:empty{display:none}.btn .badge{position:relative;top:-1px}.btn-group-xs>.btn .badge,.btn-xs .badge{top:0;padding:1px 5px}a.badge:focus,a.badge:hover{color:#fff;text-decoration:none;cursor:pointer}.list-group-item.active>.badge,.nav-pills>.active>a>.badge{color:#337ab7;background-color:#fff}.list-group-item>.badge{float:right}.list-group-item>.badge+.badge{margin-right:5px}.nav-pills>li>a>.badge{margin-left:3px}.jumbotron{padding-top:30px;padding-bottom:30px;margin-bottom:30px;color:inherit;background-color:#eee}.jumbotron .h1,.jumbotron h1{color:inherit}.jumbotron p{margin-bottom:15px;font-size:21px;font-weight:200}.jumbotron>hr{border-top-color:#d5d5d5}.container .jumbotron,.container-fluid .jumbotron{padding-right:15px;padding-left:15px;border-radius:6px}.jumbotron .container{max-width:100%}@media screen and (min-width:768px){.jumbotron{padding-top:48px;padding-bottom:48px}.container .jumbotron,.container-fluid .jumbotron{padding-right:60px;padding-left:60px}.jumbotron .h1,.jumbotron h1{font-size:63px}}.thumbnail{display:block;padding:4px;margin-bottom:20px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:border .2s ease-in-out;-o-transition:border .2s ease-in-out;transition:border .2s ease-in-out}.thumbnail a>img,.thumbnail>img{margin-right:auto;margin-left:auto}a.thumbnail.active,a.thumbnail:focus,a.thumbnail:hover{border-color:#337ab7}.thumbnail .caption{padding:9px;color:#333}.alert{padding:15px;margin-bottom:20px;border:1px solid transparent;border-radius:4px}.alert h4{margin-top:0;color:inherit}.alert .alert-link{font-weight:700}.alert>p,.alert>ul{margin-bottom:0}.alert>p+p{margin-top:5px}.alert-dismissable,.alert-dismissible{padding-right:35px}.alert-dismissable .close,.alert-dismissible .close{position:relative;top:-2px;right:-21px;color:inherit}.alert-success{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.alert-success hr{border-top-color:#c9e2b3}.alert-success .alert-link{color:#2b542c}.alert-info{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.alert-info hr{border-top-color:#a6e1ec}.alert-info .alert-link{color:#245269}.alert-warning{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.alert-warning hr{border-top-color:#f7e1b5}.alert-warning .alert-link{color:#66512c}.alert-danger{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.alert-danger hr{border-top-color:#e4b9c0}.alert-danger .alert-link{color:#843534}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-o-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}.progress{height:20px;margin-bottom:20px;overflow:hidden;background-color:#f5f5f5;border-radius:4px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);box-shadow:inset 0 1px 2px rgba(0,0,0,.1)}.progress-bar{float:left;width:0;height:100%;font-size:12px;line-height:20px;color:#fff;text-align:center;background-color:#337ab7;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);-webkit-transition:width .6s ease;-o-transition:width .6s ease;transition:width .6s ease}.progress-bar-striped,.progress-striped .progress-bar{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);-webkit-background-size:40px 40px;background-size:40px 40px}.progress-bar.active,.progress.active .progress-bar{-webkit-animation:progress-bar-stripes 2s linear infinite;-o-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.progress-bar-success{background-color:#5cb85c}.progress-striped .progress-bar-success{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-info{background-color:#5bc0de}.progress-striped .progress-bar-info{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-warning{background-color:#f0ad4e}.progress-striped .progress-bar-warning{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-danger{background-color:#d9534f}.progress-striped .progress-bar-danger{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.media{margin-top:15px}.media:first-child{margin-top:0}.media,.media-body{overflow:hidden;zoom:1}.media-body{width:10000px}.media-object{display:block}.media-object.img-thumbnail{max-width:none}.media-right,.media>.pull-right{padding-left:10px}.media-left,.media>.pull-left{padding-right:10px}.media-body,.media-left,.media-right{display:table-cell;vertical-align:top}.media-middle{vertical-align:middle}.media-bottom{vertical-align:bottom}.media-heading{margin-top:0;margin-bottom:5px}.media-list{padding-left:0;list-style:none}.list-group{padding-left:0;margin-bottom:20px}.list-group-item{position:relative;display:block;padding:10px 15px;margin-bottom:-1px;background-color:#fff;border:1px solid #ddd}.list-group-item:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.list-group-item:last-child{margin-bottom:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px}a.list-group-item,button.list-group-item{color:#555}a.list-group-item .list-group-item-heading,button.list-group-item .list-group-item-heading{color:#333}a.list-group-item:focus,a.list-group-item:hover,button.list-group-item:focus,button.list-group-item:hover{color:#555;text-decoration:none;background-color:#f5f5f5}button.list-group-item{width:100%;text-align:left}.list-group-item.disabled,.list-group-item.disabled:focus,.list-group-item.disabled:hover{color:#777;cursor:not-allowed;background-color:#eee}.list-group-item.disabled .list-group-item-heading,.list-group-item.disabled:focus .list-group-item-heading,.list-group-item.disabled:hover .list-group-item-heading{color:inherit}.list-group-item.disabled .list-group-item-text,.list-group-item.disabled:focus .list-group-item-text,.list-group-item.disabled:hover .list-group-item-text{color:#777}.list-group-item.active,.list-group-item.active:focus,.list-group-item.active:hover{z-index:2;color:#fff;background-color:#337ab7;border-color:#337ab7}.list-group-item.active .list-group-item-heading,.list-group-item.active .list-group-item-heading>.small,.list-group-item.active .list-group-item-heading>small,.list-group-item.active:focus .list-group-item-heading,.list-group-item.active:focus .list-group-item-heading>.small,.list-group-item.active:focus .list-group-item-heading>small,.list-group-item.active:hover .list-group-item-heading,.list-group-item.active:hover .list-group-item-heading>.small,.list-group-item.active:hover .list-group-item-heading>small{color:inherit}.list-group-item.active .list-group-item-text,.list-group-item.active:focus .list-group-item-text,.list-group-item.active:hover .list-group-item-text{color:#c7ddef}.list-group-item-success{color:#3c763d;background-color:#dff0d8}a.list-group-item-success,button.list-group-item-success{color:#3c763d}a.list-group-item-success .list-group-item-heading,button.list-group-item-success .list-group-item-heading{color:inherit}a.list-group-item-success:focus,a.list-group-item-success:hover,button.list-group-item-success:focus,button.list-group-item-success:hover{color:#3c763d;background-color:#d0e9c6}a.list-group-item-success.active,a.list-group-item-success.active:focus,a.list-group-item-success.active:hover,button.list-group-item-success.active,button.list-group-item-success.active:focus,button.list-group-item-success.active:hover{color:#fff;background-color:#3c763d;border-color:#3c763d}.list-group-item-info{color:#31708f;background-color:#d9edf7}a.list-group-item-info,button.list-group-item-info{color:#31708f}a.list-group-item-info .list-group-item-heading,button.list-group-item-info .list-group-item-heading{color:inherit}a.list-group-item-info:focus,a.list-group-item-info:hover,button.list-group-item-info:focus,button.list-group-item-info:hover{color:#31708f;background-color:#c4e3f3}a.list-group-item-info.active,a.list-group-item-info.active:focus,a.list-group-item-info.active:hover,button.list-group-item-info.active,button.list-group-item-info.active:focus,button.list-group-item-info.active:hover{color:#fff;background-color:#31708f;border-color:#31708f}.list-group-item-warning{color:#8a6d3b;background-color:#fcf8e3}a.list-group-item-warning,button.list-group-item-warning{color:#8a6d3b}a.list-group-item-warning .list-group-item-heading,button.list-group-item-warning .list-group-item-heading{color:inherit}a.list-group-item-warning:focus,a.list-group-item-warning:hover,button.list-group-item-warning:focus,button.list-group-item-warning:hover{color:#8a6d3b;background-color:#faf2cc}a.list-group-item-warning.active,a.list-group-item-warning.active:focus,a.list-group-item-warning.active:hover,button.list-group-item-warning.active,button.list-group-item-warning.active:focus,button.list-group-item-warning.active:hover{color:#fff;background-color:#8a6d3b;border-color:#8a6d3b}.list-group-item-danger{color:#a94442;background-color:#f2dede}a.list-group-item-danger,button.list-group-item-danger{color:#a94442}a.list-group-item-danger .list-group-item-heading,button.list-group-item-danger .list-group-item-heading{color:inherit}a.list-group-item-danger:focus,a.list-group-item-danger:hover,button.list-group-item-danger:focus,button.list-group-item-danger:hover{color:#a94442;background-color:#ebcccc}a.list-group-item-danger.active,a.list-group-item-danger.active:focus,a.list-group-item-danger.active:hover,button.list-group-item-danger.active,button.list-group-item-danger.active:focus,button.list-group-item-danger.active:hover{color:#fff;background-color:#a94442;border-color:#a94442}.list-group-item-heading{margin-top:0;margin-bottom:5px}.list-group-item-text{margin-bottom:0;line-height:1.3}.panel{margin-bottom:20px;background-color:#fff;border:1px solid transparent;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05)}.panel-body{padding:15px}.panel-heading{padding:10px 15px;border-bottom:1px solid transparent;border-top-left-radius:3px;border-top-right-radius:3px}.panel-heading>.dropdown .dropdown-toggle{color:inherit}.panel-title{margin-top:0;margin-bottom:0;font-size:16px;color:inherit}.panel-title>.small,.panel-title>.small>a,.panel-title>a,.panel-title>small,.panel-title>small>a{color:inherit}.panel-footer{padding:10px 15px;background-color:#f5f5f5;border-top:1px solid #ddd;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.list-group,.panel>.panel-collapse>.list-group{margin-bottom:0}.panel>.list-group .list-group-item,.panel>.panel-collapse>.list-group .list-group-item{border-width:1px 0;border-radius:0}.panel>.list-group:first-child .list-group-item:first-child,.panel>.panel-collapse>.list-group:first-child .list-group-item:first-child{border-top:0;border-top-left-radius:3px;border-top-right-radius:3px}.panel>.list-group:last-child .list-group-item:last-child,.panel>.panel-collapse>.list-group:last-child .list-group-item:last-child{border-bottom:0;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.panel-heading+.panel-collapse>.list-group .list-group-item:first-child{border-top-left-radius:0;border-top-right-radius:0}.panel-heading+.list-group .list-group-item:first-child{border-top-width:0}.list-group+.panel-footer{border-top-width:0}.panel>.panel-collapse>.table,.panel>.table,.panel>.table-responsive>.table{margin-bottom:0}.panel>.panel-collapse>.table caption,.panel>.table caption,.panel>.table-responsive>.table caption{padding-right:15px;padding-left:15px}.panel>.table-responsive:first-child>.table:first-child,.panel>.table:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child,.panel>.table:first-child>thead:first-child>tr:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table:first-child>thead:first-child>tr:first-child th:first-child{border-top-left-radius:3px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table:first-child>thead:first-child>tr:first-child th:last-child{border-top-right-radius:3px}.panel>.table-responsive:last-child>.table:last-child,.panel>.table:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:first-child{border-bottom-left-radius:3px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:last-child{border-bottom-right-radius:3px}.panel>.panel-body+.table,.panel>.panel-body+.table-responsive,.panel>.table+.panel-body,.panel>.table-responsive+.panel-body{border-top:1px solid #ddd}.panel>.table>tbody:first-child>tr:first-child td,.panel>.table>tbody:first-child>tr:first-child th{border-top:0}.panel>.table-bordered,.panel>.table-responsive>.table-bordered{border:0}.panel>.table-bordered>tbody>tr>td:first-child,.panel>.table-bordered>tbody>tr>th:first-child,.panel>.table-bordered>tfoot>tr>td:first-child,.panel>.table-bordered>tfoot>tr>th:first-child,.panel>.table-bordered>thead>tr>td:first-child,.panel>.table-bordered>thead>tr>th:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:first-child,.panel>.table-responsive>.table-bordered>thead>tr>td:first-child,.panel>.table-responsive>.table-bordered>thead>tr>th:first-child{border-left:0}.panel>.table-bordered>tbody>tr>td:last-child,.panel>.table-bordered>tbody>tr>th:last-child,.panel>.table-bordered>tfoot>tr>td:last-child,.panel>.table-bordered>tfoot>tr>th:last-child,.panel>.table-bordered>thead>tr>td:last-child,.panel>.table-bordered>thead>tr>th:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:last-child,.panel>.table-responsive>.table-bordered>thead>tr>td:last-child,.panel>.table-responsive>.table-bordered>thead>tr>th:last-child{border-right:0}.panel>.table-bordered>tbody>tr:first-child>td,.panel>.table-bordered>tbody>tr:first-child>th,.panel>.table-bordered>thead>tr:first-child>td,.panel>.table-bordered>thead>tr:first-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>th,.panel>.table-responsive>.table-bordered>thead>tr:first-child>td,.panel>.table-responsive>.table-bordered>thead>tr:first-child>th{border-bottom:0}.panel>.table-bordered>tbody>tr:last-child>td,.panel>.table-bordered>tbody>tr:last-child>th,.panel>.table-bordered>tfoot>tr:last-child>td,.panel>.table-bordered>tfoot>tr:last-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>th,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>td,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}.panel>.table-responsive{margin-bottom:0;border:0}.panel-group{margin-bottom:20px}.panel-group .panel{margin-bottom:0;border-radius:4px}.panel-group .panel+.panel{margin-top:5px}.panel-group .panel-heading{border-bottom:0}.panel-group .panel-heading+.panel-collapse>.list-group,.panel-group .panel-heading+.panel-collapse>.panel-body{border-top:1px solid #ddd}.panel-group .panel-footer{border-top:0}.panel-group .panel-footer+.panel-collapse .panel-body{border-bottom:1px solid #ddd}.panel-default{border-color:#ddd}.panel-default>.panel-heading{color:#333;background-color:#f5f5f5;border-color:#ddd}.panel-default>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ddd}.panel-default>.panel-heading .badge{color:#f5f5f5;background-color:#333}.panel-default>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ddd}.panel-primary{border-color:#337ab7}.panel-primary>.panel-heading{color:#fff;background-color:#337ab7;border-color:#337ab7}.panel-primary>.panel-heading+.panel-collapse>.panel-body{border-top-color:#337ab7}.panel-primary>.panel-heading .badge{color:#337ab7;background-color:#fff}.panel-primary>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#337ab7}.panel-success{border-color:#d6e9c6}.panel-success>.panel-heading{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.panel-success>.panel-heading+.panel-collapse>.panel-body{border-top-color:#d6e9c6}.panel-success>.panel-heading .badge{color:#dff0d8;background-color:#3c763d}.panel-success>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#d6e9c6}.panel-info{border-color:#bce8f1}.panel-info>.panel-heading{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.panel-info>.panel-heading+.panel-collapse>.panel-body{border-top-color:#bce8f1}.panel-info>.panel-heading .badge{color:#d9edf7;background-color:#31708f}.panel-info>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#bce8f1}.panel-warning{border-color:#faebcc}.panel-warning>.panel-heading{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.panel-warning>.panel-heading+.panel-collapse>.panel-body{border-top-color:#faebcc}.panel-warning>.panel-heading .badge{color:#fcf8e3;background-color:#8a6d3b}.panel-warning>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#faebcc}.panel-danger{border-color:#ebccd1}.panel-danger>.panel-heading{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.panel-danger>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ebccd1}.panel-danger>.panel-heading .badge{color:#f2dede;background-color:#a94442}.panel-danger>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ebccd1}.embed-responsive{position:relative;display:block;height:0;padding:0;overflow:hidden}.embed-responsive .embed-responsive-item,.embed-responsive embed,.embed-responsive iframe,.embed-responsive object,.embed-responsive video{position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;border:0}.embed-responsive-16by9{padding-bottom:56.25%}.embed-responsive-4by3{padding-bottom:75%}.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.05);box-shadow:inset 0 1px 1px rgba(0,0,0,.05)}.well blockquote{border-color:#ddd;border-color:rgba(0,0,0,.15)}.well-lg{padding:24px;border-radius:6px}.well-sm{padding:9px;border-radius:3px}.close{float:right;font-size:21px;font-weight:700;line-height:1;color:#000;text-shadow:0 1px 0 #fff;filter:alpha(opacity=20);opacity:.2}.close:focus,.close:hover{color:#000;text-decoration:none;cursor:pointer;filter:alpha(opacity=50);opacity:.5}button.close{-webkit-appearance:none;padding:0;cursor:pointer;background:0 0;border:0}.modal-open{overflow:hidden}.modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1050;display:none;overflow:hidden;-webkit-overflow-scrolling:touch;outline:0}.modal.fade .modal-dialog{-webkit-transition:-webkit-transform .3s ease-out;-o-transition:-o-transform .3s ease-out;transition:transform .3s ease-out;-webkit-transform:translate(0,-25%);-ms-transform:translate(0,-25%);-o-transform:translate(0,-25%);transform:translate(0,-25%)}.modal.in .modal-dialog{-webkit-transform:translate(0,0);-ms-transform:translate(0,0);-o-transform:translate(0,0);transform:translate(0,0)}.modal-open .modal{overflow-x:hidden;overflow-y:auto}.modal-dialog{position:relative;width:auto;margin:10px}.modal-content{position:relative;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #999;border:1px solid rgba(0,0,0,.2);border-radius:6px;outline:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5)}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000}.modal-backdrop.fade{filter:alpha(opacity=0);opacity:0}.modal-backdrop.in{filter:alpha(opacity=50);opacity:.5}.modal-header{padding:15px;border-bottom:1px solid #e5e5e5}.modal-header .close{margin-top:-2px}.modal-title{margin:0;line-height:1.42857143}.modal-body{position:relative;padding:15px}.modal-footer{padding:15px;text-align:right;border-top:1px solid #e5e5e5}.modal-footer .btn+.btn{margin-bottom:0;margin-left:5px}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.modal-footer .btn-block+.btn-block{margin-left:0}.modal-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}@media (min-width:768px){.modal-dialog{width:600px;margin:30px auto}.modal-content{-webkit-box-shadow:0 5px 15px rgba(0,0,0,.5);box-shadow:0 5px 15px rgba(0,0,0,.5)}.modal-sm{width:300px}}@media (min-width:992px){.modal-lg{width:900px}}.tooltip{position:absolute;z-index:1070;display:block;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:12px;font-style:normal;font-weight:400;line-height:1.42857143;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;word-wrap:normal;white-space:normal;filter:alpha(opacity=0);opacity:0;line-break:auto}.tooltip.in{filter:alpha(opacity=90);opacity:.9}.tooltip.top{padding:5px 0;margin-top:-3px}.tooltip.right{padding:0 5px;margin-left:3px}.tooltip.bottom{padding:5px 0;margin-top:3px}.tooltip.left{padding:0 5px;margin-left:-3px}.tooltip-inner{max-width:200px;padding:3px 8px;color:#fff;text-align:center;background-color:#000;border-radius:4px}.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-left .tooltip-arrow{right:5px;bottom:0;margin-bottom:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-right .tooltip-arrow{bottom:0;left:5px;margin-bottom:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-width:5px 5px 5px 0;border-right-color:#000}.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-width:5px 0 5px 5px;border-left-color:#000}.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-left .tooltip-arrow{top:0;right:5px;margin-top:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-right .tooltip-arrow{top:0;left:5px;margin-top:-5px;border-width:0 5px 5px;border-bottom-color:#000}.popover{position:absolute;top:0;left:0;z-index:1060;display:none;max-width:276px;padding:1px;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;font-style:normal;font-weight:400;line-height:1.42857143;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;word-wrap:normal;white-space:normal;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.2);border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);line-break:auto}.popover.top{margin-top:-10px}.popover.right{margin-left:10px}.popover.bottom{margin-top:10px}.popover.left{margin-left:-10px}.popover-title{padding:8px 14px;margin:0;font-size:14px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-radius:5px 5px 0 0}.popover-content{padding:9px 14px}.popover>.arrow,.popover>.arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.popover>.arrow{border-width:11px}.popover>.arrow:after{content:"";border-width:10px}.popover.top>.arrow{bottom:-11px;left:50%;margin-left:-11px;border-top-color:#999;border-top-color:rgba(0,0,0,.25);border-bottom-width:0}.popover.top>.arrow:after{bottom:1px;margin-left:-10px;content:" ";border-top-color:#fff;border-bottom-width:0}.popover.right>.arrow{top:50%;left:-11px;margin-top:-11px;border-right-color:#999;border-right-color:rgba(0,0,0,.25);border-left-width:0}.popover.right>.arrow:after{bottom:-10px;left:1px;content:" ";border-right-color:#fff;border-left-width:0}.popover.bottom>.arrow{top:-11px;left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#999;border-bottom-color:rgba(0,0,0,.25)}.popover.bottom>.arrow:after{top:1px;margin-left:-10px;content:" ";border-top-width:0;border-bottom-color:#fff}.popover.left>.arrow{top:50%;right:-11px;margin-top:-11px;border-right-width:0;border-left-color:#999;border-left-color:rgba(0,0,0,.25)}.popover.left>.arrow:after{right:1px;bottom:-10px;content:" ";border-right-width:0;border-left-color:#fff}.carousel{position:relative}.carousel-inner{position:relative;width:100%;overflow:hidden}.carousel-inner>.item{position:relative;display:none;-webkit-transition:.6s ease-in-out left;-o-transition:.6s ease-in-out left;transition:.6s ease-in-out left}.carousel-inner>.item>a>img,.carousel-inner>.item>img{line-height:1}@media all and (transform-3d),(-webkit-transform-3d){.carousel-inner>.item{-webkit-transition:-webkit-transform .6s ease-in-out;-o-transition:-o-transform .6s ease-in-out;transition:transform .6s ease-in-out;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-perspective:1000px;perspective:1000px}.carousel-inner>.item.active.right,.carousel-inner>.item.next{left:0;-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}.carousel-inner>.item.active.left,.carousel-inner>.item.prev{left:0;-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}.carousel-inner>.item.active,.carousel-inner>.item.next.left,.carousel-inner>.item.prev.right{left:0;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}.carousel-inner>.active,.carousel-inner>.next,.carousel-inner>.prev{display:block}.carousel-inner>.active{left:0}.carousel-inner>.next,.carousel-inner>.prev{position:absolute;top:0;width:100%}.carousel-inner>.next{left:100%}.carousel-inner>.prev{left:-100%}.carousel-inner>.next.left,.carousel-inner>.prev.right{left:0}.carousel-inner>.active.left{left:-100%}.carousel-inner>.active.right{left:100%}.carousel-control{position:absolute;top:0;bottom:0;left:0;width:15%;font-size:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6);background-color:rgba(0,0,0,0);filter:alpha(opacity=50);opacity:.5}.carousel-control.left{background-image:-webkit-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.5)),to(rgba(0,0,0,.0001)));background-image:linear-gradient(to right,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1);background-repeat:repeat-x}.carousel-control.right{right:0;left:auto;background-image:-webkit-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.0001)),to(rgba(0,0,0,.5)));background-image:linear-gradient(to right,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1);background-repeat:repeat-x}.carousel-control:focus,.carousel-control:hover{color:#fff;text-decoration:none;filter:alpha(opacity=90);outline:0;opacity:.9}.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next,.carousel-control .icon-prev{position:absolute;top:50%;z-index:5;display:inline-block;margin-top:-10px}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{left:50%;margin-left:-10px}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{right:50%;margin-right:-10px}.carousel-control .icon-next,.carousel-control .icon-prev{width:20px;height:20px;font-family:serif;line-height:1}.carousel-control .icon-prev:before{content:'\2039'}.carousel-control .icon-next:before{content:'\203a'}.carousel-indicators{position:absolute;bottom:10px;left:50%;z-index:15;width:60%;padding-left:0;margin-left:-30%;text-align:center;list-style:none}.carousel-indicators li{display:inline-block;width:10px;height:10px;margin:1px;text-indent:-999px;cursor:pointer;background-color:#000\9;background-color:rgba(0,0,0,0);border:1px solid #fff;border-radius:10px}.carousel-indicators .active{width:12px;height:12px;margin:0;background-color:#fff}.carousel-caption{position:absolute;right:15%;bottom:20px;left:15%;z-index:10;padding-top:20px;padding-bottom:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6)}.carousel-caption .btn{text-shadow:none}@media screen and (min-width:768px){.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next,.carousel-control .icon-prev{width:30px;height:30px;margin-top:-10px;font-size:30px}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{margin-left:-10px}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{margin-right:-10px}.carousel-caption{right:20%;left:20%;padding-bottom:30px}.carousel-indicators{bottom:20px}}.btn-group-vertical>.btn-group:after,.btn-group-vertical>.btn-group:before,.btn-toolbar:after,.btn-toolbar:before,.clearfix:after,.clearfix:before,.container-fluid:after,.container-fluid:before,.container:after,.container:before,.dl-horizontal dd:after,.dl-horizontal dd:before,.form-horizontal .form-group:after,.form-horizontal .form-group:before,.modal-footer:after,.modal-footer:before,.modal-header:after,.modal-header:before,.nav:after,.nav:before,.navbar-collapse:after,.navbar-collapse:before,.navbar-header:after,.navbar-header:before,.navbar:after,.navbar:before,.pager:after,.pager:before,.panel-body:after,.panel-body:before,.row:after,.row:before{display:table;content:" "}.btn-group-vertical>.btn-group:after,.btn-toolbar:after,.clearfix:after,.container-fluid:after,.container:after,.dl-horizontal dd:after,.form-horizontal .form-group:after,.modal-footer:after,.modal-header:after,.nav:after,.navbar-collapse:after,.navbar-header:after,.navbar:after,.pager:after,.panel-body:after,.row:after{clear:both}.center-block{display:block;margin-right:auto;margin-left:auto}.pull-right{float:right!important}.pull-left{float:left!important}.hide{display:none!important}.show{display:block!important}.invisible{visibility:hidden}.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.hidden{display:none!important}.affix{position:fixed}@-ms-viewport{width:device-width}.visible-lg,.visible-md,.visible-sm,.visible-xs{display:none!important}.visible-lg-block,.visible-lg-inline,.visible-lg-inline-block,.visible-md-block,.visible-md-inline,.visible-md-inline-block,.visible-sm-block,.visible-sm-inline,.visible-sm-inline-block,.visible-xs-block,.visible-xs-inline,.visible-xs-inline-block{display:none!important}@media (max-width:767px){.visible-xs{display:block!important}table.visible-xs{display:table!important}tr.visible-xs{display:table-row!important}td.visible-xs,th.visible-xs{display:table-cell!important}}@media (max-width:767px){.visible-xs-block{display:block!important}}@media (max-width:767px){.visible-xs-inline{display:inline!important}}@media (max-width:767px){.visible-xs-inline-block{display:inline-block!important}}@media (min-width:768px) and (max-width:991px){.visible-sm{display:block!important}table.visible-sm{display:table!important}tr.visible-sm{display:table-row!important}td.visible-sm,th.visible-sm{display:table-cell!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-block{display:block!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline{display:inline!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline-block{display:inline-block!important}}@media (min-width:992px) and (max-width:1199px){.visible-md{display:block!important}table.visible-md{display:table!important}tr.visible-md{display:table-row!important}td.visible-md,th.visible-md{display:table-cell!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-block{display:block!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline{display:inline!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline-block{display:inline-block!important}}@media (min-width:1200px){.visible-lg{display:block!important}table.visible-lg{display:table!important}tr.visible-lg{display:table-row!important}td.visible-lg,th.visible-lg{display:table-cell!important}}@media (min-width:1200px){.visible-lg-block{display:block!important}}@media (min-width:1200px){.visible-lg-inline{display:inline!important}}@media (min-width:1200px){.visible-lg-inline-block{display:inline-block!important}}@media (max-width:767px){.hidden-xs{display:none!important}}@media (min-width:768px) and (max-width:991px){.hidden-sm{display:none!important}}@media (min-width:992px) and (max-width:1199px){.hidden-md{display:none!important}}@media (min-width:1200px){.hidden-lg{display:none!important}}.visible-print{display:none!important}@media print{.visible-print{display:block!important}table.visible-print{display:table!important}tr.visible-print{display:table-row!important}td.visible-print,th.visible-print{display:table-cell!important}}.visible-print-block{display:none!important}@media print{.visible-print-block{display:block!important}}.visible-print-inline{display:none!important}@media print{.visible-print-inline{display:inline!important}}.visible-print-inline-block{display:none!important}@media print{.visible-print-inline-block{display:inline-block!important}}@media print{.hidden-print{display:none!important}} +/*# sourceMappingURL=bootstrap.min.css.map */ \ No newline at end of file diff --git a/Fee Management System/WebContent/resources/bootstrap.min.js b/Fee Management System/WebContent/resources/bootstrap.min.js new file mode 100644 index 00000000..133aeecb --- /dev/null +++ b/Fee Management System/WebContent/resources/bootstrap.min.js @@ -0,0 +1,7 @@ +/*! + * Bootstrap v3.3.5 (http://getbootstrap.com) + * Copyright 2011-2015 Twitter, Inc. + * Licensed under the MIT license + */ +if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";var b=a.fn.jquery.split(" ")[0].split(".");if(b[0]<2&&b[1]<9||1==b[0]&&9==b[1]&&b[2]<1)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher")}(jQuery),+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){return a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.3.5",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function c(){g.detach().trigger("closed.bs.alert").remove()}var e=a(this),f=e.attr("data-target");f||(f=e.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,""));var g=a(f);b&&b.preventDefault(),g.length||(g=e.closest(".alert")),g.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(g.removeClass("in"),a.support.transition&&g.hasClass("fade")?g.one("bsTransitionEnd",c).emulateTransitionEnd(d.TRANSITION_DURATION):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.3.5",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),setTimeout(a.proxy(function(){d[e](null==f[b]?this.options[b]:f[b]),"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")?(c.prop("checked")&&(a=!1),b.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==c.prop("type")&&(c.prop("checked")!==this.$element.hasClass("active")&&(a=!1),this.$element.toggleClass("active")),c.prop("checked",this.$element.hasClass("active")),a&&c.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target);d.hasClass("btn")||(d=d.closest(".btn")),b.call(d,"toggle"),a(c.target).is('input[type="radio"]')||a(c.target).is('input[type="checkbox"]')||c.preventDefault()}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(b){a(b.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(b.type))})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",a.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.3.5",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(a){if(!/input|textarea/i.test(a.target.tagName)){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()}},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.getItemForDirection=function(a,b){var c=this.getItemIndex(b),d="prev"==a&&0===c||"next"==a&&c==this.$items.length-1;if(d&&!this.options.wrap)return b;var e="prev"==a?-1:1,f=(c+e)%this.$items.length;return this.$items.eq(f)},c.prototype.to=function(a){var b=this,c=this.getItemIndex(this.$active=this.$element.find(".item.active"));return a>this.$items.length-1||0>a?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){b.to(a)}):c==a?this.pause().cycle():this.slide(a>c?"next":"prev",this.$items.eq(a))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){return this.sliding?void 0:this.slide("next")},c.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},c.prototype.slide=function(b,d){var e=this.$element.find(".item.active"),f=d||this.getItemForDirection(b,e),g=this.interval,h="next"==b?"left":"right",i=this;if(f.hasClass("active"))return this.sliding=!1;var j=f[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:h});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,g&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(f)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:h});return a.support.transition&&this.$element.hasClass("slide")?(f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),e.one("bsTransitionEnd",function(){f.removeClass([b,h].join(" ")).addClass("active"),e.removeClass(["active",h].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(e.removeClass("active"),f.addClass("active"),this.sliding=!1,this.$element.trigger(m)),g&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this};var e=function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}};a(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){var c,d=b.attr("data-target")||(c=b.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"");return a(d)}function c(b){return this.each(function(){var c=a(this),e=c.data("bs.collapse"),f=a.extend({},d.DEFAULTS,c.data(),"object"==typeof b&&b);!e&&f.toggle&&/show|hide/.test(b)&&(f.toggle=!1),e||c.data("bs.collapse",e=new d(this,f)),"string"==typeof b&&e[b]()})}var d=function(b,c){this.$element=a(b),this.options=a.extend({},d.DEFAULTS,c),this.$trigger=a('[data-toggle="collapse"][href="#'+b.id+'"],[data-toggle="collapse"][data-target="#'+b.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};d.VERSION="3.3.5",d.TRANSITION_DURATION=350,d.DEFAULTS={toggle:!0},d.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},d.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(b=e.data("bs.collapse"),b&&b.transitioning))){var f=a.Event("show.bs.collapse");if(this.$element.trigger(f),!f.isDefaultPrevented()){e&&e.length&&(c.call(e,"hide"),b||e.data("bs.collapse",null));var g=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[g](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var h=function(){this.$element.removeClass("collapsing").addClass("collapse in")[g](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return h.call(this);var i=a.camelCase(["scroll",g].join("-"));this.$element.one("bsTransitionEnd",a.proxy(h,this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i])}}}},d.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var e=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(e,this)).emulateTransitionEnd(d.TRANSITION_DURATION):e.call(this)}}},d.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},d.prototype.getParent=function(){return a(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(c,d){var e=a(d);this.addAriaAndCollapsedClass(b(e),e)},this)).end()},d.prototype.addAriaAndCollapsedClass=function(a,b){var c=a.hasClass("in");a.attr("aria-expanded",c),b.toggleClass("collapsed",!c).attr("aria-expanded",c)};var e=a.fn.collapse;a.fn.collapse=c,a.fn.collapse.Constructor=d,a.fn.collapse.noConflict=function(){return a.fn.collapse=e,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(d){var e=a(this);e.attr("data-target")||d.preventDefault();var f=b(e),g=f.data("bs.collapse"),h=g?"toggle":e.data();c.call(f,h)})}(jQuery),+function(a){"use strict";function b(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function c(c){c&&3===c.which||(a(e).remove(),a(f).each(function(){var d=a(this),e=b(d),f={relatedTarget:this};e.hasClass("open")&&(c&&"click"==c.type&&/input|textarea/i.test(c.target.tagName)&&a.contains(e[0],c.target)||(e.trigger(c=a.Event("hide.bs.dropdown",f)),c.isDefaultPrevented()||(d.attr("aria-expanded","false"),e.removeClass("open").trigger("hidden.bs.dropdown",f))))}))}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.3.5",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=b(e),g=f.hasClass("open");if(c(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click",c);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),f.toggleClass("open").trigger("shown.bs.dropdown",h)}return!1}},g.prototype.keydown=function(c){if(/(38|40|27|32)/.test(c.which)&&!/input|textarea/i.test(c.target.tagName)){var d=a(this);if(c.preventDefault(),c.stopPropagation(),!d.is(".disabled, :disabled")){var e=b(d),g=e.hasClass("open");if(!g&&27!=c.which||g&&27==c.which)return 27==c.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.disabled):visible a",i=e.find(".dropdown-menu"+h);if(i.length){var j=i.index(c.target);38==c.which&&j>0&&j--,40==c.which&&jdocument.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&a?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!a?this.scrollbarWidth:""})},c.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},c.prototype.checkScrollbar=function(){var a=window.innerWidth;if(!a){var b=document.documentElement.getBoundingClientRect();a=b.right-Math.abs(b.left)}this.bodyIsOverflowing=document.body.clientWidth
',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){if(this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(a.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusin"==b.type?"focus":"hover"]=!0),c.tip().hasClass("in")||"in"==c.hoverState?void(c.hoverState="in"):(clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show())},c.prototype.isInStateTrue=function(){for(var a in this.inState)if(this.inState[a])return!0;return!1},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusout"==b.type?"focus":"hover"]=!1),c.isInStateTrue()?void 0:(clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide())},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var d=a.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!d)return;var e=this,f=this.tip(),g=this.getUID(this.type);this.setContent(),f.attr("id",g),this.$element.attr("aria-describedby",g),this.options.animation&&f.addClass("fade");var h="function"==typeof this.options.placement?this.options.placement.call(this,f[0],this.$element[0]):this.options.placement,i=/\s?auto?\s?/i,j=i.test(h);j&&(h=h.replace(i,"")||"top"),f.detach().css({top:0,left:0,display:"block"}).addClass(h).data("bs."+this.type,this),this.options.container?f.appendTo(this.options.container):f.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var k=this.getPosition(),l=f[0].offsetWidth,m=f[0].offsetHeight;if(j){var n=h,o=this.getPosition(this.$viewport);h="bottom"==h&&k.bottom+m>o.bottom?"top":"top"==h&&k.top-mo.width?"left":"left"==h&&k.left-lg.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;jg.right&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){if(!this.$tip&&(this.$tip=a(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),b?(c.inState.click=!c.inState.click,c.isInStateTrue()?c.enter(c):c.leave(c)):c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){var a=this;clearTimeout(this.timeout),this.hide(function(){a.$element.off("."+a.type).removeData("bs."+a.type),a.$tip&&a.$tip.detach(),a.$tip=null,a.$arrow=null,a.$viewport=null})};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;(e||!/destroy|hide/.test(b))&&(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.3.5",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:''}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){this.$body=a(document.body),this.$scrollElement=a(a(c).is(document.body)?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",a.proxy(this.process,this)),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.3.5",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b=this,c="offset",d=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),a.isWindow(this.$scrollElement[0])||(c="position",d=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var b=a(this),e=b.data("target")||b.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[c]().top+d,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b=e[a]&&(void 0===e[a+1]||b .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),b.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),h?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu").length&&b.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),e&&e()}var g=d.find("> .active"),h=e&&a.support.transition&&(g.length&&g.hasClass("fade")||!!d.find("> .fade").length);g.length&&h?g.one("bsTransitionEnd",f).emulateTransitionEnd(c.TRANSITION_DURATION):f(),g.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this};var e=function(c){c.preventDefault(),b.call(a(this),"show")};a(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',e).on("click.bs.tab.data-api",'[data-toggle="pill"]',e)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.3.5",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getState=function(a,b,c,d){var e=this.$target.scrollTop(),f=this.$element.offset(),g=this.$target.height();if(null!=c&&"top"==this.affixed)return c>e?"top":!1;if("bottom"==this.affixed)return null!=c?e+this.unpin<=f.top?!1:"bottom":a-d>=e+g?!1:"bottom";var h=null==this.affixed,i=h?e:f.top,j=h?g:b;return null!=c&&c>=e?"top":null!=d&&i+j>=a-d?"bottom":!1},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=this.$element.height(),d=this.options.offset,e=d.top,f=d.bottom,g=Math.max(a(document).height(),a(document.body).height());"object"!=typeof d&&(f=e=d),"function"==typeof e&&(e=d.top(this.$element)),"function"==typeof f&&(f=d.bottom(this.$element));var h=this.getState(g,b,e,f);if(this.affixed!=h){null!=this.unpin&&this.$element.css("top","");var i="affix"+(h?"-"+h:""),j=a.Event(i+".bs.affix");if(this.$element.trigger(j),j.isDefaultPrevented())return;this.affixed=h,this.unpin="bottom"==h?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace("affix","affixed")+".bs.affix")}"bottom"==h&&this.$element.offset({top:g-b-f})}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},null!=d.offsetBottom&&(d.offset.bottom=d.offsetBottom),null!=d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery); \ No newline at end of file diff --git a/Fee Management System/WebContent/resources/images/accountant1.jpg b/Fee Management System/WebContent/resources/images/accountant1.jpg new file mode 100644 index 00000000..2a2aa701 Binary files /dev/null and b/Fee Management System/WebContent/resources/images/accountant1.jpg differ diff --git a/Fee Management System/WebContent/resources/images/accountant2.jpg b/Fee Management System/WebContent/resources/images/accountant2.jpg new file mode 100644 index 00000000..92430832 Binary files /dev/null and b/Fee Management System/WebContent/resources/images/accountant2.jpg differ diff --git a/Fee Management System/WebContent/resources/images/accountant3.jpeg b/Fee Management System/WebContent/resources/images/accountant3.jpeg new file mode 100644 index 00000000..04c0cd42 Binary files /dev/null and b/Fee Management System/WebContent/resources/images/accountant3.jpeg differ diff --git a/Fee Management System/WebContent/resources/images/admin1.jpg b/Fee Management System/WebContent/resources/images/admin1.jpg new file mode 100644 index 00000000..5e433613 Binary files /dev/null and b/Fee Management System/WebContent/resources/images/admin1.jpg differ diff --git a/Fee Management System/WebContent/resources/images/admin2.jpg b/Fee Management System/WebContent/resources/images/admin2.jpg new file mode 100644 index 00000000..bce18950 Binary files /dev/null and b/Fee Management System/WebContent/resources/images/admin2.jpg differ diff --git a/Fee Management System/WebContent/resources/images/admin3.jpg b/Fee Management System/WebContent/resources/images/admin3.jpg new file mode 100644 index 00000000..0165efec Binary files /dev/null and b/Fee Management System/WebContent/resources/images/admin3.jpg differ diff --git a/Fee Management System/WebContent/resources/jquery.min.js b/Fee Management System/WebContent/resources/jquery.min.js new file mode 100644 index 00000000..f3644431 --- /dev/null +++ b/Fee Management System/WebContent/resources/jquery.min.js @@ -0,0 +1,6 @@ +/*! jQuery v1.11.3 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */ +!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.3",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)+1>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b="length"in a&&a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,aa=/[+~]/,ba=/'|\\/g,ca=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),da=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ea=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fa){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(ba,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+ra(o[l]);w=aa.test(a)&&pa(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function pa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",ea,!1):e.attachEvent&&e.attachEvent("onunload",ea)),p=!f(g),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?la(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ca,da),a[3]=(a[3]||a[4]||a[5]||"").replace(ca,da),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ca,da).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(Q," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(ca,da),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return W.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(ca,da).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:oa(function(){return[0]}),last:oa(function(a,b){return[b-1]}),eq:oa(function(a,b,c){return[0>c?c+b:c]}),even:oa(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:oa(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:oa(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:oa(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function sa(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function ta(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ua(a,b,c){for(var d=0,e=b.length;e>d;d++)ga(a,b[d],c);return c}function va(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wa(a,b,c,d,e,f){return d&&!d[u]&&(d=wa(d)),e&&!e[u]&&(e=wa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ua(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:va(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=va(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=va(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sa(function(a){return a===b},h,!0),l=sa(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sa(ta(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wa(i>1&&ta(m),i>1&&ra(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xa(a.slice(i,e)),f>e&&xa(a=a.slice(e)),f>e&&ra(a))}m.push(c)}return ta(m)}function ya(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=va(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&ga.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,ya(e,d)),f.selector=a}return f},i=ga.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ca,da),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ca,da),aa.test(j[0].type)&&pa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&ra(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,aa.test(a)&&pa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ja(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1; + +return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthh;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML="
a",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function aa(){return!0}function ba(){return!1}function ca(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h]","i"),ha=/^\s+/,ia=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ja=/<([\w:]+)/,ka=/\s*$/g,ra={option:[1,""],legend:[1,"
","
"],area:[1,"",""],param:[1,"",""],thead:[1,"","
"],tr:[2,"","
"],col:[2,"","
"],td:[3,"","
"],_default:k.htmlSerialize?[0,"",""]:[1,"X
","
"]},sa=da(y),ta=sa.appendChild(y.createElement("div"));ra.optgroup=ra.option,ra.tbody=ra.tfoot=ra.colgroup=ra.caption=ra.thead,ra.th=ra.td;function ua(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ua(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function va(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wa(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xa(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function ya(a){var b=pa.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function za(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Aa(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Ba(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xa(b).text=a.text,ya(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!ga.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(ta.innerHTML=a.outerHTML,ta.removeChild(f=ta.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ua(f),h=ua(a),g=0;null!=(e=h[g]);++g)d[g]&&Ba(e,d[g]);if(b)if(c)for(h=h||ua(a),d=d||ua(f),g=0;null!=(e=h[g]);g++)Aa(e,d[g]);else Aa(a,f);return d=ua(f,"script"),d.length>0&&za(d,!i&&ua(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=da(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(la.test(f)){h=h||o.appendChild(b.createElement("div")),i=(ja.exec(f)||["",""])[1].toLowerCase(),l=ra[i]||ra._default,h.innerHTML=l[1]+f.replace(ia,"<$1>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&ha.test(f)&&p.push(b.createTextNode(ha.exec(f)[0])),!k.tbody){f="table"!==i||ka.test(f)?""!==l[1]||ka.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ua(p,"input"),va),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ua(o.appendChild(f),"script"),g&&za(h),c)){e=0;while(f=h[e++])oa.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wa(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wa(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ua(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&za(ua(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ua(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fa,""):void 0;if(!("string"!=typeof a||ma.test(a)||!k.htmlSerialize&&ga.test(a)||!k.leadingWhitespace&&ha.test(a)||ra[(ja.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ia,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ua(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ua(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&na.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ua(i,"script"),xa),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ua(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,ya),j=0;f>j;j++)d=g[j],oa.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qa,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Ca,Da={};function Ea(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fa(a){var b=y,c=Da[a];return c||(c=Ea(a,b),"none"!==c&&c||(Ca=(Ca||m("