Respuesta :
Answer:
String [] artworks = {"David","Moses","Bacchus"};
Sculptor sculptor = new Sculptor("Michaelangelo",artworks,
"March 6, 1475","February 18, 1564");
Explanation:
- To solve this problem effectively;
- Create a class (Java is used in this case) with fields for name, artworks(an array of string), bornDate and diedDate.
- Create a constructor to initialize this fields
- In a seperate class SculptorTest, within the main method create an array of String artworks and initialize to {"David","Moses","Bacchus"};
- Create a new object of the class with the line of code given in the answer section.
- See code for 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");
}
}