Ask Question
20 April, 22:54

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

+1
Answers (1)
  1. 20 April, 23:15
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers