Microsoft Visual C#
Microsoft Visual C#
7th Edition
ISBN: 9781337102100
Author: Joyce, Farrell.
Publisher: Cengage Learning,
bartleby

Concept explainers

Question
100%
Book Icon
Chapter 10, Problem 2E
Program Plan Intro

Program Plan:

  • Create a class Photo and include data member width and height of type double in it.
  • Include property for each data member.
  • Add protected field named price and set property for its get accessor.
  • Create constructor of class to take two arguments for width and height and set the value of price field as per mentioned rules of height and width.
  • Derive class MattedPhoto, add additional field color in it and override the base constructor to change the value of price field.
  • Derive class FramedPhoto, add additional fields material and style and override the base constructor to change the value of price field.
  • Create a program class having main method. Inside the main method create objects of each of above class and use ToString method to display the attributes of these classes.

Program Description:

The main purpose of the program is to create a class Photo, derive two other classes MattedPhoto and FramedPhoto from it and demonstrate method of these classes.

Blurred answer
Students have asked these similar questions
Create an application 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 centimeters 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 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 frame’s material (such as silver) and style (such as modern). The price for a MattedPhotoincreases by $10 over its base cost, and the price for a FramedPhoto increases by $25 over its base cost. Each subclass should…
Create a class named Book that contains data fields for the title and number of pages.  Include get and set methods for these fields. Next, create a subclass named Textbook, which contains an additional field that holds a grade level for the Textbook and additionalmethods to get and set the grade level field. Write an application that demonstrates using objects of each class
create a class named square that contains data fields for height, width, and surfaceArea, an method named computeSurfaceArea(). create a child class named Cube. Cube contains an additional data field named depth, and a computeSurfaceArea() method that overrides the parent method. Write an application that instantiates a Square object and a cube object and displays the surface areas of the objects.
Knowledge Booster
Background pattern image
Computer Science
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
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage