Write the Cake structure, which has instance variables name, weight and member function has_icing function that returns a bool. Use the Cake object initialised below to invoke the has_icing function.
The Cake structure has instance variables name, weight and member function has_icing. Write the has_icing function which returns true when the weight is greater than 10.
Create the Music structure, with member variables num_sold and year, and member functions sold and is_new. The sold function should print twice the num_sold while the is_new function should return true if the year is greater than 2012.
Create the Music structure, with member variables num_sold and year, and member function latest. The latest function operates on two Music objects, and returns true if the current objectβs year is greater than the otherβs.
Write the function printInfo, which prints the music albumβs information in the format βThis is a artist, year album with/without featured artists.β If artist has the value βn/aβ, printInfo prints out βUnknown artist! Your album is from year.β
The Music structure has instance variables name, weight and member function has_icing. Write the has_icing function which returns true when the weight is greater than 10.
Write the Pants structure, which has instance variables size and material. Also write a constructor for Pants that would be called when p1 is declred. The constructor sets the size to L and material to cotton.
Below is one way to implement the program. We declare the Pants struct and list the instance variables in order. In addition, we write a default constructor.
Implement 2 constructors for the struct Book, which has the instance variables name and publish_year. One should be a default constructor that sets name to N/A and publish_year to 0. The other constructor should take arguments
Implement the struct Instrument struct along with 2 constructors for the same (default and one that takes parameters). Instrument has the instance variables name, year_made and function is_popular(). The default constructor sets name to guitar and year_made to 2000.