Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

team codecrafters #8

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Java/CurrencyConverter.class
Binary file not shown.
2 changes: 1 addition & 1 deletion Java/Question-2.java → Java/CurrencyConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static void main(String[] args) {
double convertedAmount = usdToEur(amount);
System.out.println("Amount in EUR: " + convertedAmount);
} else if (currency.equalsIgnoreCase("EUR")) {
double convertedAmount = usdToEur(amount);
double convertedAmount = eurToUsd(amount);
System.out.println("Amount in USD: " + convertedAmount);
} else {
System.out.println("Invalid currency.");
Expand Down
Binary file added Java/Main.class
Binary file not shown.
1 change: 1 addition & 0 deletions Java/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);

}
Expand Down
Binary file added Java/NumberGuessingGame.class
Binary file not shown.
4 changes: 2 additions & 2 deletions Java/Question-3.java → Java/NumberGuessingGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ public static void guessNumber() {
System.out.print("Guess the number (between 1 and 100): ");
int guess = scanner.nextInt();

if (guess > 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.");
Expand Down
Binary file added Java/PasswordChecker.class
Binary file not shown.
14 changes: 12 additions & 2 deletions Java/Question-4.java → Java/PasswordChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,19 @@
import java.util.Scanner;

public class PasswordChecker {
static int lc=0,uc=0,sc=0;
public static boolean checkPassword(String password) {
if (password.length() >= 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;
}
Expand All @@ -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.");
}
}
}
Binary file added Java/Question.class
Binary file not shown.
8 changes: 4 additions & 4 deletions Java/Question-1.java → Java/Question.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
public class BubbleSort {
public class Question {
public static void bubbleSort(int[] arr) {
int n = arr.length;
for (int i = 0; i < n; i++) {
for (int j = i; j < n - i - 1; j++) {
if (arr[j] < arr[j + 1]) {
for (int i = 0; i < n-1; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (arr[j] > arr[j + 1]) {
int temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
Expand Down