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 an application named ShapesDemo that creates several objects that descend from an abstract class called GeometricFigure. Each GeometricFigure includes a height, a width, and an area. Provide get and set accessors for each field except area; the area is computed and is read-only. Include an abstract method called ComputeArea() that computes the area of the GeometricFigure. Next you will create three additional classes derived from the GeometricFigure class. Name these derived classes: Rectange, Square, and Triangle Create a Rectangle is a GeometricFigure whose area is determined by multiplying width by height. Create a Square is a Rectangle in which the width and height are the same. Provide a constructor that accepts both height and width, forcing them to be equal if they are not. Provide a second constructor that accepts just one dimension and uses it for both height and width. The Square class uses the Rectangle’s ComputeArea() method. Create a Triangle is a GeometricFigure…
Create an application named ShapesDemo that creates several objects that descend from an abstract class called GeometricFigure. Each GeometricFigure includes a height, a width, and an area. Provide get and set accessors for each field except area; the area is computed and is read-only. Include an abstract method called ComputeArea() that computes the area of the GeometricFigure. Next you will create three additional classes derived from the GeometricFigure class. Name these derived classes: Rectange, Square, and Triangle.
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
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