Skip to content
Open

Ch 1 #66

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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 10 additions & 0 deletions ch-7-object-oriented-design/louis/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="bin"/>
</classpath>
1 change: 1 addition & 0 deletions ch-7-object-oriented-design/louis/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bin/
17 changes: 17 additions & 0 deletions ch-7-object-oriented-design/louis/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>7.1</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
21 changes: 21 additions & 0 deletions ch-7-object-oriented-design/louis/src/card/BlackJack.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package card;

public class BlackJack extends Card {

public BlackJack(int n, Suit suit) {
super(n, suit);
// TODO Auto-generated constructor stub
}

public int value() {
int v = super.getCardNumber();
if (v==1) {
return 11;
}
else if(v<10) {
return v;
}
return 10;
}

}
29 changes: 29 additions & 0 deletions ch-7-object-oriented-design/louis/src/card/Card.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package card;
public class Card {
public enum Suit{

Diamonds(0),
Hearth(1),
Spades(2),
Clubs(4);

int v ;

private Suit(int value) {
this.v =value;
}

}
int cardNumber;
public int getCardNumber() {
return cardNumber;
}
public Suit getS() {
return s;
}
private Suit s;
public Card(int n,Suit suit) {
this.cardNumber = n;
this.s = suit;
}
}
2 changes: 2 additions & 0 deletions ch-7-object-oriented-design/louis/src/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module deckOfCards {
}
10 changes: 10 additions & 0 deletions ch-7-object-oriented-design/louis_7.1/louis/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="bin"/>
</classpath>
1 change: 1 addition & 0 deletions ch-7-object-oriented-design/louis_7.1/louis/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bin/
17 changes: 17 additions & 0 deletions ch-7-object-oriented-design/louis_7.1/louis/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>7.1</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package card;

public class BlackJack extends Card {

public BlackJack(int n, Suit suit) {
super(n, suit);
// TODO Auto-generated constructor stub
}

public int value() {
int v = super.getCardNumber();
if (v==1) {
return 11;
}
else if(v<10) {
return v;
}
return 10;
}

}
29 changes: 29 additions & 0 deletions ch-7-object-oriented-design/louis_7.1/louis/src/card/Card.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package card;
public class Card {
public enum Suit{

Diamonds(0),
Hearth(1),
Spades(2),
Clubs(4);

int v ;

private Suit(int value) {
this.v =value;
}

}
int cardNumber;
public int getCardNumber() {
return cardNumber;
}
public Suit getS() {
return s;
}
private Suit s;
public Card(int n,Suit suit) {
this.cardNumber = n;
this.s = suit;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module deckOfCards {
}
3 changes: 3 additions & 0 deletions ch1-arraysAndStrings/Louis/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions ch1-arraysAndStrings/Louis/.idea/Louis.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions ch1-arraysAndStrings/Louis/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions ch1-arraysAndStrings/Louis/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions ch1-arraysAndStrings/Louis/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 46 additions & 0 deletions ch1-arraysAndStrings/Louis/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#exercise session 1
def isUnique(s):

check = []

for i in s:
if i in check:
return False
else:
check.append(i)
return True


def permutation(a,b):
sortedA = sorted(a)
sortedB = sorted(b)


if sortedA == sortedB:
return True
else:
return False

def palindrome_permutation(s):

s = s.replace(" ","")
s = s.lower()

check = []

for i in s:
if i in check:
check.remove(i)
else:
check.append(i)

print(len(check))

if len(check) == 1:
return True
else:
return False


if __name__ == "__main__":
pass
Loading