Ask Question
3 April, 21:01

Define a new object in variable sculptor that has properties "name" storing "Michelangelo"; "artworks" storing "David", "Moses" and "Bacchus"; "bornDate" storing "March 6, 1475"; and "diedDate" storing "February 18, 1564".

+2
Answers (1)
  1. 3 April, 23:58
    0
    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");

    }

    }
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Define a new object in variable sculptor that has properties "name" storing "Michelangelo"; "artworks" storing "David", "Moses" and ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers