Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please use C# and is being submitted to mindtap Create an application class named PhotoDemo that demonstrates the methods of three related classes for a

Please use C# and is being submitted to mindtap

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 objects 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 frames 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")));

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

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

1st Edition

1597496251, 978-1597496254

More Books

Students also viewed these Databases questions

Question

2. Identify issues/causes for the apparent conflict.

Answered: 1 week ago