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 Person that holds the following fields: two String objects for the person’s first and last name and a LocalDate object for the person’s birthdate. Create a class named Couple that contains two Person objects. Create a class named Wedding for a wedding planner that includes the date of the wedding, the Couple being married, and a String for the location. Provide constructors for each class that accept parameters for each field, and provide get methods for each field.
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