Sommer2013 + Sommer2010
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
package sommer2010fs;
|
||||
|
||||
public class ArbeitsplatzPC {
|
||||
private String macAdresse;
|
||||
private char netz;
|
||||
|
||||
/* Aufgabe 2.1:
|
||||
* Diese Methode hat keinen Rückgabewert,
|
||||
* da es ein Konstruktor ist. Dieser wird
|
||||
* nur zum erstellen des Objekts genutzt.
|
||||
*/
|
||||
public ArbeitsplatzPC(String macAdresse, char netz) {
|
||||
this.macAdresse = macAdresse;
|
||||
this.netz = netz;
|
||||
}
|
||||
|
||||
public boolean setMacAdresse(String macAdresse) {
|
||||
if (macAdresse.length() == 10) {
|
||||
this.macAdresse = macAdresse;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setNetz(char netz) {
|
||||
netz = Character.toUpperCase(netz);
|
||||
if (netz == 'A' || netz == 'B') {
|
||||
this.netz = netz;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public String getMacAdresse() {
|
||||
return macAdresse;
|
||||
}
|
||||
|
||||
public char getNetz() {
|
||||
return netz;
|
||||
}
|
||||
|
||||
private boolean checknetz(char netz) {
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean checkMac(String mac) {
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean checkHex(char hex) {
|
||||
char allowedChars[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'A', 'b', 'B', 'c', 'C', 'd', 'D', 'e', 'E', 'f', 'F'};
|
||||
boolean valid = false;
|
||||
|
||||
for (int i = 0; i < allowedChars.length; i++) {
|
||||
if (allowedChars[i] == hex) {
|
||||
valid = true;
|
||||
}
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
package sommer2010fs;
|
||||
|
||||
public class Sommer2010FS {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user