diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..3b41682
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,2 @@
+/mvnw text eol=lf
+*.cmd text eol=crlf
diff --git a/.gitignore b/.gitignore
index b2f6a11..549e00a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,9 +1,10 @@
-### IntelliJ IDEA ###
-out/
-!**/src/main/**/out/
-!**/src/test/**/out/
+HELP.md
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
-### Eclipse ###
+### STS ###
.apt_generated
.classpath
.factorypath
@@ -11,9 +12,12 @@ out/
.settings
.springBeans
.sts4-cache
-bin/
-!**/src/main/**/bin/
-!**/src/test/**/bin/
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
### NetBeans ###
/nbproject/private/
@@ -21,9 +25,9 @@ bin/
/dist/
/nbdist/
/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
-### VS Homework.Code ###
+### VS Code ###
.vscode/
-
-### Mac OS ###
-.DS_Store
\ No newline at end of file
diff --git a/.idea/.gitignore b/.idea/.gitignore
deleted file mode 100644
index 26d3352..0000000
--- a/.idea/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-# Default ignored files
-/shelf/
-/workspace.xml
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index 208e2c3..0000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index 4a57301..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
deleted file mode 100644
index 2b63946..0000000
--- a/.idea/uiDesigner.xml
+++ /dev/null
@@ -1,124 +0,0 @@
-
-
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
-
-
-
- -
-
-
-
-
-
- -
-
-
-
-
-
- -
-
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
-
-
- -
-
-
- -
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 94a25f7..0000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties
new file mode 100644
index 0000000..d58dfb7
--- /dev/null
+++ b/.mvn/wrapper/maven-wrapper.properties
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+wrapperVersion=3.3.2
+distributionType=only-script
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
diff --git a/Java2.iml b/Java2.iml
deleted file mode 100644
index c3dc060..0000000
--- a/Java2.iml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/example.txt b/example.txt
deleted file mode 100644
index 37a5b15..0000000
--- a/example.txt
+++ /dev/null
@@ -1 +0,0 @@
-Domande
\ No newline at end of file
diff --git a/mvnw b/mvnw
new file mode 100644
index 0000000..19529dd
--- /dev/null
+++ b/mvnw
@@ -0,0 +1,259 @@
+#!/bin/sh
+# ----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# ----------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------
+# Apache Maven Wrapper startup batch script, version 3.3.2
+#
+# Optional ENV vars
+# -----------------
+# JAVA_HOME - location of a JDK home dir, required when download maven via java source
+# MVNW_REPOURL - repo url base for downloading maven distribution
+# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
+# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output
+# ----------------------------------------------------------------------------
+
+set -euf
+[ "${MVNW_VERBOSE-}" != debug ] || set -x
+
+# OS specific support.
+native_path() { printf %s\\n "$1"; }
+case "$(uname)" in
+CYGWIN* | MINGW*)
+ [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")"
+ native_path() { cygpath --path --windows "$1"; }
+ ;;
+esac
+
+# set JAVACMD and JAVACCMD
+set_java_home() {
+ # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched
+ if [ -n "${JAVA_HOME-}" ]; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ]; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ JAVACCMD="$JAVA_HOME/jre/sh/javac"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ JAVACCMD="$JAVA_HOME/bin/javac"
+
+ if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then
+ echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2
+ echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2
+ return 1
+ fi
+ fi
+ else
+ JAVACMD="$(
+ 'set' +e
+ 'unset' -f command 2>/dev/null
+ 'command' -v java
+ )" || :
+ JAVACCMD="$(
+ 'set' +e
+ 'unset' -f command 2>/dev/null
+ 'command' -v javac
+ )" || :
+
+ if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then
+ echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2
+ return 1
+ fi
+ fi
+}
+
+# hash string like Java String::hashCode
+hash_string() {
+ str="${1:-}" h=0
+ while [ -n "$str" ]; do
+ char="${str%"${str#?}"}"
+ h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296))
+ str="${str#?}"
+ done
+ printf %x\\n $h
+}
+
+verbose() { :; }
+[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; }
+
+die() {
+ printf %s\\n "$1" >&2
+ exit 1
+}
+
+trim() {
+ # MWRAPPER-139:
+ # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds.
+ # Needed for removing poorly interpreted newline sequences when running in more
+ # exotic environments such as mingw bash on Windows.
+ printf "%s" "${1}" | tr -d '[:space:]'
+}
+
+# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties
+while IFS="=" read -r key value; do
+ case "${key-}" in
+ distributionUrl) distributionUrl=$(trim "${value-}") ;;
+ distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;;
+ esac
+done <"${0%/*}/.mvn/wrapper/maven-wrapper.properties"
+[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.mvn/wrapper/maven-wrapper.properties"
+
+case "${distributionUrl##*/}" in
+maven-mvnd-*bin.*)
+ MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/
+ case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in
+ *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;;
+ :Darwin*x86_64) distributionPlatform=darwin-amd64 ;;
+ :Darwin*arm64) distributionPlatform=darwin-aarch64 ;;
+ :Linux*x86_64*) distributionPlatform=linux-amd64 ;;
+ *)
+ echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2
+ distributionPlatform=linux-amd64
+ ;;
+ esac
+ distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip"
+ ;;
+maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;;
+*) MVN_CMD="mvn${0##*/mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;;
+esac
+
+# apply MVNW_REPOURL and calculate MAVEN_HOME
+# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/
+[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}"
+distributionUrlName="${distributionUrl##*/}"
+distributionUrlNameMain="${distributionUrlName%.*}"
+distributionUrlNameMain="${distributionUrlNameMain%-bin}"
+MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}"
+MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")"
+
+exec_maven() {
+ unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || :
+ exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD"
+}
+
+if [ -d "$MAVEN_HOME" ]; then
+ verbose "found existing MAVEN_HOME at $MAVEN_HOME"
+ exec_maven "$@"
+fi
+
+case "${distributionUrl-}" in
+*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;;
+*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;;
+esac
+
+# prepare tmp dir
+if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then
+ clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; }
+ trap clean HUP INT TERM EXIT
+else
+ die "cannot create temp dir"
+fi
+
+mkdir -p -- "${MAVEN_HOME%/*}"
+
+# Download and Install Apache Maven
+verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
+verbose "Downloading from: $distributionUrl"
+verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
+
+# select .zip or .tar.gz
+if ! command -v unzip >/dev/null; then
+ distributionUrl="${distributionUrl%.zip}.tar.gz"
+ distributionUrlName="${distributionUrl##*/}"
+fi
+
+# verbose opt
+__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR=''
+[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v
+
+# normalize http auth
+case "${MVNW_PASSWORD:+has-password}" in
+'') MVNW_USERNAME='' MVNW_PASSWORD='' ;;
+has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;;
+esac
+
+if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then
+ verbose "Found wget ... using wget"
+ wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl"
+elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then
+ verbose "Found curl ... using curl"
+ curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl"
+elif set_java_home; then
+ verbose "Falling back to use Java to download"
+ javaSource="$TMP_DOWNLOAD_DIR/Downloader.java"
+ targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName"
+ cat >"$javaSource" <<-END
+ public class Downloader extends java.net.Authenticator
+ {
+ protected java.net.PasswordAuthentication getPasswordAuthentication()
+ {
+ return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() );
+ }
+ public static void main( String[] args ) throws Exception
+ {
+ setDefault( new Downloader() );
+ java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() );
+ }
+ }
+ END
+ # For Cygwin/MinGW, switch paths to Windows format before running javac and java
+ verbose " - Compiling Downloader.java ..."
+ "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java"
+ verbose " - Running Downloader.java ..."
+ "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")"
+fi
+
+# If specified, validate the SHA-256 sum of the Maven distribution zip file
+if [ -n "${distributionSha256Sum-}" ]; then
+ distributionSha256Result=false
+ if [ "$MVN_CMD" = mvnd.sh ]; then
+ echo "Checksum validation is not supported for maven-mvnd." >&2
+ echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
+ exit 1
+ elif command -v sha256sum >/dev/null; then
+ if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c >/dev/null 2>&1; then
+ distributionSha256Result=true
+ fi
+ elif command -v shasum >/dev/null; then
+ if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then
+ distributionSha256Result=true
+ fi
+ else
+ echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2
+ echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
+ exit 1
+ fi
+ if [ $distributionSha256Result = false ]; then
+ echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2
+ echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2
+ exit 1
+ fi
+fi
+
+# unzip and move
+if command -v unzip >/dev/null; then
+ unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip"
+else
+ tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar"
+fi
+printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/mvnw.url"
+mv -- "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME"
+
+clean || :
+exec_maven "$@"
diff --git a/mvnw.cmd b/mvnw.cmd
new file mode 100644
index 0000000..249bdf3
--- /dev/null
+++ b/mvnw.cmd
@@ -0,0 +1,149 @@
+<# : batch portion
+@REM ----------------------------------------------------------------------------
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM ----------------------------------------------------------------------------
+
+@REM ----------------------------------------------------------------------------
+@REM Apache Maven Wrapper startup batch script, version 3.3.2
+@REM
+@REM Optional ENV vars
+@REM MVNW_REPOURL - repo url base for downloading maven distribution
+@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
+@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output
+@REM ----------------------------------------------------------------------------
+
+@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0)
+@SET __MVNW_CMD__=
+@SET __MVNW_ERROR__=
+@SET __MVNW_PSMODULEP_SAVE=%PSModulePath%
+@SET PSModulePath=
+@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @(
+ IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B)
+)
+@SET PSModulePath=%__MVNW_PSMODULEP_SAVE%
+@SET __MVNW_PSMODULEP_SAVE=
+@SET __MVNW_ARG0_NAME__=
+@SET MVNW_USERNAME=
+@SET MVNW_PASSWORD=
+@IF NOT "%__MVNW_CMD__%"=="" (%__MVNW_CMD__% %*)
+@echo Cannot start maven from wrapper >&2 && exit /b 1
+@GOTO :EOF
+: end batch / begin powershell #>
+
+$ErrorActionPreference = "Stop"
+if ($env:MVNW_VERBOSE -eq "true") {
+ $VerbosePreference = "Continue"
+}
+
+# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties
+$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl
+if (!$distributionUrl) {
+ Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties"
+}
+
+switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) {
+ "maven-mvnd-*" {
+ $USE_MVND = $true
+ $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip"
+ $MVN_CMD = "mvnd.cmd"
+ break
+ }
+ default {
+ $USE_MVND = $false
+ $MVN_CMD = $script -replace '^mvnw','mvn'
+ break
+ }
+}
+
+# apply MVNW_REPOURL and calculate MAVEN_HOME
+# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/
+if ($env:MVNW_REPOURL) {
+ $MVNW_REPO_PATTERN = if ($USE_MVND) { "/org/apache/maven/" } else { "/maven/mvnd/" }
+ $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace '^.*'+$MVNW_REPO_PATTERN,'')"
+}
+$distributionUrlName = $distributionUrl -replace '^.*/',''
+$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$',''
+$MAVEN_HOME_PARENT = "$HOME/.m2/wrapper/dists/$distributionUrlNameMain"
+if ($env:MAVEN_USER_HOME) {
+ $MAVEN_HOME_PARENT = "$env:MAVEN_USER_HOME/wrapper/dists/$distributionUrlNameMain"
+}
+$MAVEN_HOME_NAME = ([System.Security.Cryptography.MD5]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join ''
+$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME"
+
+if (Test-Path -Path "$MAVEN_HOME" -PathType Container) {
+ Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME"
+ Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
+ exit $?
+}
+
+if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) {
+ Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl"
+}
+
+# prepare tmp dir
+$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile
+$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir"
+$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null
+trap {
+ if ($TMP_DOWNLOAD_DIR.Exists) {
+ try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
+ catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
+ }
+}
+
+New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null
+
+# Download and Install Apache Maven
+Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
+Write-Verbose "Downloading from: $distributionUrl"
+Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
+
+$webclient = New-Object System.Net.WebClient
+if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) {
+ $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD)
+}
+[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
+$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null
+
+# If specified, validate the SHA-256 sum of the Maven distribution zip file
+$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum
+if ($distributionSha256Sum) {
+ if ($USE_MVND) {
+ Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties."
+ }
+ Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash
+ if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) {
+ Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property."
+ }
+}
+
+# unzip and move
+Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null
+Rename-Item -Path "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" -NewName $MAVEN_HOME_NAME | Out-Null
+try {
+ Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null
+} catch {
+ if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) {
+ Write-Error "fail to move MAVEN_HOME"
+ }
+} finally {
+ try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
+ catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
+}
+
+Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..0ab4a04
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,102 @@
+
+
+ 4.0.0
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 3.3.5
+
+
+ com.example
+ jpa
+ 0.0.1-SNAPSHOT
+ jpa
+ Demo project for Spring Boot
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 23
+ 23
+ 23
+
+
+
+ org.springframework.boot
+ spring-boot-starter-data-jpa
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.postgresql
+ postgresql
+ runtime
+
+
+ org.projectlombok
+ lombok
+ true
+
+
+ com.h2database
+ h2
+ test
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.springframework.boot
+ spring-boot-devtools
+ runtime
+
+ org.springframework.boot
+ spring-boot-starter-security
+
+
+ org.springframework.boot
+ spring-boot-starter-oauth2-client
+
+
+ org.springframework.boot
+ spring-boot-starter-mail
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ org.projectlombok
+ lombok
+
+
+
+
+
+
+
+
diff --git a/src/AbstractTry/Main.java b/src/AbstractTry/Main.java
deleted file mode 100644
index 882113d..0000000
--- a/src/AbstractTry/Main.java
+++ /dev/null
@@ -1,166 +0,0 @@
-package AbstractTry;
-// BankAccount.java
-
-// Define an abstract class named BankAccount
-abstract class BankAccount {
- // Declare private variables for account number and balance
- private String accountNumber;
- private double balance;
-
- // Constructor that accepts account number and balance, and sets them to the corresponding variables
- public BankAccount(String accountNumber, double balance) {
- this.accountNumber = accountNumber;
- this.balance = balance;
- }
-
- // Getter method for account number
- public String getAccountNumber() {
- return accountNumber;
- }
-
- // Getter method for balance
- public double getBalance() {
- return balance;
- }
-
- // Protected setter method for balance
- protected void setBalance(double balance) {
- this.balance = balance;
- }
-
- // Declare an abstract method for depositing an amount
- public abstract void deposit(double amount);
-
- // Declare an abstract method for withdrawing an amount
- public abstract void withdraw(double amount);
-}
-// SavingsAccount.java
-
-// Define a subclass named SavingsAccount that extends BankAccount
-class SavingsAccount extends BankAccount {
- // Constructor that accepts account number and balance, and passes them to the superclass constructor
- public SavingsAccount(String accountNumber, double balance) {
- super(accountNumber, balance);
- }
-
- // Override the deposit method to add an amount to the balance
- @Override
- public void deposit(double amount) {
- // Update the balance by adding the deposit amount
- setBalance(getBalance() + amount);
- // Print a message indicating the deposit was successful
- System.out.println("Deposit of $" + amount + " successful. Current balance: $" + getBalance());
- }
-
- // Override the withdraw method to subtract an amount from the balance
- @Override
- public void withdraw(double amount) {
- // Check if the balance is sufficient for the withdrawal
- if (getBalance() >= amount) {
- // Update the balance by subtracting the withdrawal amount
- setBalance(getBalance() - amount);
- // Print a message indicating the withdrawal was successful
- System.out.println("Withdrawal of $" + amount + " successful. Current balance: $" + getBalance());
- } else {
- // Print a message indicating insufficient funds
- System.out.println("Insufficient funds. Withdrawal failed.");
- }
- }
-}
-// CurrentAccount.java
-// Subclass CurrentAccount
-
-// Define CurrentAccount class that extends BankAccount
-class CurrentAccount extends BankAccount {
-
- // Constructor to initialize account number and balance
- public CurrentAccount(String accountNumber, double balance) {
- super(accountNumber, balance); // Call superclass constructor with account number and balance
- }
-
- // Override deposit method from BankAccount
- @Override
- public void deposit(double amount) {
- // Add deposit amount to current balance
- setBalance(getBalance() + amount);
- // Print successful deposit message with updated balance
- System.out.println("Deposit of $" + amount + " successful. Current balance: $" + getBalance());
- }
-
- // Override withdraw method from BankAccount
- @Override
- public void withdraw(double amount) {
- // Check if there are sufficient funds for the withdrawal
- if (getBalance() >= amount) {
- // Subtract withdrawal amount from current balance
- setBalance(getBalance() - amount);
- // Print successful withdrawal message with updated balance
- System.out.println("Withdrawal of $" + amount + " successful. Current balance: $" + getBalance());
- } else {
- // Print insufficient funds message if withdrawal cannot be made
- System.out.println("Insufficient funds. Withdrawal failed.");
- }
- }
-}
-// Main.java
-// Subclass Main
-
-// Define public class Main
-public class Main {
- // Define the main method
- public static void main(String[] args) {
- // Declare double variables for initial balance, deposit amount, and withdrawal amount
- double ibal, damt, wamt;
-
- // Set initial balance for SavingsAccount
- ibal = 1000.00;
- // Create a new SavingsAccount object with the initial balance
- SavingsAccount savingsAccount = new SavingsAccount("SA001", ibal);
- // Print initial balance of SavingsAccount
- System.out.println("Savings A/c: Initial Balace: $" + ibal);
-
- // Set deposit amount
- damt = 500.00;
- // Deposit amount into SavingsAccount
- savingsAccount.deposit(damt);
-
- // Set first withdrawal amount
- wamt = 250.00;
- // Withdraw amount from SavingsAccount
- savingsAccount.withdraw(wamt);
-
- // Set second withdrawal amount
- wamt = 1600.00;
- // Print attempt to withdraw larger amount
- System.out.println("\nTry to withdraw: $" + wamt);
- // Attempt to withdraw larger amount from SavingsAccount
- savingsAccount.withdraw(wamt);
-
- // Print an empty line for separation
- System.out.println();
-
- // Set initial balance for CurrentAccount
- ibal = 5000.00;
- // Create a new CurrentAccount object with the initial balance
- CurrentAccount currentAccount = new CurrentAccount("CA001", ibal);
- // Print initial balance of CurrentAccount
- System.out.println("Current A/c: Initial Balace: $" + ibal);
-
- // Set deposit amount for CurrentAccount
- damt = 2500.00;
- // Deposit amount into CurrentAccount
- currentAccount.deposit(1000.0);
-
- // Set first withdrawal amount for CurrentAccount
- wamt = 1250.00;
- // Withdraw amount from CurrentAccount
- currentAccount.withdraw(3000.0);
-
- // Set second withdrawal amount for CurrentAccount
- wamt = 6000.00;
- // Print attempt to withdraw larger amount from CurrentAccount
- System.out.println("\nTry to withdraw: $" + wamt);
- // Attempt to withdraw larger amount from CurrentAccount
- savingsAccount.withdraw(wamt);
- }
-}
\ No newline at end of file
diff --git a/src/Again/Bicycle.java b/src/Again/Bicycle.java
deleted file mode 100644
index d9c0d73..0000000
--- a/src/Again/Bicycle.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package Again;
-
-public class Bicycle {
- public int speed;
- public int gear;
-
- public Bicycle(int speed, int gear) {
- this.speed = speed;
- this.gear = gear;
- }
-
- public void changeGear(int newGear) {
- gear = newGear;
- }
-
- public void speedUp(int increment) {
- speed += increment;
- }
-
- public void applyBrake(int decrement) {
- speed -= decrement;
- }
-}
diff --git a/src/Again/Boat.java b/src/Again/Boat.java
deleted file mode 100644
index b09b44a..0000000
--- a/src/Again/Boat.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package Again;
-
-public class Boat {
- public double length;
- public double weight;
-
- public Boat(double length, double weight) {
- this.length = length;
- this.weight = weight;
- }
-
- public void sail() {
- System.out.println("The boat is sailing");
- }
-}
diff --git a/src/Again/Car.java b/src/Again/Car.java
deleted file mode 100644
index abf1925..0000000
--- a/src/Again/Car.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package Again;
-
-public class Car {
- public String make;
- public String model;
- public int year;
-
- public Car(String make, String model, int year) {
- this.make = make;
- this.model = model;
- this.year = year;
- }
-
- public void start() {
- System.out.println("Car is starting");
- }
-
- public void stop() {
- System.out.println("Car is stopping");
- }
-
- public void accelerate() {
- System.out.println("Car is accelerating");
- }
-}
\ No newline at end of file
diff --git a/src/Again/ElectricCar.java b/src/Again/ElectricCar.java
deleted file mode 100644
index 00efb25..0000000
--- a/src/Again/ElectricCar.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package Again;
-
-public class ElectricCar extends Car {
- public int batteryCapacity;
- public int range;
-
- public ElectricCar(String make, String model, int year, int batteryCapacity, int range) {
- super(make, model, year);
- this.batteryCapacity = batteryCapacity;
- this.range = range;
- }
-
- public void charge() {
- System.out.println("Electric car is charging");
- }
-}
diff --git a/src/Again/FishingBoat.java b/src/Again/FishingBoat.java
deleted file mode 100644
index da8e18e..0000000
--- a/src/Again/FishingBoat.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package Again;
-
-public class FishingBoat extends Boat {
- public int fishCapacity;
- public String typeOfNet;
-
- public FishingBoat(double length, double weight, int fishCapacity, String typeOfNet) {
- super(length, weight);
- this.fishCapacity = fishCapacity;
- this.typeOfNet = typeOfNet;
- }
-
- public void castNet() {
- System.out.println("Casting the net");
- }
-}
diff --git a/src/Again/Main.java b/src/Again/Main.java
deleted file mode 100644
index ade4114..0000000
--- a/src/Again/Main.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package Again;
-
-public class Main {
- public static void main(String[] args) {
- Bicycle bike = new Bicycle(10, 1);
- bike.speedUp(5);
- bike.changeGear(2);
- bike.applyBrake(2);
- System.out.println("Bicycle speed: " + bike.speed + ", gear: " + bike.gear);
- MountainBike mountainBike = new MountainBike(15, 3, "Off-road", "Full");
- mountainBike.speedUp(10);
- mountainBike.adjustSuspension("Soft");
- System.out.println("MountainBike speed: " + mountainBike.speed + ", gear: " + mountainBike.gear + ", tire type: " + mountainBike.tireType + ", suspension: " + mountainBike.suspension);
-
-
- Car car = new Car("Toyota", "Corolla", 2020);
- car.start();
- car.accelerate();
- car.stop();
- System.out.println("Car make: " + car.make + ", model: " + car.model + ", year: " + car.year);
-
- ElectricCar electricCar = new ElectricCar("Tesla", "Model S", 2021, 100, 400);
- electricCar.start();
- electricCar.charge();
- electricCar.accelerate();
- electricCar.stop();
- System.out.println("ElectricCar make: " + electricCar.make + ", model: " + electricCar.model + ", year: " + electricCar.year + ", battery capacity: " + electricCar.batteryCapacity + ", range: " + electricCar.range);
-
- Tesla tesla = new Tesla("Tesla", "Model X", 2022, 100, 350, "v10.2");
- tesla.start();
- tesla.enableAutopilot();
- tesla.accelerate();
- tesla.stop();
- System.out.println("Tesla make: " + tesla.make + ", model: " + tesla.model + ", year: " + tesla.year + ", battery capacity: " + tesla.batteryCapacity + ", range: " + tesla.range + ", autopilot version: " + tesla.autopilotVersion);
- Boat boat = new Boat(30.5, 5000);
- boat.sail();
- System.out.println("Boat length: " + boat.length + ", weight: " + boat.weight);
-
- SpeedBoat speedBoat = new SpeedBoat(25.0, 3000, 80, "V8");
- speedBoat.sail();
- speedBoat.turboBoost();
- System.out.println("SpeedBoat length: " + speedBoat.length + ", weight: " + speedBoat.weight + ", max speed: " + speedBoat.maxSpeed + ", engine type: " + speedBoat.engineType);
-
- FishingBoat fishingBoat = new FishingBoat(20.0, 4000, 1000, "Gillnet");
- fishingBoat.sail();
- fishingBoat.castNet();
- System.out.println("FishingBoat length: " + fishingBoat.length + ", weight: " + fishingBoat.weight + ", fish capacity: " + fishingBoat.fishCapacity + ", type of net: " + fishingBoat.typeOfNet);
- }
-}
-
-
-
-
-
-
-
diff --git a/src/Again/MountainBike.java b/src/Again/MountainBike.java
deleted file mode 100644
index 4d40bd1..0000000
--- a/src/Again/MountainBike.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package Again;
-
-public class MountainBike extends Bicycle {
- public String tireType;
- public String suspension;
-
- public MountainBike(int speed, int gear, String tireType, String suspension) {
- super(speed, gear);
- this.tireType = tireType;
- this.suspension = suspension;
- }
-
- public void adjustSuspension(String newSuspension) {
- suspension = newSuspension;
- }
-}
-
diff --git a/src/Again/SpeedBoat.java b/src/Again/SpeedBoat.java
deleted file mode 100644
index e393526..0000000
--- a/src/Again/SpeedBoat.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package Again;
-
-public class SpeedBoat extends Boat {
- public int maxSpeed;
- public String engineType;
-
- public SpeedBoat(double length, double weight, int maxSpeed, String engineType) {
- super(length, weight);
- this.maxSpeed = maxSpeed;
- this.engineType = engineType;
- }
-
- public void turboBoost() {
- System.out.println("Turbo boost activated");
- }
-}
diff --git a/src/Again/Tesla.java b/src/Again/Tesla.java
deleted file mode 100644
index 5444036..0000000
--- a/src/Again/Tesla.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package Again;
-
-public class Tesla extends ElectricCar {
- public String autopilotVersion;
-
- public Tesla(String make, String model, int year, int batteryCapacity, int range, String autopilotVersion) {
- super(make, model, year, batteryCapacity, range);
- this.autopilotVersion = autopilotVersion;
- }
-
- public void enableAutopilot() {
- System.out.println("Autopilot is enabled");
- }
-}
diff --git a/src/Chestii_Utile_Futuro/Animale.java b/src/Chestii_Utile_Futuro/Animale.java
deleted file mode 100644
index 88201ca..0000000
--- a/src/Chestii_Utile_Futuro/Animale.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package Chestii_Utile_Futuro;
-
-class Animalele {
- public void sound() {
- System.out.println("Sounds of animals...");
- }
-}
-
-class Pisici extends Animalele {
- @Override
- public void sound() {
- System.out.println("Meow");
- }
-}
-class Catei extends Animalele{
- public void sound() {
- System.out.println("Woof");
- }
-}
-
-class Bufnita extends Animalele {
- @Override
- public void sound() {
- System.out.println("Hoot");
- }
-}
-
-class Leu extends Animalele{
- @Override
- public void sound() {
- System.out.println("Roar");
- }
-}
-
-public class Animale {
- public static void main(String args[]) {
-
- Animalele pisici = new Pisici();
- Animalele catei = new Catei();
- Animalele bufnita = new Bufnita();
- Animalele leu = new Leu();
-
- pisici.sound();//pisici make Meow
- catei.sound();//catei make Woof
- bufnita.sound();//bufnita make Hoot
- leu.sound();//leu make Roar
- }
-}
\ No newline at end of file
diff --git a/src/Chestii_Utile_Futuro/Main2.java b/src/Chestii_Utile_Futuro/Main2.java
deleted file mode 100644
index 8fd35a2..0000000
--- a/src/Chestii_Utile_Futuro/Main2.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package Chestii_Utile_Futuro;
-
-import java.time.LocalDate;
-import java.time.format.DateTimeFormatter;
-import java.time.Year;
-import javax.swing.JOptionPane;
-
-class FitnessTracker {
- String activity;
- int duration;
- LocalDate date;
-
- FitnessTracker() {
- setFitnessTracker("Running", 0, LocalDate.of(Year.now().getValue(), 1, 1));
- }
- FitnessTracker(String n_activity, int n_duration, LocalDate n_date) {
- setFitnessTracker(n_activity, n_duration, n_date);
- }
-
- void setFitnessTracker(String n_activity, int n_duration, LocalDate n_date) {
- activity = n_activity;
- duration = n_duration;
- date = n_date;
- }
- void setActivity(String n_activity) { setFitnessTracker(n_activity, duration, date); }
- void setDuration(int n_duration) { setFitnessTracker(activity, n_duration, date); }
- void setDate(LocalDate n_date) { setFitnessTracker(activity, duration, n_date); }
- String getActivity() { return activity; }
- int getDuration() { return duration; }
- LocalDate getDate() { return date; }
-
- String Print() {
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MMMM dd, YYYY");
- String formattedDate = date.format(formatter);
- return "Activity: " + activity + "\nDuration: " + duration + " min\nDate: " + formattedDate;
- }
-}
-
-class Main {
- public static void main(String[] args) {
- int numTrackers = 3;
- FitnessTracker[] trackers = new FitnessTracker[numTrackers];
-
- String activity = JOptionPane.showInputDialog(null, "Enter Activity Name: ");
- String durationStr = JOptionPane.showInputDialog(null, "Enter Exercise Duration (Minutes): ");
- String dateStr = JOptionPane.showInputDialog(null, "Enter Date (MM-DD-YYYY): ");
-
- int duration = Integer.parseInt(durationStr);
- LocalDate date = parseDate(dateStr);
-
- trackers[0] = new FitnessTracker(activity, duration, date);
- JOptionPane.showMessageDialog(null, trackers[0].Print());
-
- activity = JOptionPane.showInputDialog(null, "Enter Activity Name: ");
- durationStr = JOptionPane.showInputDialog(null, "Enter Exercise Duration (Minutes): ");
- dateStr = JOptionPane.showInputDialog(null, "Enter Date (MM-DD-YYYY): ");
-
- duration = Integer.parseInt(durationStr);
- date = parseDate(dateStr);
-
- trackers[1] = new FitnessTracker();
- trackers[1].setFitnessTracker(activity, duration, date);
- JOptionPane.showMessageDialog(null, trackers[1].Print());
-
- trackers[2] = new FitnessTracker();
- JOptionPane.showMessageDialog(null, trackers[2].Print());
- }
- // Helper Function to format and parse date from user string
- static LocalDate parseDate(String dateStr) {
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM-dd-yyyy");
- return LocalDate.parse(dateStr, formatter);
- }
-}
\ No newline at end of file
diff --git a/src/Chestii_Utile_Futuro/SoundAnimal.java b/src/Chestii_Utile_Futuro/SoundAnimal.java
deleted file mode 100644
index 47aa17d..0000000
--- a/src/Chestii_Utile_Futuro/SoundAnimal.java
+++ /dev/null
@@ -1,49 +0,0 @@
-// Sounds Animal
-class Anima {
- // sound method for the Animal class
- public void sound() {
- System.out.println("/nAnimal makes sounds");
- }
-}
-
-// Dog.java
-class Dogs extends Anima {
- // sound method for the Dog class
- @Override
- public void sound() {
- System.out.println("bark");
- }
-}
-
-// Cat.java
-class Cats extends Anima {
- // sound method for the Cat class
- @Override
- public void sound() {
- System.out.println("meow");
- }
-}
-
-// Wolf.java
-class Wolfs extends Anima {
- // sound method for the Wolf class
- @Override
- public void sound() {
- System.out.println("howl");
- }
-}
-
-// TestAnimal.java
-public class SoundAnimal {
- public static void main(String[] args) {
- // Create instances of each animal
- Anima dogs = new Dogs();
- Anima cats = new Cats();
- Anima wolfs = new Wolfs();
-
- // Call the sound method for each animal
- dogs.sound(); // Prints "bark"
- cats.sound(); // Prints "meow"
- wolfs.sound(); // Prints "howl"
- }
-}
\ No newline at end of file
diff --git a/src/Domande_Java_From_All_Course/java domande.txt b/src/Domande_Java_From_All_Course/java domande.txt
deleted file mode 100644
index 87741a8..0000000
--- a/src/Domande_Java_From_All_Course/java domande.txt
+++ /dev/null
@@ -1,16 +0,0 @@
- I.What is casting in Java?
- Type casting is a powerful feature in Java that allows us to convert variables from one data type to another. Implicit type casting, also known as widening conversion,
-is done automatically by the compiler when there is no loss of data.
-
-II. What is memory reference?
-In Java, references are used to access objects, which are variables that hold the “address” of an area of memory in which the attributes of an object
-will be stored. This memory is allocated on the heap area. When you declare a field or local variable, this is only a reference to an object on the heap,
-not the object itself. When it comes to creating an object, the required amount of memory is requested from the heap, and this object can then be accessed through the reference variable.
-
-
-III.What are decision constructs in Java?
-
-Decision Making in programming is similar to decision-making in real life. In programming also face some situations
-where we want a certain block of code to be executed when some condition is fulfilled.
-A programming language uses control statements to control the flow of execution of a program based on certain conditions.
-These are used to cause the flow of execution to advance and branch based on changes to the state of a program.
diff --git a/src/Homework/AnimalClass/Mains.java b/src/Homework/AnimalClass/Mains.java
deleted file mode 100644
index 2f7d4c1..0000000
--- a/src/Homework/AnimalClass/Mains.java
+++ /dev/null
@@ -1,66 +0,0 @@
-abstract class Animal {
- private String name;
- private int age;
-
- public Animal(String name, int age) {
- this.name = name;
- this.age = age;
- }
-
- public abstract String makeSound();
-
- public String getName() {
- return name;
- }
-
- public int getAge() {
- return age;
- }
-
- public void setAge(int age) {
- this.age = age;
- }
-}
-
-class Dog extends Animal {
- public Dog(String name, int age) {
- super(name, age);
- }
-
- public String makeSound() {
- return "Bark";
- }
-}
-
-class Cat extends Animal {
- public Cat(String name, int age) {
- super(name, age);
- }
-
- public String makeSound() {
- return "meow";
- }
-}
-
-class Wolf extends Animal {
- public Wolf(String name, int age) {
- super(name, age);
- }
-
- public String makeSound() {
- return "how";
- }
-}
-
-public class Mains {
- protected static void main(String[] args) {
- Animal dog = new Dog("Lucy", 3);
- Animal cat = new Cat("Luna", 4);
- Animal wolf = new Wolf("Bursuc", 5);
-
- System.out.println(dog.getName() + " is a " + dog.getClass().getSimpleName() + " and says " + dog.makeSound());
- System.out.println(cat.getName() + " is a " + cat.getClass().getSimpleName() + " and says " + cat.makeSound());
- System.out.println(wolf.getName() + " is a " + wolf.getClass().getSimpleName() + " and says " + wolf.makeSound());
-
- }
-}
\ No newline at end of file
diff --git a/src/Homework/ArrayHomework.java b/src/Homework/ArrayHomework.java
deleted file mode 100644
index d1ecc08..0000000
--- a/src/Homework/ArrayHomework.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package Homework;
-
-import java.util.ArrayList;
-import java.util.Scanner;
-
-public class ArrayHomework {
- public static void main(String[] args) {
- System.out.println("===Homework sesion 8!===");
-
- //shopList();//EX-1
- //arrayTenOdd();//EX-4
- //cityChose();//EX-5
- //movieSearch();//EX-8
- //christmasPresents();//EX-2
- }
-
- public static void christmasPresents() {
- //5.Create a wishlist for christmas with ArrayList and print the values
- System.out.println("Christmas Wishlist:");
- ArrayList wishlist = new ArrayList<>();
- wishlist.add("MacBook");
- wishlist.add("GoPro");
- wishlist.add("Xbox ONE X");
- wishlist.add("New clothes");
- wishlist.add("New Watch");
- for (String item : wishlist) {
- System.out.println(item);
- }
-
- }
-
- public static void movieSearch() {
- //4.In an array of strings representing movie titles, implement a linear search method to find whether a given movie title exists.
- // If it does, print out its position in the array.
- System.out.println("Movie Title searching");
- String[] movies = {"Bad Boy", "Titanic", "Byker Boys", "Kung Fu Panda", "Avatar"};
- String movieToFind = "Byker Boys";
-
- int position = linearSearch(movies, movieToFind);
- if (position != -1) {
- System.out.println("Movie found at position: " + position);
- } else {
- System.out.println("Movie not found.");
- }
-
-
- }
-
- public static void cityChose() {
- //3.Create an ArrayList that stores city names. Add at least five city names initially. Then, prompt the user to add a city name. If the city name is already in the list,
- // display a message saying it's a duplicate; otherwise, add it to the list.
- System.out.println("City List:");
- ArrayList cityNames = new ArrayList<>();
- cityNames.add("Bucuresti");
- cityNames.add("Milano");
- cityNames.add("Madrid");
- cityNames.add("Genova");
- cityNames.add("Padova");
-
- Scanner scanner = new Scanner(System.in);
- System.out.print("Enter a city name: ");
- String cityName = scanner.nextLine();
-
- if (cityNames.contains(cityName)) {
- System.out.println("This city name is a duplicate.");
- } else {
- cityNames.add(cityName);
- System.out.println("City added: " + cityName);
- }
-
- System.out.println("Current city names: " + cityNames);
- }
-
- public static void arrayTenOdd() {
- //2.Given an array of 10 integers, count how many of them are even numbers and how many are odd.
- // Print out both counts.
- System.out.println("Count even and odd");
- int arr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
- int n = arr.length;
- int countEven = 0, countOdd = 0;
-
- for (int i = 0; i < n; i++) {
- if ((arr[i] % 2) == 0)
- countEven += 1;
-
- else
- countOdd += 1;
- }
- System.out.println("Even Elements count : " + countEven);
- System.out.println("Odd Elements count : " + countOdd);
-
- }
-
-
- public static void shopList() {
- //1.Create a shopping list with Array and print the values
-
- System.out.println("Shopping list!");
- String[] shoppingList = {"Faina", "Oua", "Lapte", "Unt", "Zahar", "Ciocolata"};
- for (String item : shoppingList) {
- System.out.println(item);
- }
- }
-
- private static int linearSearch(String[] movies, String target) {
- for (int i = 0; i < movies.length; i++) {
- if (movies[i].equals(target)) {
- return i; // Return the index where the movie is found
- }
- }
- return -1; // Return -1 if not found
- }
-
-}
-
-
diff --git a/src/Homework/Code.java b/src/Homework/Code.java
deleted file mode 100644
index 5dd404e..0000000
--- a/src/Homework/Code.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package Homework;
-
-public class Code {
- public static void main(String[] args) {
-
- class Roman {
- int value(char r) {
- if (r == 'I')
- return 1;
- if (r == 'V')
- return 5;
- if (r == 'X')
- return 10;
- if (r == 'L')
- return 50;
- if (r == 'C')
- return 100;
- if (r == 'D')
- return 500;
- if (r == 'M')
- return 1000;
- return -1;
- }
-
- int romanToInt(String s) {
- int total = 0;
- for (int i = 0; i < s.length(); i++) {
- int s1 = value(s.charAt(i));
- if (i + 1 < s.length()) {
- int s2 = value(s.charAt(i + 1));
- if (s1 >= s2) {
- total = total + s1;
- } else {
- total = total - s1;
- }
- } else {
- total = total + s1;
- }
- }
- return total;
- }
-
- // Driver code
- public static void main(String args[]) {
- Roman ob = new Roman();
- String val = "MCMXCIV";
- System.out.println(ob.romanToInt(val));
- }
- }
- }
-}
-
diff --git a/src/Homework/CollegeManagementSystem.java b/src/Homework/CollegeManagementSystem.java
deleted file mode 100644
index 348a8cf..0000000
--- a/src/Homework/CollegeManagementSystem.java
+++ /dev/null
@@ -1,240 +0,0 @@
-import java.util.ArrayList;
-import java.util.List;
-
-// Class to represent a Student
-class Student {
- private String firstName;
- private String lastName;
- private String sex;
- private int age;
- private String dateOfBirth;
- private String cnp; // CNP - Personal Numeric Code
- private String address;
-
- public Student(String firstName, String lastName, String sex, int age, String dateOfBirth, String cnp, String address) {
- this.firstName = firstName;
- this.lastName = lastName;
- this.sex = sex;
- this.age = age;
- this.dateOfBirth = dateOfBirth;
- this.cnp = cnp;
- this.address = address;
- }
-
- // Method to display student details
- public void displayStudentDetails() {
- System.out.println("Student: " + firstName + " " + lastName + ", Sex: " + sex + ", Age: " + age +
- ", DOB: " + dateOfBirth + ", CNP: " + cnp + ", Address: " + address);
- }
-}
-
-// Class to represent a Professor
-class Professor {
- public String firstName;
- public String lastName;
- private String sex;
- private int age;
- private String dateOfBirth;
- private String cnp;
- private String address;
-
- public Professor(String firstName, String lastName, String sex, int age, String dateOfBirth, String cnp, String address) {
- this.firstName = firstName;
- this.lastName = lastName;
- this.sex = sex;
- this.age = age;
- this.dateOfBirth = dateOfBirth;
- this.cnp = cnp;
- this.address = address;
- }
-
- // Method to display professor details
- public void displayProfessorDetails() {
- System.out.println("Professor: " + firstName + " " + lastName + ", Sex: " + sex + ", Age: " + age +
- ", DOB: " + dateOfBirth + ", CNP: " + cnp + ", Address: " + address);
- }
-}
-
-// Class to represent a Course
-class Course {
- public String name;
- private String schedule;
- private String duration;
- private String description;
- private Professor assignedProfessor;
-
- public Course(String name, String schedule, String duration, String description) {
- this.name = name;
- this.schedule = schedule;
- this.duration = duration;
- this.description = description;
- }
-
- // Method to assign a professor to this course
- public void assignProfessor(Professor professor) {
- this.assignedProfessor = professor;
- }
-
- // Method to display course details along with assigned professor
- public void displayCourseDetails() {
- System.out.println("Course: " + name + ", Schedule: " + schedule + ", Duration: " + duration +
- ", Description: " + description);
- if (assignedProfessor != null) {
- System.out.print("Assigned Professor: ");
- assignedProfessor.displayProfessorDetails();
- } else {
- System.out.println("Assigned Professor: None");
- }
- }
-}
-
-// Class to represent the College
-class College {
- private List students;
- private List professors;
- private List courses;
-
- public College() {
- this.students = new ArrayList<>();
- this.professors = new ArrayList<>();
- this.courses = new ArrayList<>();
- }
-
- // Add a new student
- public void addStudent(Student student) {
- students.add(student);
- }
-
- // Add a new professor
- public void addProfessor(Professor professor) {
- professors.add(professor);
- }
-
- // Add a new course
- public void addCourse(Course course) {
- courses.add(course);
- }
-
- // Assign a professor to a course
- public void assignProfessorToCourse(String courseName, Professor professor) {
- for (Course course : courses) {
- if (courseName.equalsIgnoreCase(course.name)) {
- course.assignProfessor(professor);
- System.out.println("Assigned " + professor.firstName + " " + professor.lastName + " to " + courseName);
- return;
- }
- }
- System.out.println("Course not found.");
- }
-
- // Display details of all courses
- public void viewCourses() {
- for (Course course : courses) {
- course.displayCourseDetails();
- }
- }
-
- // Display details of all students
- public void viewStudents() {
- for (Student student : students) {
- student.displayStudentDetails();
- }
- }
-
- // Display details of all professors
- public void viewProfessors() {
- for (Professor professor : professors) {
- professor.displayProfessorDetails();
- }
- }
-}
-
-// Main class to run the program
-public class CollegeManagementSystem {
- public static void main(String[] args) {
- // Create an instance of College
- College college = new College();
-
- // Create some students
- Student student1 = new Student("Sorin", "Nastase", "Male", 25, "1999-01-01", "1010199702468", "4 Aurara St.");
- Student student2 = new Student("Aura", "Pascale", "Female", 27, "1997-02-02", "2020297796413", "25 Portitei St.");
- Student student3 = new Student("Aurel", "Pascale", "Male", 25, "1999-03-03", "1030399874685", "35 Eternitati St.");
- Student student4 = new Student("Veronica", "Micle", "Female", 27, "1997-04-04", "2040497873216", "45 Garoafei St.");
- Student student5 = new Student("Florian", "Tanase", "Male", 25, "1999-05-05", "2050599678234", "25 Minciuni St.");
- Student student6 = new Student("Florica", "Tanase", "Female", 28, "1996-06-06", "1060696874321", "28 Libera St.");
- Student student7 = new Student("Bogdan", "Mocanu", "Male", 26, "1998-07-07", "1070798873541", "57 Ocupata St.");
- Student student8 = new Student("Mihaela", "Padureanu", "Female", 24, "1998-08-08", "2080898762432", "35 Sovata St.");
-
- // Add students to the college
- college.addStudent(student1);
- college.addStudent(student2);
- college.addStudent(student3);
- college.addStudent(student4);
- college.addStudent(student5);
- college.addStudent(student6);
- college.addStudent(student7);
- college.addStudent(student8);
-
- // Create some professors
- Professor professor1 = new Professor("Bogdan", "Petrescu", "Male", 45, "1979-03-03", "3567924678642", " 25 Moldoveanu S. St.");
- Professor professor2 = new Professor("Andreea", "Lipovenescu", "Female", 40, "1983-04-04", "2468721647832", "26 Garoafei St.");
- Professor professor3 = new Professor("Martina", "Agache", "Female", 50, "1973-05-05", "1356789432545", "29 Eternitati St.");
- Professor professor4 = new Professor("Bogdan", "Pascale", "Male", 55, "1968-06-06", "1246783216579", "38 Aurora St.");
- Professor professor5 = new Professor("Nicolae", "Ion", "Male", 52, "1971-07-07", "2346789412562", "60 Dobrogeanu Ghe. St.");
- Professor professor6 = new Professor("Petrica", "Pascale", "Male", 48, "1976-08-08", "1327856743259", "54 Pascale I. St.");
- Professor professor7 = new Professor("David", "Florian", "Male", 60, "1963-09-09", "1325796435824", "23 Apelor St.");
- Professor professor8 = new Professor("Ancuta", "Moldoveanu", "Female", 43, "1980-10-10", "23465876354126", "3 Eterna St.");
-
- // Add professors to the college
- college.addProfessor(professor1);
- college.addProfessor(professor2);
- college.addProfessor(professor3);
- college.addProfessor(professor4);
- college.addProfessor(professor5);
- college.addProfessor(professor6);
- college.addProfessor(professor7);
- college.addProfessor(professor8);
-
- // Create some courses
- Course course1 = new Course("Math", "Mon/Wed/Fri 9-10am", "3 months", "Advanced Calculus");
- Course course2 = new Course("Computer Science", "Tue/Thu 2-4pm", "4 months", "Intro to Programming");
- Course course3 = new Course("Physics", "Mon/Wed/Fri 10-11am", "3 months", "Mechanics and Waves");
- Course course4 = new Course("Chemistry", "Tue/Thu 9-11am", "4 months", "Organic Chemistry");
- Course course5 = new Course("Biology", "Mon/Wed 1-2pm", "3 months", "Genetics and Evolution");
- Course course6 = new Course("Geography", "Tue/Thu 10-11:30am", "4 months", "Physical Geography");
- Course course7 = new Course("English", "Mon/Wed/Fri 11am-12pm", "3 months", "Shakespearean Literature");
- Course course8 = new Course("History", "Tue/Thu 1-3pm", "4 months", "World History");
-
- // Add courses to the college
- college.addCourse(course1);
- college.addCourse(course2);
- college.addCourse(course3);
- college.addCourse(course4);
- college.addCourse(course5);
- college.addCourse(course6);
- college.addCourse(course7);
- college.addCourse(course8);
-
- // Assign professors to courses
- college.assignProfessorToCourse("Math", professor1);
- college.assignProfessorToCourse("Computer Science", professor2);
- college.assignProfessorToCourse("Physics", professor3);
- college.assignProfessorToCourse("Chemistry", professor4);
- college.assignProfessorToCourse("Biology", professor5);
- college.assignProfessorToCourse("Geography", professor6);
- college.assignProfessorToCourse("English", professor7);
- college.assignProfessorToCourse("History", professor8);
-
- // Display all courses
- System.out.println("\n--- Courses Offered ---");
- college.viewCourses();
-
- // Display all students
- System.out.println("\n--- Student List ---");
- college.viewStudents();
-
- // Display all professors
- System.out.println("\n--- Professor List ---");
- college.viewProfessors();
- }
-}
\ No newline at end of file
diff --git a/src/Homework/First Homework b/src/Homework/First Homework
deleted file mode 100644
index 63a4deb..0000000
--- a/src/Homework/First Homework
+++ /dev/null
@@ -1,361 +0,0 @@
-package Homework;
-
-import java.util.Scanner;
-
-public class Homework {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
-//Write a Java program to take two numbers as input and display the result
-// of addition, subtraction, multiplication, division, and modulus.
-
- System.out.print("Enter first number: ");
- int num1 = scanner.nextInt();
- System.out.print("Enter the second number: ");
- int num2 = scanner.nextInt();
-
- System.out.println("Addition: " + (num1 + num2));
- System.out.println("Substraction: " + (num1 - num2));
- System.out.println("Multiplication: " + (num1 * num2));
- System.out.println("Division: " + (num1 / num2));
- System.out.println("Modulus: " + (num1 % num2));
-
-
- }
-}
-
-package Homework;
-
-import java.util.Scanner;
-
-public class Homework2 {
-public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
-//Create a Java program where you increment and decrement the same variable.
-// Display the value of the variable after each operation.
-
- int x = 20;
- System.out.println("Initiale value: " + x);
-
- x++;
- System.out.println("After increment: " + x);
-
- x--;
- System.out.println("After decrement: " + x);
-}
-}
-
-package Homework;
-
-import java.util.Scanner;
-
-public class Homework3 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
-//Write a program to check if a number is positive or negative using logical complement operator.
-
- System.out.print("Enter a number");
- int num = scanner.nextInt();
-
- boolean isPositive = (num > 0);
-
- if (isPositive) {
- System.out.println("The number is positive.");
- } else {
- System.out.println("The number is negative.");
-
-
- }
- }
-}
-package Homework;
-
-import java.util.Scanner;
-
-public class Homework4 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
-//Write a Java program that uses both the increment (++) and decrement (--)
-// operators in a loop to count up to 10 and then back down to 1.
-
- for (int a = 1; a <= 10; a++) {
- System.out.println("A value up is: " + a);
-
- }
-
- for (int a = 10; a >= 1; a--) {
-
- System.out.println("A value down is: " + a);
-
- }
- }
-}
-package Homework;
-
-public class Homework5 {
-public static void main(String[] args){
-
-//Create a Java program that demonstrates the use of each compound
-// assignment operator with integers.
-
-
- int s = 16;
-
- s += 5; //s = s + 5;
- System.out.println("s + 5 = " + s);
- s -= 5; //s = s - 5;
- System.out.println("s - 5 = " + s);
- s *= 5; // s = s * 5;
- System.out.println("s * 5 = " + s);
- s /= 5; // s = s / 5;
- System.out.println("s / 5 = " + s);
- s %= 5; // s = s % 5:
- System.out.println("s % 5 = " + s);
-
-}
-}
-package Homework;
-
-import java.util.Scanner;
-
-public class Homework6 {
-public static void main(String[] args){
- Scanner scanner = new Scanner(System.in);
-//Write a Java program that takes two numbers from the user and uses relational operators to display whether the first
-// number is greater than, less than, or equal to the second number.
-
- System.out.print("Enter first number:");
- int num1 = scanner.nextInt();
- System.out.print("Enter second number:");
- int num2 = scanner.nextInt();
-
-
- if (num1 < num2) {
-
- System.out.println("First number is less than second number.");
- } else if (num1 > num2) {
- System.out.println("First number is grater than second number.");
- } else {
- System.out.println("First number is equal to second number.");
- }
-}
-}
-package Homework;
-
-public class Homework7 {
- public static void main(String[] args) {
- //Write a program where you perform operations between an integer and a double.
-
- int s = 8;
- double a = 3.5;
-
- double result = s + a;
- System.out.println("Integer + Double: " + result);
-
- result = s - a;
- System.out.println("Integer - Double: " + result);
-
- result = s * a;
- System.out.println("Integer * Double: " + result);
-
- result = s / a;
- System.out.println("Integer / Double: " + result);
- }
-
- }
-package Homework;
-
-public class Homework8 {
- public static void main(String[] args){
-//Create a program that takes two byte values, adds them together,
-// and stores the result in a byte variable.
-
- byte firstByte = 100;
- byte secondByte = 126;
-
- int sum;
-
- sum = firstByte + secondByte;
- System.out.println("Result of the two bytes: " + sum);
-
-
- }
-}
-package Homework;
-
-import java.util.Scanner;
-
-public class Homework9 {
-public static void main(String[] args){
-
-//. Write a program that calculates the area of a rectangle.
-// Take the length and breadth as inputs
- double length = 0.0;
- double width = 0.0;
- double area = 0.0;
-
- Scanner reader = new Scanner(System.in);
- System.out.print("Enter lenght of the rectangle: ");
- length = reader.nextDouble();
- System.out.print("Enter the width of the rectangle: ");
- width = reader.nextDouble();
- area = length * width;
- System.out.println("Area of rectangle: " + area);
- reader.close();
-}
-}
-package Homework;
-
-import java.util.Scanner;
-
-public class Homework10 {
- public static void main(String[] args) {
-//Write a program that reverses the sign of an entered integer using unary minus operator.
- Scanner scanner = new Scanner(System.in);
-//
-// int aNumber;
-// aNumber = 10;
-// System.out.println(aNumber++);
-// System.out.println(++aNumber);
-// System.out.println(aNumber--);
-// System.out.println(--aNumber);
-
- System.out.print("Enter an integer: ");
- int sum = scanner.nextInt();
-
- sum = -sum;
- System.out.println("The reversed sign value is: " + sum);
-
-
-
- }
-}
-package Homework;
-
-import java.util.Scanner;
-
-public class Homework11 {
- public static void main(String[] args) {
- //Write a Java program that takes two boolean inputs from a user.
- // Apply the logical negation operator (!) to each and print the result.
- Scanner scanner = new Scanner(System.in);
- int count = 6;
-
- System.out.println(!(count > 2)); // prints true
- System.out.println(!(count <= 2)); // prints false
- boolean x = true;
- boolean y = false;
-
- System.out.println(!(x && y)); // prints true
- System.out.println(!(x || y)); // prints false
- }
-}
-package Homework;
-
-import java.util.Scanner;
-
-public class Homework12 {
- public static void main(String[] args) {
-
-//Create a program that takes an integer as input and then increments
-// and decrements it by 1, displaying the output at each stage
- Scanner scanner = new Scanner(System.in);
-
- int num = 15;
- System.out.println("Original value of the num: " + num);
- num++;
- System.out.println("variable++ = " + num);
- ++num;
- System.out.println("++variable = " + num);
-
- int num2 = 20;
- System.out.println("Original value of the num: " + num2);
- num2--;
- System.out.println("Integer num = " + num2);
- --num2;
- System.out.println("Integer num = " + num2);
- }
-}
-package Homework;
-
-import java.util.Scanner;
-
-public class Homework13 {
- public static void main(String[] args) {
-// Write a program to calculate the price after discount. Take the original price and discount
-// percentage as input. Use compound assignment operator to perform the calculation.
-
- Scanner sc = new Scanner(System.in);
-
- int price;
- int discount;
- System.out.println("Enter price of the product: ");
- price = sc.nextInt();
-
- System.out.println("Enter the discount(%) of the product: ");
- discount = sc.nextInt();
-
-
- int discountPrice = (price * discount ) / 100;
- int finalPrice = price - discountPrice;
-
- System.out.println("Discount price is: " + discountPrice);
- System.out.println("Final price is: " + finalPrice);
-
- }
-}
-package Homework;
-
-import java.util.Scanner;
-
-public class Homework14 {
- public static void main(String[] args) {
-//Create a program that checks if a user entered number is within a
-// specific range (e.g., 1-100). Use relational operators for the checks.
-
- Scanner sc = new Scanner(System.in);
-
- System.out.print("Enter a number: ");
- int num = sc.nextInt();
- if ( num >= 1 && num <= 100) {
- System.out.println("The number is within the range of 1 to 100.");
- } else {
- System.out.println("The number is not in range of 1-100.");
- }
- }
-}
-package Homework;
-import java.util.Scanner;
-public class HomeWorses5 {
- // System.out.println("Incercarile mele");
-
- public static void main(String[] args) {
-//17*sesion4
- String Username;
- String Password;
-
- Password = "8989";
- Username = "Veronica";
-
- Scanner input1 = new Scanner(System.in);
- System.out.println("Enter Username : ");
- String username = input1.next();
-
- Scanner input2 = new Scanner(System.in);
- System.out.println("Enter Password : ");
- String password = input2.next();
-
- if (username.equals(Username) && password.equals(Password)) {
-
- System.out.println("Access Granted! Welcome!");
- } else if (username.equals(Username)) {
- System.out.println("Invalid Password!");
- } else if (password.equals(Password)) {
- System.out.println("Invalid Username!");
- } else {
- System.out.println("Invalid Username & Password!");
- }
-
-
- }
-
-}
\ No newline at end of file
diff --git a/src/Homework/Main_Homeworks.java b/src/Homework/Main_Homeworks.java
deleted file mode 100644
index 2550034..0000000
--- a/src/Homework/Main_Homeworks.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package Homework;
-
-import java.sql.Timestamp;
-import java.text.SimpleDateFormat;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.Year;
-import java.time.format.DateTimeFormatter;
-import java.util.Calendar;
-import java.util.Date;
-
-public class Main_Homeworks {
- public static void main(String[] args){
-//Homework UtilityClasses
-
- //Date();
- //DateDecomposition();
- //SpecificDateReturns();
- //CurentTime();
- }
- //Write a method named displayCurrentTime that prints the current time to the console.
- //Expected Output: The current time in the format HH:MM:SS.
- public static void CurentTime(){
-
- DateTimeFormatter newFormat = DateTimeFormatter.ofPattern("dd MMMM yyyy HH:mm:ss");
- SimpleDateFormat parsedDateTime;
- // System.out.println("New format date time: " + parsedDateTime.format(newFormat));
-
- }
- //Write a method named createSpecificDate that returns a date object representing 19th August 2025.
- //Expected Output: A date object for 2025-8-19.
- public static void SpecificDateReturns(){
-
-
- }
-
- //Write a method named displayDateComponents that accepts a date as an argument and prints its year, month, and day components separately.
- //Input: A date in the format YYYY-MM-DD.
- //Expected Output:
- //makefile
- //Copy code
- //Year: YYYY
- //Month: MM
- //Day: DD
- public static void DateDecomposition(){
- Date date1 = new Date("YYYY-MM-dd");
- SimpleDateFormat formatNowYear = new SimpleDateFormat("YYYY");
- SimpleDateFormat formatNowMonth = new SimpleDateFormat("MM");
- SimpleDateFormat formatNowDay = new SimpleDateFormat("dd");
-
- String currentDay = formatNowDay.format(date1);
- String currentMonth = formatNowMonth.format(date1);
- String currentYear = formatNowYear.format(date1);
- System.out.println("Dte:" + date1);
- //inca in incercari
- }
- //Write a method named displayTodaysDate that, when called, prints the current date to the console.
- //Expected Output: Today's date in the format YYYY-MM-DD.
- public static void Date(){
-
-
- SimpleDateFormat formatter = new SimpleDateFormat("YYYY-MM-dd");
- Date date = new Date();
- System.out.println(formatter.format(date));
-
-
- }
-
-
-
-}
diff --git a/src/Homework/MatrixMultiplication.java b/src/Homework/MatrixMultiplication.java
deleted file mode 100644
index 869081b..0000000
--- a/src/Homework/MatrixMultiplication.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package Homework;
-
-import java.util.Arrays;
-
-public class MatrixMultiplication {
- public static void main(String[] args) {
- int size = 500;
- double[][] A = generateRandomMatrix(size, size);
- double[][] B = generateRandomMatrix(size, size);
- double[][] C = new double[size][size];
-
- int numThreads = 4;
- Thread[] threads = new Thread[numThreads];
- int rowsPerThread = size / numThreads;
-
- for (int i = 0; i < numThreads; i++) {
- int startRow = i * rowsPerThread;
- int endRow = (i == numThreads - 1) ? size : startRow + rowsPerThread;
- threads[i] = new Thread(new Worker(A, B, C, startRow, endRow));
- threads[i].start();
- }
-
- for (Thread thread : threads) {
- try {
- thread.join();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- System.out.println("Matrix multiplication completed.");
- }
-
- private static double[][] generateRandomMatrix(int rows, int cols) {
- double[][] matrix = new double[rows][cols];
- for (int i = 0; i < rows; i++) {
- for (int j = 0; j < cols; j++) {
- matrix[i][j] = Math.random();
- }
- }
- return matrix;
- }
-}
-
-class Worker implements Runnable {
- private final double[][] A;
- private final double[][] B;
- private final double[][] C;
- private final int startRow;
- private final int endRow;
-
- public Worker(double[][] A, double[][] B, double[][] C, int startRow, int endRow) {
- this.A = A;
- this.B = B;
- this.C = C;
- this.startRow = startRow;
- this.endRow = endRow;
- }
-
- @Override
- public void run() {
- for (int i = startRow; i < endRow; i++) {
- for (int j = 0; j < B[0].length; j++) {
- C[i][j] = 0;
- for (int k = 0; k < A[0].length; k++) {
- C[i][j] += A[i][k] * B[k][j];
- }
- }
- }
- }
-}
diff --git a/src/Homework/TeM.java b/src/Homework/TeM.java
deleted file mode 100644
index 0d0dc8c..0000000
--- a/src/Homework/TeM.java
+++ /dev/null
@@ -1,136 +0,0 @@
-package Homework;
-
-import java.util.HashSet;
-
-public class TeM {
- public static void main(String[] args) {
- ReverseString();//Ex.1beglev
- ConcatenateStrings();//Ex.3Beglevel
- remVowel();//Ex.4Beglev
- CapitalizeWordsExample();//Ex.5Beglev
- toggledString();//Ex.6Explev
- ReplaceLineBreaks();//Ex.4Explev
- removeDuplicates();//Ex.2 Mediumlevel
- }
-//EX:1/Begginer Level
- public static void ReverseString() {
- //Write a program to reverse an input string using StringBuilder
- // Create a StringBuilder object with the input string
- StringBuilder str = new StringBuilder("Salutare, lume!");
-
- // Reverse the string
- StringBuilder reversedStr = str.reverse();
-
- // Print the reversed string
- System.out.println("Reversed String: " + reversedStr.toString());
- }
-//Ex:3/Begginer Level
- public static void ConcatenateStrings() {
- //Efficiently concatenate multiple strings into one using StringBuilder.
- StringBuilder stringBuilder = new StringBuilder(100);
- stringBuilder.append("In aceasta");
- stringBuilder.append("zi mare");
- stringBuilder.append(" este sarbatoare!");
- String result = stringBuilder.toString();
- System.out.println(stringBuilder);
- }
-//Ex:4/Begginer Level
- public static void remVowel() {
- // Remove all vowels from a string using StringBuilder.
- String s = "Prepinsta";
- String s1 = "";
- s1 = s.replace("[aeiou]", "");
- System.out.println("String after removing vowel: " + s1);
-
- }
-//Ex:5/Begginer Level
- public static void CapitalizeWordsExample() {
-//Capitalize the first letter of every word in a sentence using StringBuilder.
- // input string
- String input = "welcome to las vegas!";
-
- // call the capitalizeWords function and store the result
- String result = capitalizeWords(input);
-
- // print the original and modified strings
- System.out.println("Input: " + input);
- System.out.println("Output: " + result);
- }
-
- // function to capitalize the first letter of each word
- public static String capitalizeWords(String input) {
- // split the input string into an array of words
- String[] words = input.split("\\s");
-
- // StringBuilder to store the result
- StringBuilder result = new StringBuilder();
-
- // iterate through each word
- for (String word : words) {
-
- // capitalize the first letter, append the rest of the word, and add a space
-
- result.append(Character.toTitleCase(word.charAt(0)))
- .append(word.substring(1))
- .append(" ");
- }
-
- // convert StringBuilder to String and trim leading/trailing spaces
- return result.toString().trim();
- }
-//Ex:6/ExpertLevel
- public static void toggledString() {
- // Toggle the case of every character in a string using StringBuilder.
- StringBuilder string = new StringBuilder("VIVA LA PATATA!");
- int ln = string.length();
-
- for (int i = 0; i < ln; i++) {
- Character ch = string.charAt(i);
- if (Character.isLowerCase(ch))
-
- string.replace(i, i + 1, Character.toUpperCase(ch) + "");
-
- else
- string.replace(i, i + 1, Character.toLowerCase(ch) + "");
-
- System.out.println(string);
- }
- }
- //Replace line breaks from string.//Ex4ExpLevel
- public static void ReplaceLineBreaks() {
- String a = "Replace\n"
- + " all\n"
- + " line\n"
- + " breaks\n"
- + " from\n"
- + " strings!";
- System.out.println("Original String line breaks! - " + a);
-
-
- a = a.replace("\n", "");
- System.out.println("String after replacing line breaks - " + a);
- }
-//Remove duplicate characters from a string using StringBuilder.//Ex:2/Medium
- public static void removeDuplicates() {
-
- String inputString = "Programming";
- System.out.println("Original String: " + inputString);
-
-
- HashSet uniqueChars = new HashSet<>();
- StringBuilder result = new StringBuilder();
-
- for (char ch : inputString.toCharArray()) {
- if (uniqueChars.add(ch)) {
- result.append(ch);
- }
- System.out.println("String after removing duplicates: " + result);
- }
- }
-
-}
-
-
-
-
-
diff --git a/src/Sesion7_APis_UtilityClasses/Main.java b/src/Sesion7_APis_UtilityClasses/Main.java
deleted file mode 100644
index 115f3e0..0000000
--- a/src/Sesion7_APis_UtilityClasses/Main.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package Sesion7_APis_UtilityClasses;
-
-import javax.swing.*;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.sql.Timestamp;
-import java.text.SimpleDateFormat;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.format.DateTimeFormatter;
-import java.util.*;
-
-public class Main {
- public static void main(String[] args){
- //demonstrateDateTimeOperations();
- //demonstrationRandomNumberGenerator();
- // demoMath();
- //readFromFileWithScanner();
- //gui();
- }
-
- public static void gui(){ //interfata grafica
- JFrame frame = new JFrame("Gui Example");
- frame.setSize(300, 200);
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-
- JButton button = new JButton("Click me!");
- JLabel label = new JLabel("");
-
- button.addActionListener(e-> label.setText("Salut Angelo!"));
-
- frame.getContentPane().add(button,"North");
- frame.getContentPane().add(label,"Center");
-
- frame.setVisible(true);
-
-
-
- }
-
-
-
-
-private static void readFromFileWithScanner(){
- try {
- Scanner scanner = new Scanner(new File("example.txt"));
-
- while (scanner.hasNextLine()){
-
- System.out.println("Text: " + scanner.nextLine());
-
- }
-
- scanner.close();
-
- } catch(FileNotFoundException e) {
- System.out.println("File was not found!!!");
-
- }
-
-}
- private static void demoMath(){
- double a = 5.3;
- double b = 8.2;
-
- double max = Math.max(a, b);
- System.out.println("Max: " + max);
-
- long roundedB = Math.round(b);
- System.out.println("B rounded:: " + roundedB);
-
-
- }
-
-
- private static void demonstrationRandomNumberGenerator(){
-
- System.out.println("=== Random Number Generator ===");
-
- Random random = new Random();
-
- int randomInt = random.nextInt(100) + 1; //1 to 100
- System.out.println("Random int: " + randomInt);
-
- double randomDouble = random.nextDouble();
- System.out.println("Random Double: " + randomDouble);// (0-1)
-
- String[] names = {"Sam", "Ion", "Dan", "Ilie"};
- String theChosen = names[random.nextInt(names.length)];
- System.out.println("Random name: " + theChosen);
-
- boolean randomBoolean = random.nextBoolean();
- System.out.println("Random bollean: " + randomBoolean);
-
- List numbers = Arrays.asList(1,2,3,4,5);
- Collections.shuffle(numbers, random);
- System.out.println("List: " + numbers);
-
- }
-
-
-
-
- private static void demonstrateDateTimeOperations(){
- System.out.println("===Date and Time Operations===");
-
- LocalDate today = LocalDate.now();
- System.out.println("Today`s date: " + today);
- LocalDate tenDaysLater = today.plusDays(10);
- System.out.println("Date after 10 days: " + tenDaysLater);
-
- LocalDateTime currentDateTime = LocalDateTime.now();
- System.out.println("Current date and time: " + currentDateTime);
- LocalDateTime futureDateTime = currentDateTime.plusHours(5).plusMinutes(30);
- System.out.println("5 hours and 30 min later: " + futureDateTime);
-
- LocalDateTime futureDate = LocalDateTime.of(2025,1, 1, 10,30);
- String result = futureDate.isBefore(LocalDateTime.now()) ? "before" : "after";
- System.out.println(futureDate + " is " + result + " curent date time");
-
- //parsing
- String dateTimeString = "2025-01-01 10:30";
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
- LocalDateTime parsedDateTime = LocalDateTime.parse(dateTimeString,formatter);
- System.out.println(" Parsed local date time: " + parsedDateTime);
-
- DateTimeFormatter newFormat = DateTimeFormatter.ofPattern("dd MMMM yyyy HH:mm:ss");
- System.out.println("New format date time: " + parsedDateTime.format(newFormat));
-
-
- java.util.Date utilDate = new java.util.Date();
- java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
-
- System.out.println("java.util.Date : " + utilDate);
- System.out.println("java.sql.Date :" + sqlDate);
-
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm:ss");
- String formatedTime = simpleDateFormat.format(utilDate);
- System.out.println("Formatted time: " + formatedTime);
-
- Timestamp currentTimestamp = new Timestamp(System.currentTimeMillis());
- System.out.println("Current Timestamp: " + currentTimestamp);
-
- Timestamp timestamp1 = Timestamp.valueOf("2024-08-26 18:00:00.123");
- Timestamp timestamp2 = Timestamp.valueOf("2024-08-26 18:03:00.123");
-
- long diffInSeconds = (timestamp2.getTime() - timestamp1.getTime()) / 1000;
- System.out.println("Diff : " + diffInSeconds);
-
-
- }
-
-
-}
diff --git a/src/Sesion_10_OOP_CONCEPTS/Alarm.java b/src/Sesion_10_OOP_CONCEPTS/Alarm.java
deleted file mode 100644
index c374e6f..0000000
--- a/src/Sesion_10_OOP_CONCEPTS/Alarm.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package Sesion_10_OOP_CONCEPTS;
-
-import java.time.LocalDateTime;
-
-public sealed class Alarm permits HightVisibilityAlarm, PriotizeAlarm {
- private boolean active;
- private final String message;
- private LocalDateTime snoozeUntil;
-
-
- // Alarm(){
-// message="asdasf";
-// }
-
- public Alarm(String message) {
- this.message = message;
- stopSnoozing();
- // this(message,false);
- }
-
- public void setSnoozeUntil(LocalDateTime snoozeUntil) {
- this.snoozeUntil = snoozeUntil;
- }
-
- public LocalDateTime getSnoozeUntil() {
- return snoozeUntil;
- }
-
- public boolean isActive() {
- return active;
- }
-
- public boolean getActive() {
- return active;
- }
-
-
- public void snoze() {
- if (active)
- snoozeUntil = LocalDateTime.now().plusSeconds(5);
-
- }
-
- public boolean isSnoozing() {
- return snoozeUntil.isAfter(LocalDateTime.now());
- }
-
-
- public void stopSnoozing() {
- snoozeUntil = LocalDateTime.now().minusSeconds(1);
- }
-
-
-// public Alarm(String message,boolean active) {
-// this .message = message;
-// this.active = active;
-// }
-
- public void turnOn() {
- active = true;
- }
-
- public final void turnOff() {
- active = false;
- stopSnoozing();
- }
-
- public String getReport() {
-
- return getReport(false);
-
- }
-
- public String getReport(boolean toUppercase) {
- if (active && !isSnoozing()) {
- if (toUppercase)
- return message.toUpperCase();
- else
- return message;
- } else return "";
- }
-
- public void sendReport() {
- System.out.println(getReport(true));
- }
-
-}
diff --git a/src/Sesion_10_OOP_CONCEPTS/HightVisibilityAlarm.java b/src/Sesion_10_OOP_CONCEPTS/HightVisibilityAlarm.java
deleted file mode 100644
index 06268ba..0000000
--- a/src/Sesion_10_OOP_CONCEPTS/HightVisibilityAlarm.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package Sesion_10_OOP_CONCEPTS;
-
-public final class HightVisibilityAlarm extends Alarm {
-
- public HightVisibilityAlarm(String message) {
- super(message);
- }
-
- @Override
- public String getReport(boolean toUppercase) {
-// if (isActive() && !isSnoozing()) {
-// if (toUppercase)
-// return getMessage().toUpperCase() + "!";
-// else
-// return getMessage() + "!";
-// } else return "";
-
- String report = super.getReport(toUppercase);
- if (report.isEmpty())
- return report;
- else
- return report + "!";
-
- }
-
- public static void main(String... args) {
- HightVisibilityAlarm alarm = new HightVisibilityAlarm("Temperature is to high");
- alarm.turnOn();
- // System.out.println(alarm.getReport(true));
-
- alarm.sendReport();
- alarm.turnOff();
- alarm.sendReport();
- }
-
-
-}
diff --git a/src/Sesion_10_OOP_CONCEPTS/Main.java b/src/Sesion_10_OOP_CONCEPTS/Main.java
deleted file mode 100644
index 7441c1b..0000000
--- a/src/Sesion_10_OOP_CONCEPTS/Main.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package Sesion_10_OOP_CONCEPTS;
-
-import java.sql.SQLOutput;
-
-public class Main {
- public static void main(String[] args) throws InterruptedException {
- //System.out.println("\nOOP CONCEPTS");
-
- Alarm alarm = new Alarm("La fica e tropo calda!");
- // System.out.println(alarm.active);
- alarm.turnOn();
-
- alarm.snoze();
- // System.out.println("----");
- // alarm.sendReport();
- // Thread.sleep(6000);
- // System.out.println(alarm.active);
- alarm.sendReport();
-
-
- }
-}
diff --git a/src/Sesion_10_OOP_CONCEPTS/PriotizeAlarm.java b/src/Sesion_10_OOP_CONCEPTS/PriotizeAlarm.java
deleted file mode 100644
index a445891..0000000
--- a/src/Sesion_10_OOP_CONCEPTS/PriotizeAlarm.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package Sesion_10_OOP_CONCEPTS;
-
-public non-sealed class PriotizeAlarm extends Alarm {
- private int priority;
-
- public PriotizeAlarm(String message, int priority) {
- super(message);
- this.priority = priority;
- }
-
-
- public int getPriority() {
- return priority;
- }
-
- public static void main(String... args) {
- PriotizeAlarm alarm = new PriotizeAlarm("Temperature is to high", 3);
- System.out.println(alarm.getPriority());
-
- }
-
-}
diff --git a/src/Sesion_12_Abstraction/A.java b/src/Sesion_12_Abstraction/A.java
deleted file mode 100644
index a1b782f..0000000
--- a/src/Sesion_12_Abstraction/A.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package Sesion_12_Abstraction;
-
-public interface A {
- void print(); //public abstract
-
- default void display(){
-
- System.out.println("Default method");
-
-}
-
-}
diff --git a/src/Sesion_12_Abstraction/AClass.java b/src/Sesion_12_Abstraction/AClass.java
deleted file mode 100644
index 572a59b..0000000
--- a/src/Sesion_12_Abstraction/AClass.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package Sesion_12_Abstraction;
-
-public abstract class AClass implements A {
- @Override
- public void print() {
- System.out.println("Salut!");
- }
- @Override
- public void display(){
-
- System.out.println("AClass implementation!");
- }
-
-}
diff --git a/src/Sesion_12_Abstraction/AClassNonabstract.java b/src/Sesion_12_Abstraction/AClassNonabstract.java
deleted file mode 100644
index 77d6a42..0000000
--- a/src/Sesion_12_Abstraction/AClassNonabstract.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package Sesion_12_Abstraction;
-
-public class AClassNonabstract extends AClass{
- @Override
- public void print() {
- System.out.println("AClass");
- }
-}
diff --git a/src/Sesion_12_Abstraction/Animal.java b/src/Sesion_12_Abstraction/Animal.java
deleted file mode 100644
index a95d34d..0000000
--- a/src/Sesion_12_Abstraction/Animal.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package Sesion_12_Abstraction;
-
-public interface Animal {
-
- void sound();
-
- void eat();
-
-}
diff --git a/src/Sesion_12_Abstraction/Caine.java b/src/Sesion_12_Abstraction/Caine.java
deleted file mode 100644
index d9867ac..0000000
--- a/src/Sesion_12_Abstraction/Caine.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package Sesion_12_Abstraction;
-
-public class Caine extends Tetrapods {
-
- public Caine(String name, int members){
- super(name, members);
- }
-
- @Override
- void alearga() {
- System.out.println("Alearga pe 4 picioare");
-
- }
-
- @Override
- public void sound() {
- System.out.println("Face ham ham");
-
- }
-}
diff --git a/src/Sesion_12_Abstraction/Main.java b/src/Sesion_12_Abstraction/Main.java
deleted file mode 100644
index f4bf243..0000000
--- a/src/Sesion_12_Abstraction/Main.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package Sesion_12_Abstraction;
-
-public class Main {
- public static void main(String[] args) {
- AClassNonabstract a = new AClassNonabstract();
- a.print();
- a.display();
-
- Caine caine = new Caine("Azorel", 4);
- caine.alearga();
- caine.eat();
- caine.sound();
- }
-
-
-}
diff --git a/src/Sesion_12_Abstraction/Tetrapods.java b/src/Sesion_12_Abstraction/Tetrapods.java
deleted file mode 100644
index 496a72c..0000000
--- a/src/Sesion_12_Abstraction/Tetrapods.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package Sesion_12_Abstraction;
-
-public abstract class Tetrapods implements Animal {
-
- private String name;
- private int members;
-
- public Tetrapods(String name, int members) {
- this.members = members;
- this.name = name;
-
- }
-
- @Override
- public void eat() {
- System.out.println("Eat");
- }
-
- abstract void alearga();
-
-}
diff --git a/src/Sesion_13_Polymorphism/Main.java b/src/Sesion_13_Polymorphism/Main.java
deleted file mode 100644
index 96cc57c..0000000
--- a/src/Sesion_13_Polymorphism/Main.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package Sesion_13_Polymorphism;
-
-public class Main {
- public static void main(String... args) {
- Animal myAnimal = new Dog();//upcasting ->Animal
- //myAnimal.makeSound();
- // myAnimal.sleep();
-
- Dog myDog = (Dog) myAnimal;//downcasting Animal-> Dog
- myDog.makeSound(5);
-
- // myDog.fetch();
- // myDog.makeSound();
- doAnimalStuff(myDog);
- doAnimalStuff(new Cat());
-
- try {
- Cat myCat = (Cat) myAnimal;
- myCat.makeSound();
- } catch (ClassCastException ex) {
- System.out.println("Eroare.Nu putem face downcasting de la caine la pisica ");
- }
- }
-
- public static void doAnimalStuff(Animal animal) {
- animal.makeSound();
- if (animal instanceof Dog) {
- ((Dog) animal).fetch();
- } else if (animal instanceof Cat) {
- ((Cat) animal).scratch();
- }
-
- }
-
-
-}
-
-
-//clasa parinte/superclasa
-class Animal {
- public void makeSound() {
- System.out.println("Generic sound");
-
- }
-
-
- public void sleep() {
- System.out.println("Sleep");
- }
-}
-//clasa derivata,(subclasa)
-
-class Dog extends Animal {
- @Override
- public void makeSound() {
- System.out.println("Cainele face hamham");
- }
- public void makeSound(int times) {
- for (int i = 0; i < times; i++)
- System.out.println("Cainele face ham ham");
- }
-
- public void fetch() {
- System.out.println("cainele aduce mingea");
- }
-}
-
-//clasa derivata/clasa copil/subclasa
-class Cat extends Animal {
- @Override
- public void makeSound() {
- System.out.println("pisica face miau miau");
- }
-public void makeSound(int times){
-}
-
- public void scratch() {
- System.out.println("pisica zgarie");
- }
-
-}
diff --git a/src/Sesion_13_Polymorphism/PaymentSystem.java b/src/Sesion_13_Polymorphism/PaymentSystem.java
deleted file mode 100644
index 8f9f8c9..0000000
--- a/src/Sesion_13_Polymorphism/PaymentSystem.java
+++ /dev/null
@@ -1,119 +0,0 @@
-package Sesion_13_Polymorphism;
-
-
-//Interfata Payment defineste comportamentele comune pentru toate tipurile de plati
-interface Payment {
- void processPayment(double amount);//o metoda abstracta pentru procesarea platilor
-
- void showTransactionDetails();
-
-}
-
-abstract class CardPayment implements Payment {
- private String cardNumber;
- private String cardHolderName;
-
-
- public CardPayment(String cardNumber, String cardHolderName) {
- this.cardNumber = cardNumber;
- this.cardHolderName = cardHolderName;
- }
-
- @Override
- public void showTransactionDetails() {
- System.out.println("Plata realizata cu cardul: " + cardHolderName + "(Card: " + maskCardNumber() + ")");
-
- }
-
- private String maskCardNumber() {
- return "**** **** **** " + cardNumber.substring(cardNumber.length() - 4);
-
- }
-
- public String getCardHolderName() {
- return cardHolderName;
- }
-
-}
-
-class CreditCardPayment extends CardPayment {
- public CreditCardPayment(String cardNumber, String cardHolderName) {
- super(cardNumber, cardHolderName);
- }
-
- @Override
- public void processPayment(double amount) {
- System.out.println("Procesare plata card credit de : " + amount + "pentru " + super.getCardHolderName());
- }
-}
-
-class DebitCardPayment extends CardPayment {
- public DebitCardPayment(String cardNumber, String cardHolderName) {
- super(cardNumber, cardHolderName);
- }
-
- @Override
- public void processPayment(double amount) {
- System.out.println("Procesare plata card deb " + amount + "pentru " + super.getCardHolderName());
- }
-}
-
-class BankTransfer implements Payment {
- private String iban;
- private String bankName;
-
- public BankTransfer(String iban, String bankName) {
- this.iban = iban;
- this.bankName = bankName;
- }
-
- @Override
- public void processPayment(double amount) {
- System.out.println("TransferTransfer bancar de " + amount + "catre IBAN-ul " + iban + "la banca " + bankName);
- }
-
- @Override
- public void showTransactionDetails() {
- System.out.println("Detalii transfer bancar : Iban " + iban + "Banca: " + bankName);
-
- }
-}
-
-class CryptoPayment implements Payment {
- private String walletAddress;
- private String cryptoType;
-
- public CryptoPayment(String walletAddress, String cryptoType) {
- this.cryptoType = cryptoType;
- this.walletAddress = walletAddress;
- }
-
- @Override
- public void processPayment(double amount) {
- System.out.println("Plata de " + amount + " " + cryptoType + " cartre adresa " + walletAddress);
- }
-
- @Override
- public void showTransactionDetails() {
- System.out.println("Detali plata crypto: " + cryptoType + "wallet: " + walletAddress);
- }
-}
-
-
-public class PaymentSystem {
- public static void main(String... args) {
- Payment creditCard = new CreditCardPayment("1234567812345678 ", " Ion Popescu ");
- Payment debitCard = new DebitCardPayment("8765432187654321 ", " Maria ionescu ");
- Payment bankTransfer = new BankTransfer("RO79btrlro76546789 ", " BT");
- Payment cryptoPayment = new CryptoPayment("ierujsdjf54h32545fh", "Bitcoin ");
-
- Payment[] payments = {creditCard,debitCard,bankTransfer,cryptoPayment};
-
- for(Payment p : payments){
- p.processPayment( 100.0 );
- p.showTransactionDetails();
- System.out.println();
- }
-
- }
-}
diff --git a/src/Sesion_14_Recap_OPP/Main.java b/src/Sesion_14_Recap_OPP/Main.java
deleted file mode 100644
index bec79ef..0000000
--- a/src/Sesion_14_Recap_OPP/Main.java
+++ /dev/null
@@ -1,295 +0,0 @@
-package Sesion_14_Recap_OPP;
-
-import java.time.LocalDate;
-import java.util.ArrayList;
-import java.util.List;
-
-abstract class Item {
- protected String titlu;
- protected int anPublicare;
-
- public Item(String titlu, int anPublicare) {
- this.titlu = titlu;
- this.anPublicare = anPublicare;
- }
-
- public String getTitlu() {
- return titlu;
- }
-
- public int getAnPublicare() {
- return anPublicare;
- }
-
- abstract public String getDetalii();
-}
-
-interface Imprumutabil {
- void imprumuta(String numeCititor, LocalDate dataReturnare);
-
- void returneaza();
-
- boolean esteDisponibil();
-
- String getNumeCititor();
-
- LocalDate getDataReturnare();
-}
-
-class Carte extends Item implements Imprumutabil {
- private String autor;
- private boolean disponibil;
- private String numeCititor;
- private LocalDate dataReturnare;
-
- public Carte(String titlu, String autor, int anPublicare) {
- super(titlu, anPublicare);
- this.autor = autor;
- this.disponibil = true;
- }
-
- public String getAutor() {
- return autor;
- }
-
- @Override
- public String getDetalii() {
- return "Carte: " + titlu + " de " + autor + " (" + anPublicare + ")";
- }
-
- @Override
- public void imprumuta(String numeCititor, LocalDate dataReturnare) {
- this.disponibil = false;
- this.numeCititor = numeCititor;
- this.dataReturnare = dataReturnare;
- }
-
- @Override
- public void returneaza() {
- this.disponibil = true;
- this.numeCititor = null;
- this.dataReturnare = null;
- }
-
- @Override
- public boolean esteDisponibil() {
- return disponibil;
- }
-
- @Override
- public String getNumeCititor() {
- return numeCititor;
- }
-
- @Override
- public LocalDate getDataReturnare() {
- return dataReturnare;
- }
-}
-
-class Revista extends Item implements Imprumutabil {
- private int numarEditie;
- private boolean disponibil;
- private String numeCititor;
- private LocalDate dataReturnare;
-
- public Revista(String titlu, int anPublicare, int numarEditie) {
- super(titlu, anPublicare);
- this.numarEditie = numarEditie;
- this.disponibil = true;
- }
-
- public int getNumarEditie() {
- return numarEditie;
- }
-
- @Override
- public String getDetalii() {
- return "Revista: " + titlu + " Nr. " + numarEditie + " (" + anPublicare + ")";
- }
-
- @Override
- public void imprumuta(String numeCititor, LocalDate dataReturnare) {
- this.disponibil = false;
- this.numeCititor = numeCititor;
- this.dataReturnare = dataReturnare;
- }
-
- @Override
- public void returneaza() {
- this.disponibil = true;
- this.numeCititor = null;
- this.dataReturnare = null;
- }
-
- @Override
- public boolean esteDisponibil() {
- return disponibil;
- }
-
- @Override
- public String getNumeCititor() {
- return numeCititor;
- }
-
- @Override
- public LocalDate getDataReturnare() {
- return dataReturnare;
- }
-}
-
-class Imprumut {
- private Imprumutabil item;
- private String numeCititor;
- private LocalDate dataImprumut;
- private LocalDate dataReturnare;
-
- public Imprumut(Imprumutabil item, String numeCititor, LocalDate dataReturnare) {
- this.item = item;
- this.numeCititor = numeCititor;
- this.dataImprumut = LocalDate.now();
- this.dataReturnare = dataReturnare;
- }
-
- public Imprumutabil getItem() {
- return item;
- }
-
- public String getNumeCititor() {
- return numeCititor;
- }
-
- public LocalDate getDataImprumut() {
- return dataImprumut;
- }
-
- public LocalDate getDataReturnare() {
- return dataReturnare;
- }
-
- @Override
- public String toString() {
- return "Împrumut: " + ((Item) item).getTitlu() + " de către " + numeCititor +
- " (Împrumutat: " + dataImprumut + ", Returnare: " + dataReturnare + ")";
- }
-}
-
-class Biblioteca {
- private List- items;
- private List imprumuturi;
-
- public Biblioteca() {
- this.items = new ArrayList<>();
- this.imprumuturi = new ArrayList<>();
- }
-
- public void adaugaItem(Item item) {
- items.add(item);
- }
-
- public void eliminaItem(Item item) {
- items.remove(item);
- }
-
- public Item cautaDupaTitlu(String titlu) {
- for (Item item : items) {
- if (item.getTitlu().equalsIgnoreCase(titlu)) {
- return item;
- }
- }
- return null;
- }
-
- public List
- cautaDupaAutor(String autor) {
- List
- rezultate = new ArrayList<>();
- for (Item item : items) {
- if (item instanceof Carte && ((Carte) item).getAutor().equalsIgnoreCase(autor)) {
- rezultate.add(item);
- }
- }
- return rezultate;
- }
-
- public void afiseazaToateElementele() {
- for (Item item : items) {
- System.out.println(item.getDetalii() + " - Disponibil: " +
- (item instanceof Imprumutabil ? ((Imprumutabil) item).esteDisponibil() : "N/A"));
- }
- }
-
- public void imprumutaItem(Item item, String numeCititor, LocalDate dataReturnare) {
- if (item instanceof Imprumutabil) {
- Imprumutabil imprumutabil = (Imprumutabil) item;
- if (imprumutabil.esteDisponibil()) {
- imprumutabil.imprumuta(numeCititor, dataReturnare);
- imprumuturi.add(new Imprumut(imprumutabil, numeCititor, dataReturnare));
- System.out.println("Item împrumutat cu succes: " + item.getTitlu());
- } else {
- System.out.println("Item-ul nu este disponibil pentru împrumut: " + item.getTitlu());
- }
- } else {
- System.out.println("Acest item nu poate fi împrumutat: " + item.getTitlu());
- }
- }
-
- public void returneazaItem(Item item) {
- if (item instanceof Imprumutabil) {
- Imprumutabil imprumutabil = (Imprumutabil) item;
- if (!imprumutabil.esteDisponibil()) {
- imprumutabil.returneaza();
- imprumuturi.removeIf(imprumut -> imprumut.getItem() == imprumutabil);
- System.out.println("Item returnat cu succes: " + item.getTitlu());
- } else {
- System.out.println("Acest item nu a fost împrumutat: " + item.getTitlu());
- }
- } else {
- System.out.println("Acest item nu poate fi returnat: " + item.getTitlu());
- }
- }
-
- public void afiseazaImprumuturi() {
- if (imprumuturi.isEmpty()) {
- System.out.println("Nu există împrumuturi active.");
- } else {
- System.out.println("Împrumuturi active:");
- for (Imprumut imprumut : imprumuturi) {
- System.out.println(imprumut);
- }
- }
- }
-}
-
-public class Main {
- public static void main(String[] args) {
- Biblioteca biblioteca = new Biblioteca();
-
- Carte carte1 = new Carte("Mândrie și prejudecată", "Jane Austen", 1813);
- Carte carte2 = new Carte("1984", "George Orwell", 1949);
- Revista revista1 = new Revista("National Geographic", 2023, 1);
-
- biblioteca.adaugaItem(carte1);
- biblioteca.adaugaItem(carte2);
- biblioteca.adaugaItem(revista1);
-
- System.out.println("Toate elementele din bibliotecă:");
- biblioteca.afiseazaToateElementele();
-
- System.out.println("\nÎmprumutarea cărții '1984':");
- biblioteca.imprumutaItem(carte2, "Ion Popescu", LocalDate.now().plusWeeks(2));
-
- System.out.println("\nÎmprumutarea revistei 'National Geographic':");
- biblioteca.imprumutaItem(revista1, "Maria Ionescu", LocalDate.now().plusWeeks(1));
-
- System.out.println("\nToate elementele după împrumut:");
- biblioteca.afiseazaToateElementele();
-
- System.out.println("\nAfișarea împrumuturilor active:");
- biblioteca.afiseazaImprumuturi();
-
- System.out.println("\nReturnarea cărții '1984':");
- biblioteca.returneazaItem(carte2);
-
- System.out.println("\nAfișarea împrumuturilor active după returnare:");
- biblioteca.afiseazaImprumuturi();
- }
-}
\ No newline at end of file
diff --git a/src/Sesion_15_CollectionsFramework/ComparatorMunte.java b/src/Sesion_15_CollectionsFramework/ComparatorMunte.java
deleted file mode 100644
index f35cf37..0000000
--- a/src/Sesion_15_CollectionsFramework/ComparatorMunte.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package Sesion_15_CollectionsFramework;
-
-import java.util.Comparator;
-
-public class ComparatorMunte implements Comparator {
-
- @Override
- public int compare(Munte o1, Munte o2) {
- return o1.getNume().compareTo(o2.getNume());
- }
-}
diff --git a/src/Sesion_15_CollectionsFramework/Main.java b/src/Sesion_15_CollectionsFramework/Main.java
deleted file mode 100644
index 8653979..0000000
--- a/src/Sesion_15_CollectionsFramework/Main.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package Sesion_15_CollectionsFramework;
-
-import java.util.*;
-
-public class Main {
- public static void main(String[] args) {
- List fructe = new ArrayList<>(Arrays.asList("mar", "banana", "portocala", "pruna"));
-
- for (String fruct : fructe) {
- System.out.println(fruct);
- // if(fruct.equals("banana")){
- // fructe.remove(fruct);
- // }
- }
-
- //itnterator
- Iterator iterator = fructe.iterator();
-
- while (iterator.hasNext()) {
- String fruct = iterator.next();
- System.out.println("Fruct: " + fruct);
- if (fruct.equals("banana")) {
- iterator.remove();
- }
- }
- System.out.println("Lista dupa stergere: " + fructe);
-
-
- List munti = new ArrayList<>();
- munti.add(new Munte("Everest", 8840));
- munti.add(new Munte("K2", 8644));
- munti.add(new Munte("Makalu", 8300));
-
- System.out.println("Munti initial: " + munti);
- Collections.sort(munti);
-
- System.out.println("Munti dupa sort: " + munti);
- Collections.sort(munti, new ComparatorMunte());
-
- System.out.println("Munti dupa sortare nume: " + munti);
- }
-}
diff --git a/src/Sesion_15_CollectionsFramework/MapsExample.java b/src/Sesion_15_CollectionsFramework/MapsExample.java
deleted file mode 100644
index dccec13..0000000
--- a/src/Sesion_15_CollectionsFramework/MapsExample.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package Sesion_15_CollectionsFramework;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.TreeMap;
-
-public class MapsExample {
- public static void main(String... args) {
- Map hasMap = new HashMap<>();
- Map treeMap = new TreeMap<>();
-
- hasMap.put("Romania", 20000000);
- hasMap.put("Germania", 85000000);
- hasMap.put("Franta", 6600600);
-
-
- treeMap.put("Romania", 2000000);
- treeMap.put("Germania", 8500000);
- treeMap.put("Franta", 6600600);
-
- System.out.println("hasMap" + hasMap);
- System.out.println("treemap" + treeMap);
-
- //print contains
- System.out.println("Contains Romania: " + hasMap.containsKey("Romania"));
- System.out.println("Contains 2000000" + treeMap.containsValue(2000000));
-
-
- for (String key : hasMap.keySet()) {
- System.out.println("Key : " + key + " - value " + hasMap.get(key));
- }
-
-//+ var mapentri string intiger
- for (Map.Entry entry : treeMap.entrySet()) {
- System.out.println("Key: " + entry.getKey() + " - value " + entry.getValue());
- }
-//update
- hasMap.put("Romania", 1980000);
- System.out.println(hasMap);
-
- TreeMap tree = new TreeMap<>(treeMap);
-
- System.out.println("Prima intrare: " + tree.firstEntry());
- System.out.println("Ultima intrare: " + tree.lastEntry());
- System.out.println("Intrare inferioara Germania: " + tree.lowerEntry("Germania"));
- System.out.println("Intrare superioara Germania: " + tree.higherEntry("Germania"));
-
-
- }
-}
diff --git a/src/Sesion_15_CollectionsFramework/Munte.java b/src/Sesion_15_CollectionsFramework/Munte.java
deleted file mode 100644
index fbb2903..0000000
--- a/src/Sesion_15_CollectionsFramework/Munte.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package Sesion_15_CollectionsFramework;
-
-public class Munte implements Comparable {
- private String nume;
- private int inaltime;
-
-
- public Munte(String n, int i) {
- this.nume = n;
- this.inaltime = i;
- }
-
- public String getInaltime() {
- return nume;
-
- }
-
- public String getNume() {
- return getNume();
- }
-
- @Override
- public int compareTo(Munte o) {
- return Integer.compare(this.inaltime, o.inaltime);
- }
-
- @Override
- public String toString() {
- return nume + " (" + inaltime + "m)";
- }
-}
diff --git a/src/Sesion_15_CollectionsFramework/SetExamples.java b/src/Sesion_15_CollectionsFramework/SetExamples.java
deleted file mode 100644
index db844a1..0000000
--- a/src/Sesion_15_CollectionsFramework/SetExamples.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package Sesion_15_CollectionsFramework;
-
-import java.util.HashSet;
-import java.util.Set;
-import java.util.TreeSet;
-
-public class SetExamples {
- public static void main(String[] args) {
- Set hashSet = new HashSet<>();
- Set treeSet = new TreeSet<>();
-
- addElement(hashSet, " Ion");
- addElement(hashSet, " Sam");
- addElement(hashSet, " Dan");
- addElement(hashSet, " Bob");
- addElement(hashSet, " Ion");
-
-
- //=========================================
-
- addElement(treeSet, " Ion");
- addElement(treeSet, " Sam");
- addElement(treeSet, " Dan");
- addElement(treeSet, " Bob");
- addElement(treeSet, " Ion");
-
-
- //display sets
- System.out.println("HashSet: " + hashSet);
- System.out.println("TreeSet: " + treeSet);
-
- String nume = "Ion";
- System.out.println("HashMap contains: " + nume + "?" + hashSet.contains(nume));
- System.out.println("Treset contains: " + nume + "?" + treeSet.contains(nume));
-
-
- boolean removed = hashSet.remove(nume);
- System.out.println("Removeing: " + nume + " - " + (removed ? " success " : "not fund"));
-
- boolean removed1 = hashSet.remove(nume);
- System.out.println("Removeing: " + nume + " - " + (removed1 ? " success " : " not fund"));
-
- }
-
- private static void addElement(Set set, String element) {
- boolean added = set.add(element);
- System.out.println(set.getClass().getSimpleName() + " : Adding" + element + " " + (added ? "Succes " : " Duplicate"));
- }
-
-
-}
diff --git a/src/Sesion_16_Equals_HasCodeGenericsEnum/Animal.java b/src/Sesion_16_Equals_HasCodeGenericsEnum/Animal.java
deleted file mode 100644
index 1815756..0000000
--- a/src/Sesion_16_Equals_HasCodeGenericsEnum/Animal.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package Sesion_16_Equals_HasCodeGenericsEnum;
-
-public interface Animal {
- void sound();
-}
diff --git a/src/Sesion_16_Equals_HasCodeGenericsEnum/Cat.java b/src/Sesion_16_Equals_HasCodeGenericsEnum/Cat.java
deleted file mode 100644
index 47c3eaa..0000000
--- a/src/Sesion_16_Equals_HasCodeGenericsEnum/Cat.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package Sesion_16_Equals_HasCodeGenericsEnum;
-
-public class Cat implements Animal {
- @Override
- public void sound() {
- System.out.println("miau miau");
- }
-
- @Override
- public String toString() {
- return "pisica face miau miau";
- }
-}
diff --git a/src/Sesion_16_Equals_HasCodeGenericsEnum/Dog.java b/src/Sesion_16_Equals_HasCodeGenericsEnum/Dog.java
deleted file mode 100644
index e5b2b9f..0000000
--- a/src/Sesion_16_Equals_HasCodeGenericsEnum/Dog.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package Sesion_16_Equals_HasCodeGenericsEnum;
-
-public class Dog implements Animal {
- @Override
- public void sound() {
- System.out.println("ham ham");
- }
-
- @Override
- public String toString() {
- return "Cainele face ham ham";
- }
-}
diff --git a/src/Sesion_16_Equals_HasCodeGenericsEnum/IntegerPrinter.java b/src/Sesion_16_Equals_HasCodeGenericsEnum/IntegerPrinter.java
deleted file mode 100644
index 2846665..0000000
--- a/src/Sesion_16_Equals_HasCodeGenericsEnum/IntegerPrinter.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package Sesion_16_Equals_HasCodeGenericsEnum;
-
-public class IntegerPrinter {
- private int thingToPrint;
-
- public IntegerPrinter(int thingToPrint) {
- this.thingToPrint = thingToPrint;
- }
-
- public void print() {
- System.out.println(thingToPrint);
- }
-}
diff --git a/src/Sesion_16_Equals_HasCodeGenericsEnum/Main.java b/src/Sesion_16_Equals_HasCodeGenericsEnum/Main.java
deleted file mode 100644
index aaa0b5e..0000000
--- a/src/Sesion_16_Equals_HasCodeGenericsEnum/Main.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package Sesion_16_Equals_HasCodeGenericsEnum;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-public class Main {
- public static void main(String... args) {
-// equalsExamples();
- genericExamples();
- }
-
- public static void genericExamples() {
- IntegerPrinter integerPrinter = new IntegerPrinter(5);
- integerPrinter.print();
-
- StringPrinter stringPrinter = new StringPrinter("bla bal");
- stringPrinter.print();
-
-// Printer intPrinter = new Printer<>(52);
-// Printer strPrinter = new Printer<>("ha ha");
-// intPrinter.print();
-// strPrinter.print();
-
- Printer catPrinter = new Printer<>(new Cat());
- catPrinter.print();
-
- Printer dogPrinter = new Printer<>(new Dog());
- dogPrinter.print();
-
-
- ArrayList catList = new ArrayList<>();
- catList.add(new Cat());
-
-// Cat cat = catList.get(0);
-
- print(2, "hihi");
-
- List intList = new ArrayList<>();
- intList.add(6);
-
-// printList(intList);
- printListWhildcard(intList);
- printListWhildcard(catList);
-
- printListWhildcard2(catList);
- }
-
- //metoda generica cu 2 parametrii
- public static void print(T p1, E p2) {
- System.out.println("p1: " + p1 + " p2: " + p2);
- }
-
- public static void printList(List