Given main(), define the Artist class (in file Artist.java) with constructors to initialize an artist's information,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 "unknown" and the years of birth and death to -1. printInfo() displays "Artist:", then a space, then the artist's name, then another space, then the birth and death dates in one of three formats: • (XXXX to YYYY) if both the birth and death years are nonnegative • (XXXX to present) if the birth year is nonnegative and the death year is negative . (unknown) otherwise Define the Artwork class (in file Artwork.java) with constructors to initialize an artwork's information, get methods, and a printInfo() method. The default constructor should initialize the title to "unknown", the year created to -1. printinfo() displays an artist's information by calling the printinfo() method in Artist.java, followed by the artwork's title and the year created. 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 to 1973) Title: Three Musicians, 1921 Ex: If the input is: Brice Marden 1938 -1 Distant Muses 2000 the output is: Artist: Brice Marden (1938 to present): Title: Distant Muses, 2000 Ex: If the input is: Banksy -1 -1 Balloon Girl 2002 the output is: Artist: Banksy (unknown) Title: Balloon Girl, 2002 484924 3417574.qx3zqy7 LAB ACTIVITY 9.27.1: LAB: Artwork label (classes/constructors) 0/10 public class Artist { // TODO: Declare private fields - artistName, birth Year, deathYear // TODO: Define default constructor // TODO: Define second constructor to initialize // private fields (artistName, birthYear, deathYear) // TODO: Define get methods: getName0, getBirthYear(), getDeathYear() // TODO: Define printinfo() method // If death Year is entered as -1, only print birthYear } public class Artwork { // TODO: Declare private fields - title, yearCreated // TODO: Declare private field artist of type Artist // TODO: Define default constructor // TODO: Define get methods: getTitle(), getYear Created() // TODO: Define second constructor to initialize // private fields (title, yearCreated, artist) // TODO: Define printInfo() method // Call the printinfo() method in Artist.java to print an artist's information } import java.util.Scanner; public class ArtworkLabel { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); String userTitle, user ArtistName; } 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, userDeath Year); Artwork newArtwork = new Artwork(userTitle, yearCreated, userArtist); newArtwork.printInfo(); 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 "unknown" and the years of birth and death to -1. printInfo() displays "Artist:", then a space, then the artist's name, then another space, then the birth and death dates in one of three formats: • (XXXX to YYYY) if both the birth and death years are nonnegative • (XXXX to present) if the birth year is nonnegative and the death year is negative . (unknown) otherwise Define the Artwork class (in file Artwork.java) with constructors to initialize an artwork's information, get methods, and a printInfo() method. The default constructor should initialize the title to "unknown", the year created to -1. printinfo() displays an artist's information by calling the printinfo() method in Artist.java, followed by the artwork's title and the year created. 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 to 1973) Title: Three Musicians, 1921 Ex: If the input is: Brice Marden 1938 -1 Distant Muses 2000 the output is: Artist: Brice Marden (1938 to present): Title: Distant Muses, 2000 Ex: If the input is: Banksy -1 -1 Balloon Girl 2002 the output is: Artist: Banksy (unknown) Title: Balloon Girl, 2002 484924 3417574.qx3zqy7 LAB ACTIVITY 9.27.1: LAB: Artwork label (classes/constructors) 0/10 public class Artist { // TODO: Declare private fields - artistName, birth Year, deathYear // TODO: Define default constructor // TODO: Define second constructor to initialize // private fields (artistName, birthYear, deathYear) // TODO: Define get methods: getName0, getBirthYear(), getDeathYear() // TODO: Define printinfo() method // If death Year is entered as -1, only print birthYear } public class Artwork { // TODO: Declare private fields - title, yearCreated // TODO: Declare private field artist of type Artist // TODO: Define default constructor // TODO: Define get methods: getTitle(), getYear Created() // TODO: Define second constructor to initialize // private fields (title, yearCreated, artist) // TODO: Define printInfo() method // Call the printinfo() method in Artist.java to print an artist's information } import java.util.Scanner; public class ArtworkLabel { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); String userTitle, user ArtistName; } 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, userDeath Year); Artwork newArtwork = new Artwork(userTitle, yearCreated, userArtist); newArtwork.printInfo();
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
The Cool Redistributing Company 1. With summer approaching, people are thinking about getting their lawns in shape. The Cool Redistributing Company (CRC) would like to maintain an 80% service level...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of an array of objects as a class data...
-
The comparative balance sheets for 2018 and 2017 and the income statement for 2018 are given below for Arduous Company. Additional information from Arduous's accounting records is provided also....
-
In a continuous printing process paper is drawn into the presses at a constant speed v Denoting by r the radius of the paper roll at any given time and by b the thickness of the paper, derive an...
-
Assume a learning curve following the power law. If you double the initial cost c(1) of a product, the costs of producing an order of 20 units: a. Stay the same. b. Are reduced by 50 percent. c. Are...
-
Names over Time The website http://www.visualcinnamon.com/babynamesus gives a spaghetti plot showing the popularity of the top 10 baby names for each year 1880 to 2014 (use the window scroller at the...
-
A solid conducting sphere with radius R carries a positive total charge Q. The sphere is surrounded by an insulating shell with inner radius R and outer radius 2R. The insulating shell has a uniform...
-
Think about TWO clients with different needs and describe their situation. For each one, select a range of current resources available for providing information, advice or guidance within a specific...
-
Use discriminant analysis to classify the new data in the Excel file Credit Approval Decisions Coded using only credit score and years of credit history as input variables.
-
Provide a comparison of the steps and features of the Nudge Theory and ADKAR change management model Describe the benefits of each model. Provide some pros and cons of each Provide references
-
Extend the billing process model in Exercise 4.5 (page 125) as follows. Any time after the first transaction has failed, the customer may pay the invoice directly to the ISP. If so, the billing...
-
The allocated fixed cost per unit is the same for both Standard and Custom products ($40 per unit). This implies that the fixed costs are being allocated based on the assumption that each product...
-
VallasInc. has the following inventory activities: Vallas sold $6,400 of inventory to a customer, FOB Shipping Point. This inventory is currently in transit Vallas owns $10,000 of inventory as a...
-
Mandy, a CFP professional, used credit bureau information to complete a review for her client Annie. The Credit bureau is a private organization that keeps track of individuals credit history a...
-
The term "total compensation" refers to Group of answer choices the value of an employee's base salary plus the value of employer contributions to health insurance. the value of an employee's base...
-
If the bob's mass is doubled, approximately what will the pendulum's new period be? View Available Hint(s) T/2 T 2T 2T Submit Part B If the pendulum is brought on the moon where the gravitational...
-
In what ways does a well-designed enterprise search software vary from popular search engines (e.g., Bing, DuckDuckGo, and Google)?
-
a. Create a class named BaseballGame that contains data fields for two team names. Include a two-dimensional array that can hold the scores for each of two teams in each inning of the game. The...
-
Unlike a Window, a JFrame _________________. a. Has a title bar and border b. Can be made visible c. Can have descendants d. Can hold other objects
-
A generic method _________________. a. Must have a type parameter that represents a reference type b. Must return a generic parameter c. Must have an empty body that is created at runtime d. Can have...
-
Apple stock is selling for \($120\) per share. Call options with a \($117\) exercise price are priced at \($12.\) What is the intrinsic value of the option, and what is the time value?
-
Refer to Problem 14.9. What would the loss of the seller of the put option be if, at expiration, XLB is trading at \($20?\) What would the profit of the seller be if, at expiration, XLB is trading at...
-
Ibrahim bought 200 shares of a stock trading in the Abu Dhabi Securities Exchange at AED 12 (United Arab Emirates dirham) per share. Over time, the price of the stock increased to AED 18 per share....
Study smarter with the SolutionInn App