Create an application class named PhotoDemo that demonstrates the methods of three related classes for a company that develops photographs. Create a class named Photo that includes fields for width andheight in inches and properties for each field. The class should contain get and set accessors named Width and Height respectively. Include a protected price field, and set it to $3.99 for an 8-inch by 10-inch photo, $5.99 for a 10-inch by 12-inch photo, and $9.99 for any other size (because custom cutting is required). The price field requires a get accessor but no set accessor. Also include a ToString() method that returns a string constructed from the return value of the object’s GetType() method and the values of the fields. Derive two subclasses— MattedPhoto and FramedPhoto. The MattedPhoto class includes a string field named Color to hold a color, and the FramedPhoto class includes two string fields that hold the frame’s material (such as silver) and style (such as modern), named Material and Style respectively. The price for a MattedPhoto increases by $10 over its base cost, and the price for a FramedPhoto increases by $25 over its base cost. Each subclass should include a ToString()method that overrides the parent class version. An example of the program is shown below: Photo 8 X 10 Price: $3.99 Photo 8 X 9 Price: $9.99 MattedPhoto white matting 10 X 12 Price: $15.99 FramedPhoto modern, silver frame. 8 X 10 Price: $28.99 In order to prepend the $ to currency values, the program will need to use the CultureInfo.GetCultureInfo method. In order to do this, include the statement using System.Globalization; at the top of your program and format the output statements as follows: WriteLine("This is an example: {0}", value.ToString("C", CultureInfo.GetCultureInfo("en-US")));

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 2E
icon
Related questions
Question
100%

Create an application class named PhotoDemo that demonstrates the methods of three related classes for a company that develops photographs.

Create a class named Photo that includes fields for width andheight in inches and properties for each field. The class should contain get and set accessors named Width and Height respectively.

Include a protected price field, and set it to $3.99 for an 8-inch by 10-inch photo, $5.99 for a 10-inch by 12-inch photo, and $9.99 for any other size (because custom cutting is required). The price field requires a get accessor but no set accessor.

Also include a ToString() method that returns a string constructed from the return value of the object’s GetType() method and the values of the fields.

Derive two subclasses— MattedPhoto and FramedPhoto.

The MattedPhoto class includes a string field named Color to hold a color, and the FramedPhoto class includes two string fields that hold the frame’s material (such as silver) and style (such as modern), named Material and Style respectively.

The price for a MattedPhoto increases by $10 over its base cost, and the price for a FramedPhoto increases by $25 over its base cost. Each subclass should include a ToString()method that overrides the parent class version.

An example of the program is shown below:

Photo 8 X 10 Price: $3.99 Photo 8 X 9 Price: $9.99 MattedPhoto white matting 10 X 12 Price: $15.99 FramedPhoto modern, silver frame. 8 X 10 Price: $28.99

In order to prepend the $ to currency values, the program will need to use the CultureInfo.GetCultureInfo method. In order to do this, include the statement using System.Globalization; at the top of your program and format the output statements as follows: WriteLine("This is an example: {0}", value.ToString("C", CultureInfo.GetCultureInfo("en-US")));

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
JQuery and Javascript
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage