Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Microsoft Visual C#: An Introduction to Object-Oriented Programming, 7th Edition 2017. Programming Exercise #2 page 476. Please keep it simplified and easy to understand. Create

Microsoft Visual C#: An Introduction to Object-Oriented Programming, 7th Edition 2017. Programming Exercise #2 page 476.

Please keep it simplified and easy to understand.

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 and height in inches and properties for each field. 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 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). 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.

The solution NEEDS to include the following:

Photo packageA = new Photo(); packageA.Width = 8; packageA.Height = 10;

MattedPhoto packageB = new MattedPhoto(); packageB.Width = 10; packageB.Height = 12; packageB.Color = "purple";

FramedPhoto packageC = new FramedPhoto(); packageC.Width = 11; packageC.Height = 14; packageC.Material = "silver"; packageC.Style = "modern";

FramedPhoto packageD = new FramedPhoto(); packageD.Width = 8; packageD.Height = 10; packageD.Material = "wood"; packageD.Style = "traditional";

Hint ... Parent Photo price logic (one way to meet the criteria given in the exercise) price = 9.99; if (Width == 8) price = 3.99; if (Width == 10) price = 5.99;

The result should match the screenshot exactly:

image text in transcribed

CAWINDOWS\system32cmd.exe Photo 8X10 wil1 cost $3.99 MattedPhoto 10x12 will cost $15.99 this includes purple photo matte FramedPhoto 11X14 will cost $34.99 this includes silver modern framed photo FramedPhoto 8x10 will cost $28.99 this includes wood traditional framed photo Press any key to continue

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

Murach's SQL Server 2012 For Developers

Authors: Bryan Syverson, Joel Murach, Mike Murach

1st Edition

1890774693, 9781890774691

More Books

Students also viewed these Databases questions

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago