From 1352557d2b3f7ac7911a43578b6e99d7af7c25e2 Mon Sep 17 00:00:00 2001 From: Ayush Kumar Date: Sat, 4 May 2024 12:19:48 +0530 Subject: [PATCH] team codecrafters --- Java/CurrencyConverter.class | Bin 0 -> 1595 bytes Java/{Question-2.java => CurrencyConverter.java} | 2 +- Java/Main.class | Bin 0 -> 1202 bytes Java/Main.java | 1 + Java/NumberGuessingGame.class | Bin 0 -> 989 bytes .../{Question-3.java => NumberGuessingGame.java} | 4 ++-- Java/PasswordChecker.class | Bin 0 -> 1262 bytes Java/{Question-4.java => PasswordChecker.java} | 14 ++++++++++++-- Java/Question.class | Bin 0 -> 1261 bytes Java/{Question-1.java => Question.java} | 8 ++++---- 10 files changed, 20 insertions(+), 9 deletions(-) create mode 100644 Java/CurrencyConverter.class rename Java/{Question-2.java => CurrencyConverter.java} (94%) create mode 100644 Java/Main.class create mode 100644 Java/NumberGuessingGame.class rename Java/{Question-3.java => NumberGuessingGame.java} (90%) create mode 100644 Java/PasswordChecker.class rename Java/{Question-4.java => PasswordChecker.java} (54%) create mode 100644 Java/Question.class rename Java/{Question-1.java => Question.java} (77%) diff --git a/Java/CurrencyConverter.class b/Java/CurrencyConverter.class new file mode 100644 index 0000000000000000000000000000000000000000..f80085d59b17c6d3158cf3fbe5f1e44a0103ad8c GIT binary patch literal 1595 zcmaJ>U31e$6g}(MmSYQ&IG+wBm^K8Pv@tC$EjCRGc2Zm%ptWNP^lKw;gRs1ErB$Z+ zC#8R&kDc-m7&^lb;HAH#&%86-l^yDgJ@t&G-M#0YJ@@R@zI^@s1%P$%BqA6y5H%4) zoMG}2-{%E~%e}(w-ABSw4DqYBwADJpST5g;Z~XgM|9+2eyt)+r444d4VOpSUr%<=J zl)@XwNlX}+G% zVcx_7G9=9nNa=rMcRX7jktJ}7;pC=N!priG8%R~mCUF`|2F{qs;w;1Tk%)mjhFDj# z5N%&U=n5&cL4{78pE|sshtBfc?TfJf83+=NJI_k&-u2WfLh1OCrv8jb5MBp{t9l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main.java b/Java/Main.java index 8ceded5..40aa14c 100644 --- a/Java/Main.java +++ b/Java/Main.java @@ -4,6 +4,7 @@ public class Main { // Function to calculate the factorial of a number static int factorial(int n) { + if(n<=1) return 1; return n * factorial(n - 1); } diff --git a/Java/NumberGuessingGame.class b/Java/NumberGuessingGame.class new file mode 100644 index 0000000000000000000000000000000000000000..d5a79498485d2e8a8fd7f868c6733e028df1484a GIT binary patch literal 989 zcmZuwTTc@~6#k~&c1u}Gxg$`SD&j6;3tmtz;sc4K3Th}48(-YEld{;(lI^a@-!UdU z%R@0@d^PbW8Ka)r(ty#InX~8eo$otm_WQ5TUjeM*K@t%}b!Y}+h%==3?6-ElZp&K! zS$R)Xe1`anBOQO0A!=GXIuf0vz<28TEn8OIMiM%r>gYCLpoc-1;+tDvKo zp)Z6EtBMs{O5t^(5B)j@3=CqZ0~_`(9yWc^V2C)9VQ3?)bliMF?gxI+_k`V8P9lX7 z#d?%s)ckLXwWB(W85qX|(RTyla}M_0b7TiBfy)fj>w#!CxxXv83>szOakDJ^10f`z z=cJR*&&^p&JPD4hjw=SPVv1p)L+%0|Lu_B6Q@b-}ZB;%wYs=P-;y$fLbv>MFApwhk zwq2Lk-GeOO_71sSvmKdJy>1woRgLrzvMv+IF$}8YU8lBtF*|`d26N4oHP7~gy6roz zY-V}M4R}pS6V(gi2>TXp>$qd!uG)P6(@=9b17f*uHv~g>Sl5owF4x>DIeRx8DcZhm zyIdzvPtmt4Z#M1yvu~|IMp;C?R(kb-P3A&!lq^m6?wbv`BNR^I} zKEd$jF)sCIT9}+|;o53Odykazm@Uj4VKS4herP*xhK?|n56$?|?{BJoBy7Kc9 number) { + if (guess < 1) { System.out.println("Too low! Try again."); - } else if (guess <= number) { + } else if (guess > 100) { System.out.println("Too high! Try again."); } else { System.out.println("Congratulations! You guessed the number."); diff --git a/Java/PasswordChecker.class b/Java/PasswordChecker.class new file mode 100644 index 0000000000000000000000000000000000000000..28f231cf40a3a31d54b054e8f63caa81212226b8 GIT binary patch literal 1262 zcmZ`&TTc@~6#k~S-Igtsa%pX8DJa+$qzK-Cied$=0%9;E;)~0&p$qM{X}5Sue9|`` zeK5p?h(7S*i!~`m6MumJ##iI*%(g}Fl6Gg#%=zZbcfNDx^N$ao08HY#3l>-f*d*BD zVDPNVn{py6>uZS{E90@|YKSjq`6+61&q=s+h!%Ys}g-OCqOQyEp+P>T$ftir(39OsvC zgo7+)g)f5=y3A!s5fEl*H940JEt^I%dt2 zT0W813uS{cQ03f&3nBD#IgT^Y|Oe1&m(aEJFn?t`)U>^EKyb8f1?%6b}UE1^a|B6Pcg?mhI)RuJ_LRxvbC#i_Z$_c*u3(~f$R zRZN= 8) { - return true; + for (int i = 0; i < password.length(); i++) { + if(password.charAt(i)>='a' && password.charAt(i)<='z') lc++; + else if(password.charAt(i)>='A' && password.charAt(i)<='Z') uc++; + else if(password.charAt(i)>='0' && password.charAt(i)<='9') ; + else if(password.charAt(i)==' ') ; + else sc++; + + } + if(lc>0 && uc>0 && sc>0) return true; + else return false; } else { return false; } @@ -19,7 +29,7 @@ public static void main(String[] args) { if (checkPassword(password)) { System.out.println("Password is valid."); } else { - System.out.println("Password is too short."); + System.out.println("Password is invalid."); } } } diff --git a/Java/Question.class b/Java/Question.class new file mode 100644 index 0000000000000000000000000000000000000000..c55dc89edb2f25e173dddc18a5383a85503f8ae6 GIT binary patch literal 1261 zcmaJ>T~8B16g|`3?Uu5@3Y3aaLmsR(OmhsF?k+7Pa1+7?5&)F_pzB5ymC zqr}&8i9#DX(WOGya0%UKu=6{vCu#&~Hz+!?+^lNa=_ih9d3nzfyp{=}m!Z?g6P01^ zIDBVzIE+3-Rb1B4k1Gs47vxd#x{pGz@fL2A4S|~0dL~imCfs!!&_~>=RE0ab zY};FndgeTjQ#)r8S9j{-g7DLHTL&(4TK8j!EU#AcrYGo3Opz39m_f@~mT0}9sB1=1)%%QMNN+cadQg9EEKhub z`W_wKJ^P4EtV|v*NYipej_qM^G9ss@74k)t0}KEZuq#vh-)UpgB*HMp!o&ev=Y(sn~x%Jgn1}LPep arr[j + 1]) { int temp = arr[j]; arr[j] = arr[j + 1]; arr[j + 1] = temp;