Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ Art.h Art.cpp Painting.h Painting.cpp Sculpture Sculpture.cpp main.cpp Art cAbstract # id: String # title : String # artist : String # genre : String

image text in transcribed

image text in transcribed

c++

Art.h Art.cpp Painting.h Painting.cpp Sculpture Sculpture.cpp main.cpp Art cAbstract # id: String # title : String # artist : String # genre : String year : Integer price : double Artid: String, title: String artist: String. genre: String year: Integer, price: double) +Art): + showArt)0: void: pure virtual Painting Sculpture material : String paintMedium: String +Paintinglid: String, title : String, artist: String. +Sculpturelid: String, title: String, artist: String genre: String, year: Integer price : double, paintMedium: String) genre: String, year Integer price: double, material: String) +Painting): + showArt() void: +Sculpture() + showArt() void /I OUTPUT (Painting: showArt() Il OUTPUT (Sculpture: showArt) ID: 12345 Title: The Kiss Artist: Gustav Klimt Paint Medium: Oil Genre: Symbolism Year: 1908 Price: $1400 ID: 54321 Title: The Thinker Artist: Rodin Material: Bronze Genre: Impressionism Year: 1880 Price: $2000 Write a program that implements the classes described in the UML diagram. 1.) 2.) In main0. declare these two objects: Painting a1r12345, The Kiss'. *Gustav Klimt, Symbolist, 1908, 2 Sculpture a2r54321. The Thinker. Rodin. "Impressionism, 1880, 2000, 'Bronze"): 500, oiry 3.) In main0, have each object (a1 and a2) call their respective showArt0 functions. 4.) In main0. declare a function named: displayArt - Here is the function prototype: void displayArt (Art . Note: A base class object (Art) is passed to the function. However, because Painting and art): Sculpture objects are also Art objects, objects of either class can be passed to the function . Here is the function in main.cpp void displayArt (Art& art) art.showArt Remember a problem exists when a base class object is the parameter in a function. To prevent the compiler from staticly binding to the base class function, delcare the showArt0 function in the base class as pure virtual. By doing so, the compiler will bind to the correct showArt0 function at runtime (dynamic binding). ID: 12345 Title: The Kiss Artist: Gustav Klimt Paint Medium: 0il Genre: Symbolist Year: 1908 Price: $2500 ID: 54321 Title: The Thinker Artist: Rodin Material: Bronze Genre: Impressionism Year: 1880 Price: $2000

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems An Application Oriented Approach Complete Version

Authors: Michael Kifer, Arthur Bernstein, Richard Lewis

2nd Edition

0321268458, 978-0321268457

More Books

Students also viewed these Databases questions

Question

e. What difficulties did they encounter?

Answered: 1 week ago