Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a class named Painting that contains fields for a paintings title, artist, medium (such as water color), price, and gallery commission. Create a constructor

Create a class named Painting that contains fields for a paintings title, artist, medium (such as water color), price, and gallery commission. Create a constructor that initializes each field to an appropriate default value, and create instance methods that get and set the fields for title, artist, medium, and price. The gallery commission field cannot be set from outside the class; it is computed as 20 percent of the price each time the price is set. Save the class as Painting.java. Create a class named TestPainting whose main() method declares three Painting items. Create a method that prompts the user for and accepts values for two of the Painting objects, and leave the third with the default values supplied by the constructor. Then display each completed object. Finally, display a message that explains the gallery commission rate. Save the application as TestPainting.java

image text in transcribed

The program output should look like the example below. . Command Prompt F:\JavaBatchFile>javac Painting.java F:\JavaBatchFile>javac TestPainting.java F:\JavaBatchFile>java TestPainting The oil painting named Starry Night by Van Gogh sells for $2000000.0 and the gallery makes $490000.0 commission The crayon painting named My Dog by Billy Thompson sells for $5.0 and the gallery makes $1.0 commission The null painting named null by null sells for $e. and the gallery makes $0.8 commission The gallery commission rate is 28.8 percent F:\JavaBatchFile>

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 Design Implementation And Management

Authors: Carlos Coronel, Steven Morris

14th Edition

978-0357673034

More Books

Students also viewed these Databases questions