prints everything to console

This commit is contained in:
Matti 2024-05-01 21:13:04 +02:00
parent c933d61613
commit f34040825c
2 changed files with 30 additions and 1 deletions

View File

@ -1,4 +1,14 @@
package part2.aufg1;
public class Anwendung {
public static void main(String[] args){
int startingNR = 745002;
int amountOfSets = 5;
for (int i=0; i<amountOfSets; i++){
CustomerData data = new CustomerData(startingNR+i);
data.print();
System.out.println();
}
}
}

View File

@ -3,6 +3,7 @@ package part2.aufg1;
import java.io.FileReader;
import java.io.LineNumberReader;
import java.util.Arrays;
import java.util.NoSuchElementException;
public class CustomerData {
private int customNR; //count =6 digit
@ -15,6 +16,24 @@ public class CustomerData {
private double amount; //random 500-2000
private String fileEntryCSV;
CustomerData(int customNR){
this.customNR = customNR;
this.firstName = getRandomFirstName();
this.lastName = getRandomLastName();
this.street = getRandomStreet();
this.houseNR = getRandomNumberBetween(1, 150);
this.city = getRandomCityNCode();
this.amount = getRandomNumberBetween(500, 2000);
}
public void print(){
System.out.println(this.customNR);
System.out.println(this.firstName + " " + this.lastName);
System.out.println(this.street + " " + this.houseNR);
System.out.println(this.city);
System.out.println(this.amount);
}
StringField allFirstNames = new StringField();
StringField allLastNames = new StringField();
StringField allStreets = new StringField();
@ -155,7 +174,7 @@ public class CustomerData {
return result;
}
public static void main(String[] args){
CustomerData data = new CustomerData();
CustomerData data = new CustomerData(123456);
System.out.println(data.getRandomFirstName() + " " + data.getRandomLastName());
System.out.println(data.getRandomStreet() + " " + data.getRandomNumberBetween(1, 150));