|
|
@@ -0,0 +1,42 @@ |
|
|
|
public class Visitenkarte { |
|
|
|
|
|
|
|
private String name; |
|
|
|
private String university; |
|
|
|
private String street; |
|
|
|
private int number; |
|
|
|
private int postCode; |
|
|
|
private String city; |
|
|
|
|
|
|
|
|
|
|
|
public Visitenkarte (String name, String university, String street, int number, int postCode, String city) { |
|
|
|
this.name = name; |
|
|
|
this.university = university; |
|
|
|
this.street = street; |
|
|
|
this.number = number; |
|
|
|
this.postCode = postCode; |
|
|
|
this.city = city; |
|
|
|
} |
|
|
|
|
|
|
|
public String toString() { |
|
|
|
String e = String.format("|%-30s|", " ").replace(' ', '-'); |
|
|
|
String n = String.format("|%-30s|", name); |
|
|
|
String u = String.format("|%-30s|", university); |
|
|
|
String filler = String.format("|%-30s|", " "); |
|
|
|
String s = String.format("|%-30s|", street); |
|
|
|
String address = street + " " + number; |
|
|
|
String a = String.format("|%-30s|", address); |
|
|
|
String postAndCity = postCode + " " + city; |
|
|
|
String p = String.format("|%-30s|", postAndCity); |
|
|
|
return e + "\n" + n + "\n" + u + "\n" + filler + "\n" + a + "\n" + p + "\n" + e; |
|
|
|
} |
|
|
|
public static void main(String[] args) { |
|
|
|
String n = "Prof. Dr. Georg-Simon Ohm"; |
|
|
|
String u = "TH Nürnberg"; |
|
|
|
String s = "Keßlerplatz"; |
|
|
|
int nu = 12; |
|
|
|
int p = 90489; |
|
|
|
String c = "Nuremberg"; |
|
|
|
Visitenkarte One = new Visitenkarte(n, u, s, nu, p, c); |
|
|
|
System.out.println(One); |
|
|
|
} |
|
|
|
} |