Question: Help fix my homework please. First two pics are the questions, next two is my code and the last is the error messages. 3.24 LAB:
Help fix my homework please. First two pics are the questions, next two is my code and the last is the error messages.





3.24 LAB: Artwork label (classes/constructors) Given main, define the Artist class in file Artist.java) with constructors to initialize an artist's information, get methods, and a printinfo method. The default constructor should initialize the artist's name to "None" and the years of birth and death to 0. printinfo() should display Artist Name, born XXXX if the year of death is -1 or Artist Name (XXXX-YYYY) otherwise, Define the Artwork class (in file Artwork.java) with constructors to initialize an artwork's information, get methods, and a printinfo method. The constructor should by default initialize the title to "None", the year created to 0. Declare a private field of type Artist in the Artwork class. Ex. If the input is: Pablo Picasso 1881 1973 Three Musicians 1921 the output is: Artist: Pablo Picasso (1881-1973) Title: Three Musicians, 1921 If the input is: Brice Marden 1938 -1 Distant Muscs 2000 the output is: Artist: Brice Marden, born 1938 Tille: Distant Muses, 2000 If the input is: Brice Marden 1938 Distant Muses 2000 the output is: Artist: Brice Marden, born 1938 Title: Distant Muses, 2000 LAB ACTIVITY TV 3.24.1: LAB: Artwork label (classes/constructors) 0/100 File is marked as read only Current file: ArtworkLabel.java import java.util.Scanner; public class ArtworkLabel { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); String userTitle, userArtistName; int yearCreated, userBirthYear, userDeathYear; userArtistName = scnr.nextLine(); userBirthYear - scnr.nextInt(); scnr.nextLine(); userDeathYear = scnr.nextInt(); scnr.nextLine(); userTitle - scnr.nextLine(); yearCreated = scnr.nextInt(); Artist userArtist = new Artist(userArtistName, userBirthYear, userDeathYear); Artwork newArtwork = new Artwork(userTitle, yearCreated, userArtist); newArtwork.printInfo(); LAB ACTIVITY 3.24.1: LAB: Artwork label (classes/constructors) 0/10 0/100 Current file: Artwork.java Load default template... Mti N000 1 public class Artwork { // TODO: Declare private fields - title, yearCreated private String title; private int yearCreated; // TODO: Declare private field artist of type Artist private String artist = Artist; // TODO: Define default constructor Artwork() { title = "none"; yearCreated = 0; artist = new Artist(); // TODO: Define get methods: getTitle(), getYearCreated // TODO: Define second constructor to initialize private fields (title, yearCreated, artist) Artwork (String userTitle, int userYearCreated, Artist userNewArtist); { title = userTitle; yearCreated = userYearCreated; artist = userNewArtist; public String getTitle() { return title; public int getYearCreated() { return yearCreated; public String getArtist() { return artist; wwwww UNP // TODO: Define printInfo() method public void printInfo() { artist.printInfo(); System.out.println("Title: " + title + "," + yearCreated); 40 LAB ACTIVITY 3.24.1: LAB: Artwork label (classes/constructors) 0/10 ] Current file: Artist.java Load default template... + NOON public class Artist { // TODO: Declare private fields - artistName, birthYear, deathYear private string userArtistName; private int userBirthYear; private int userDeath Year; // TODO: Define default constructor public Artist() { userArtistName = "None"; userBirthYear = @; user DeathYear = @; // TODO: Define second constructor to initialize // private fields (artistName, birthYear, deathYear) private Artist(String userArtistName, int userBirthYear, int userDeathYear) { super(); this.userArtistName = userArtistName; this.userBirthYear = userBirthYear; this.userDeathYear = userDeathYear; 17 19 } // TODO: Define get methods: getName(), getBirthYear(), getDeathYear public String getName() { return userArtistName; public int getBirthYear({ return userBirthYear; public int getDeathYear({ return userDeathYear; // TODO: Define printInfo() method If deathYear is entered as -1, only print birthYear public void printInfo() { if(userDeathYear == -1){ System.out.print(userBirthYear); } else { System.out.println(userArtistName); System.out.println(userBirthYear); System.out.println(userDeathYear); Program errors displayed here ArtworkLabel.java:18: error: Artist(String, int,int) has private access in Artist Artist userArtist = new Artist (userArtistName, userBirthYear, user DeathYear); Artwork.java:6: error: cannot find symbol private String artist = Artist; symbol: variable Artist location: class Artwork Artwork.java:11: error: incompatible types: Artist cannot be converted to String artist = new Artist(); Artwork.java:18: error: missing method body, or declare abstract Artwork (String userTitle, int userYearCreated, Artist userNewArtist);{ ArLwork.java:19: error: cannot find symbol title = userTitle; Symbol: variable userTitle location: class Artwork Artwork.java:20: error: cannot find symbol yearCreated - userYearCreated; symbol: variable userYearCreated location: class Artwork Artwork.java:21: error: cannot find symbol artist = userNewArtist; symbol: variable userNewArtist location: class Artwork Artwork.java:38: error: cannot find symbol artist.printInfo(); symbol: melhod prinLInfo() location: variable artist of type String 8 errors
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
