Answer:
String [] artworks = {"David","Moses","Bacchus"};
Sculptor sculptor = new Sculptor("Michaelangelo",artworks,
"March 6, 1475","February 18, 1564");
Explanation:
- In order to successfully tackle this task;
- You should create a class (Java is the chosen language) featuring fields for the name, an array of artworks (strings), the date of birth and the date of death.
- Utilize a constructor to initialize these fields
- In a separate class SculptorTest, within the main method, generate a String array artworks assigned to {"David","Moses","Bacchus"};
- Then create a new object of the class using the code provided in the answer section.
- Refer to the provided code for the complete class definition below:
public class Sculptor {
private String name;
private String [] artworks;
private String bornDate;
private String diedDate;
public Sculptor(String name, String[] artworks, String bornDate, String diedDate) {
this.name = name;
this.artworks = artworks;
this.bornDate = bornDate;
this.diedDate = diedDate;
}
}
//Test Class with a main method
class SculptorTest{
public static void main(String[] args) {
String [] artworks = {"David","Moses","Bacchus"};
Sculptor sculptor = new Sculptor("Michaelangelo",artworks,
"March 6, 1475","February 18, 1564");
}
}