Question: Address constructor: public Address(String street, int housenumber, String houseExtra, String zipcode, String muncipality, String country) Customer constructor: public Customer(CreditRating creditRating, List orders, Date dateOfBirth, Date

 Address constructor: public Address(String street, int housenumber, String houseExtra, String zipcode,

Address constructor:

public Address(String street, int housenumber, String houseExtra, String zipcode, String muncipality, String country)

Customer constructor:

public Customer(CreditRating creditRating, List orders, Date dateOfBirth, Date dateOfDeath, Address address)

Please Java Code only. Create the method create() and show how to call it on main.

The method create(String className) accepts a full classname, and creates a new object for that class, using reflection classes to do so. You should not assume knowing what classnames will be passed, so hard coding a classname is not allowed. The created object is returned. In order to create an object, this method will use the constructor using the largest number of parameters, and adds random data to that. Example one is creating a new Address object. Address uses ints and Strings in its constructors, so the create method invokes the constructor having six parameters, using random data. Example two is creating a Customer object. A Customer also has an Address, so the create method calls itself again to get an Address object. Creating objects this way will inevitably have exceptions, such as SecurityException and IllegalArgumentException. Catch those and handle them decently

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!