Skip to content
Merged
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
14 changes: 13 additions & 1 deletion src/main/java/collections/ostap/motor/Auto.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,21 @@ public class Auto {
String model;
Motor motor;

public Auto(String brand, String model, Motor motor) {
this.brand = brand;
this.model = model;
this.motor = motor;
}

public void startCar(Motor motor){
public void startCar(){
motor.ignite();
}

public static void main(String[] args) {
Motor m1 = new DieselMotor();
Auto a1 = new Auto("VW", "passat", m1);
a1.startCar();
}
}


22 changes: 11 additions & 11 deletions src/main/java/hausaufgabe/lektion20/skat/sms/Sms.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@ class IllegalTelephoneNumberException extends Exception {
}

class TelephoneMap {
static final Map<String, Integer> telephone = new HashMap<>();
static final Map<String, Character> telephone = new HashMap<>();
static{
telephone.put("ABC", 2);
telephone.put("DEF", 3);
telephone.put("GHI", 4);
telephone.put("JKL", 5);
telephone.put("MNO", 6);
telephone.put("PQRS", 7);
telephone.put("TUV", 8);
telephone.put("WXYZ", 9);
telephone.put("ABC", '2');
telephone.put("DEF", '3');
telephone.put("GHI", '4');
telephone.put("JKL", '5');
telephone.put("MNO", '6');
telephone.put("PQRS", '7');
telephone.put("TUV", '8');
telephone.put("WXYZ", '9');
}
public static int convert(int i) throws IllegalTelephoneNumberException {
char ch = (char) i;
for(Map.Entry<String, Integer> entry : telephone.entrySet()) {
if(entry.getKey().contains(Character.toString(ch))) return entry.getValue() + 48;
for(Map.Entry<String, Character> entry : telephone.entrySet()) {
if(entry.getKey().contains(Character.toString(ch))) return entry.getValue();
}
throw new IllegalTelephoneNumberException();
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/Zeichenkontakte.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ABCYU
CVD