forked from CodeNerve/Let-Us-Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created maven modules for code that didnt have them.
- Loading branch information
Chris
authored and
Chris
committed
Oct 22, 2020
1 parent
24feaa1
commit 056d1fb
Showing
78 changed files
with
441 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>LetUsJava</artifactId> | ||
<groupId>com.let.us.java</groupId> | ||
<version>1.0-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>BinaryTree</artifactId> | ||
|
||
|
||
</project> |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>LetUsJava</artifactId> | ||
<groupId>com.let.us.java</groupId> | ||
<version>1.0-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>BubbleSort</artifactId> | ||
|
||
|
||
</project> |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>LetUsJava</artifactId> | ||
<groupId>com.let.us.java</groupId> | ||
<version>1.0-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>CodeQuotient2</artifactId> | ||
|
||
|
||
</project> |
2 changes: 0 additions & 2 deletions
2
codeQuotient2/src/codeQuotient/Student.java → CodeQuotient2/src/main/java/Student.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
package codeQuotient; | ||
|
||
import java.util.Scanner; | ||
|
||
import java.util.Scanner; | ||
|
2 changes: 0 additions & 2 deletions
2
codeQuotient2/src/codeQuotient/TimeSpan.java → CodeQuotient2/src/main/java/TimeSpan.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
package codeQuotient; | ||
|
||
import java.util.Scanner; | ||
|
||
class TimeSpan | ||
|
2 changes: 0 additions & 2 deletions
2
...nt2/src/codeQuotient/add1toeachDigit.java → ...tient2/src/main/java/add1toeachDigit.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
package codeQuotient; | ||
|
||
import java.util.Scanner; | ||
import java.lang.Math; | ||
class add1toeachDigit | ||
|
2 changes: 0 additions & 2 deletions
2
codeQuotient2/src/codeQuotient/aggMarks.java → CodeQuotient2/src/main/java/aggMarks.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
package codeQuotient; | ||
|
||
import java.util.Scanner; | ||
|
||
public class aggMarks { | ||
|
2 changes: 0 additions & 2 deletions
2
...ent2/src/codeQuotient/classRectangle.java → ...otient2/src/main/java/classRectangle.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
package codeQuotient; | ||
|
||
import java.util.ArrayList; | ||
|
||
class classRectangle | ||
|
2 changes: 0 additions & 2 deletions
2
...ient2/src/codeQuotient/cmpareReverse.java → ...uotient2/src/main/java/cmpareReverse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
package codeQuotient; | ||
|
||
import java.util.Scanner; | ||
|
||
public class cmpareReverse { | ||
|
2 changes: 0 additions & 2 deletions
2
codeQuotient2/src/codeQuotient/evenodd.java → CodeQuotient2/src/main/java/evenodd.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
package codeQuotient; | ||
|
||
import java.util.Scanner; | ||
|
||
public class evenodd { | ||
|
2 changes: 0 additions & 2 deletions
2
...Quotient2/src/codeQuotient/factorial.java → CodeQuotient2/src/main/java/factorial.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
package codeQuotient; | ||
|
||
import java.util.Scanner; | ||
|
||
public class factorial { | ||
|
2 changes: 0 additions & 2 deletions
2
codeQuotient2/src/codeQuotient/hra.java → CodeQuotient2/src/main/java/hra.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
package codeQuotient; | ||
|
||
import java.util.Scanner; | ||
|
||
public class hra { | ||
|
3 changes: 0 additions & 3 deletions
3
codeQuotient2/src/codeQuotient/kaperker.java → CodeQuotient2/src/main/java/kaperker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
codeQuotient2/src/codeQuotient/leapYear.java → CodeQuotient2/src/main/java/leapYear.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
package codeQuotient; | ||
|
||
import java.util.Scanner; | ||
|
||
public class leapYear { | ||
|
2 changes: 0 additions & 2 deletions
2
...rc/codeQuotient/matrixMultiplication.java → ...2/src/main/java/matrixMultiplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
package codeQuotient; | ||
|
||
import java.util.Scanner; | ||
|
||
public class matrixMultiplication { | ||
|
2 changes: 0 additions & 2 deletions
2
codeQuotient2/src/codeQuotient/max.java → CodeQuotient2/src/main/java/max.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
package codeQuotient; | ||
|
||
import java.util.Scanner; | ||
|
||
public class max{ | ||
|
3 changes: 0 additions & 3 deletions
3
...uotient2/src/codeQuotient/maxElement.java → CodeQuotient2/src/main/java/maxElement.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
package codeQuotient; | ||
|
||
|
||
import java.util.Scanner; | ||
|
||
public class maxElement { | ||
|
2 changes: 0 additions & 2 deletions
2
...ent2/src/codeQuotient/multiplication.java → ...otient2/src/main/java/multiplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
package codeQuotient; | ||
|
||
import java.util.Scanner; | ||
|
||
public class multiplication { | ||
|
2 changes: 0 additions & 2 deletions
2
codeQuotient2/src/codeQuotient/primenum.java → CodeQuotient2/src/main/java/primenum.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
package codeQuotient; | ||
|
||
import java.util.Scanner; | ||
|
||
public class primenum { | ||
|
2 changes: 0 additions & 2 deletions
2
codeQuotient2/src/codeQuotient/sumArray.java → CodeQuotient2/src/main/java/sumArray.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
package codeQuotient; | ||
|
||
import java.util.Scanner; | ||
|
||
public class sumArray | ||
|
2 changes: 0 additions & 2 deletions
2
codeQuotient2/src/codeQuotient/sumofn.java → CodeQuotient2/src/main/java/sumofn.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
package codeQuotient; | ||
|
||
import java.util.Scanner; | ||
|
||
public class sumofn { | ||
|
2 changes: 0 additions & 2 deletions
2
codeQuotient2/src/codeQuotient/swap.java → CodeQuotient2/src/main/java/swap.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
package codeQuotient; | ||
|
||
import java.util.Arrays; | ||
import java.util.Scanner; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>LetUsJava</artifactId> | ||
<groupId>com.let.us.java</groupId> | ||
<version>1.0-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>EuclieanDistance</artifactId> | ||
|
||
|
||
</project> |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>LetUsJava</artifactId> | ||
<groupId>com.let.us.java</groupId> | ||
<version>1.0-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>GuessTheMovieGame</artifactId> | ||
|
||
|
||
</project> |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>LetUsJava</artifactId> | ||
<groupId>com.let.us.java</groupId> | ||
<version>1.0-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>GuessingNumberGame</artifactId> | ||
|
||
|
||
</project> |
154 changes: 77 additions & 77 deletions
154
...e in Java/Guessing_Game_Human_vs_CPU.java → ...main/java/Guessing_Game_Human_vs_CPU.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,77 @@ | ||
import java.util.*; | ||
import java.util.*; | ||
public class Guessing_Game_Human_vs_CPU | ||
{ | ||
public static int computerGuess(int lower,int upper,int randnum,int count) | ||
{ | ||
int guess=(lower+upper)/2; | ||
if(guess==randnum) | ||
return count; | ||
|
||
if(guess<randnum){ | ||
count++; | ||
return computerGuess(guess,upper,randnum,count); | ||
} | ||
|
||
if(guess>randnum){ | ||
count++; | ||
return computerGuess(lower,guess,randnum,count); | ||
} | ||
return -1; | ||
} | ||
|
||
public static void main(String[] args) | ||
{ | ||
final Scanner sc=new Scanner(System.in); | ||
char ch='Y'; | ||
//the game resets if select Y else exits | ||
while(ch=='Y') | ||
{ | ||
//Generating a random integer number Between 1 to 100 | ||
int randnum=(int)(Math.random()*100+1); | ||
//Math.random gives adouble between 0 and 1 so multiply by 100 so gives between 0 to 99 and 1 for 0 to 100 | ||
|
||
int chances=10; | ||
while(chances>0) //while attempts are less than 10 | ||
{ | ||
System.out.print("Guesss A Number between 1 to 100:"); | ||
int guess=sc.nextInt(); | ||
//input the guessed Number | ||
|
||
if(guess==randnum){ | ||
System.out.println("Congrats you guessed the number !!\n"); | ||
break; | ||
} | ||
else if(guess>randnum){ | ||
System.out.println("Your guess is higher than the number.\n"); | ||
} | ||
else{ | ||
System.out.println("Your guess is lower than the number.\n"); | ||
} | ||
|
||
chances--; | ||
} | ||
|
||
if(chances!=0){ | ||
System.out.println("\nYou guessed the Number in "+(10-chances)+" attempts."); | ||
System.out.println("You scored "+(chances*10)+" points."); | ||
} | ||
else{ | ||
System.out.println("\nYou were not able to guess the number in 10 attempts.\n Better Luck next Time"); | ||
System.out.println("You scored 0 points."); | ||
} | ||
int steps=computerGuess(0,100,randnum,0); | ||
System.out.println("\nComputer solved it in "+steps+" attempts."); | ||
|
||
if((10-chances)<steps) | ||
System.out.println("\nYou Beat the Computer"); | ||
else | ||
System.out.println("\nYou Lost to the Computer"); | ||
|
||
//check if want to continue the game or exit | ||
System.out.println("\nDo You want to TRY AGAIN:(Y-YES/N-NO)"); | ||
ch=sc.next().charAt(0); | ||
} | ||
System.out.println("\nThank you Playing!!"); | ||
} | ||
} | ||
import java.util.*; | ||
import java.util.*; | ||
public class Guessing_Game_Human_vs_CPU | ||
{ | ||
public static int computerGuess(int lower,int upper,int randnum,int count) | ||
{ | ||
int guess=(lower+upper)/2; | ||
if(guess==randnum) | ||
return count; | ||
|
||
if(guess<randnum){ | ||
count++; | ||
return computerGuess(guess,upper,randnum,count); | ||
} | ||
|
||
if(guess>randnum){ | ||
count++; | ||
return computerGuess(lower,guess,randnum,count); | ||
} | ||
return -1; | ||
} | ||
|
||
public static void main(String[] args) | ||
{ | ||
final Scanner sc=new Scanner(System.in); | ||
char ch='Y'; | ||
//the game resets if select Y else exits | ||
while(ch=='Y') | ||
{ | ||
//Generating a random integer number Between 1 to 100 | ||
int randnum=(int)(Math.random()*100+1); | ||
//Math.random gives adouble between 0 and 1 so multiply by 100 so gives between 0 to 99 and 1 for 0 to 100 | ||
|
||
int chances=10; | ||
while(chances>0) //while attempts are less than 10 | ||
{ | ||
System.out.print("Guesss A Number between 1 to 100:"); | ||
int guess=sc.nextInt(); | ||
//input the guessed Number | ||
|
||
if(guess==randnum){ | ||
System.out.println("Congrats you guessed the number !!\n"); | ||
break; | ||
} | ||
else if(guess>randnum){ | ||
System.out.println("Your guess is higher than the number.\n"); | ||
} | ||
else{ | ||
System.out.println("Your guess is lower than the number.\n"); | ||
} | ||
|
||
chances--; | ||
} | ||
|
||
if(chances!=0){ | ||
System.out.println("\nYou guessed the Number in "+(10-chances)+" attempts."); | ||
System.out.println("You scored "+(chances*10)+" points."); | ||
} | ||
else{ | ||
System.out.println("\nYou were not able to guess the number in 10 attempts.\n Better Luck next Time"); | ||
System.out.println("You scored 0 points."); | ||
} | ||
int steps=computerGuess(0,100,randnum,0); | ||
System.out.println("\nComputer solved it in "+steps+" attempts."); | ||
|
||
if((10-chances)<steps) | ||
System.out.println("\nYou Beat the Computer"); | ||
else | ||
System.out.println("\nYou Lost to the Computer"); | ||
|
||
//check if want to continue the game or exit | ||
System.out.println("\nDo You want to TRY AGAIN:(Y-YES/N-NO)"); | ||
ch=sc.next().charAt(0); | ||
} | ||
System.out.println("\nThank you Playing!!"); | ||
} | ||
} |
File renamed without changes.
12 changes: 6 additions & 6 deletions
12
...e in Java/Guessing_Game_Human_vs_CPU.ctxt → ...resources/Guessing_Game_Human_vs_CPU.ctxt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#BlueJ class context | ||
comment0.params=lower\ upper\ randnum\ count | ||
comment0.target=int\ computerGuess(int,\ int,\ int,\ int) | ||
comment1.params=args | ||
comment1.target=void\ main(java.lang.String[]) | ||
numComments=2 | ||
#BlueJ class context | ||
comment0.params=lower\ upper\ randnum\ count | ||
comment0.target=int\ computerGuess(int,\ int,\ int,\ int) | ||
comment1.params=args | ||
comment1.target=void\ main(java.lang.String[]) | ||
numComments=2 |
Oops, something went wrong.