Ask Question
5 September, 00:59

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".

+5
Answers (1)
  1. 5 September, 02:32
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers