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:
<em>public class Sculptor {</em>
<em> private String name;</em>
<em> private String [] artworks;</em>
<em> private String bornDate;</em>
<em> private String diedDate;</em>
<em> public Sculptor(String name, String[] artworks, String bornDate, String diedDate) {</em>
<em> this.name = name;</em>
<em> this.artworks = artworks;</em>
<em> this.bornDate = bornDate;</em>
<em> this.diedDate = diedDate;</em>
<em> }</em>
<em>}</em>
<em>//Test Class with a main method</em>
<em>class SculptorTest{</em>
<em> public static void main(String[] args) {</em>
<em> String [] artworks = {"David","Moses","Bacchus"};</em>
<em> Sculptor sculptor = new Sculptor("Michaelangelo",artworks,</em>
<em> "March 6, 1475","February 18, 1564");</em>
<em> }</em>
<em>}</em>