Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C# Simplest form!! To enter in mindtap PhotoDemo.cs Instructions 1 using static

ID: 3715663 • Letter: C

Question

C# Simplest form!! To enter in mindtap

PhotoDemo.cs Instructions 1 using static System.Console; 2 class PhotoDemo Create an application class named PhotoDemothat demonstrates the methods of three related classes for a company that develops photographs. 4static void Main() // Write your main here Create a class named Photo that includes fields forwidth and height 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 Run Code Test Grade

Explanation / Answer

Hi Dear,

Please find my implementation.

PhotoDemo.cs

using System.IO;
using System;

//class PhotoDemo
class PhotoDemo
{
//main method
static void Main()
{
//create object of object
Photo stdPhoto = new Photo(8, 10);
Console.WriteLine(stdPhoto.ToString());
Photo customPhoto = new Photo(10, 12);
Console.WriteLine(customPhoto.ToString());
//create object of MattedPhoto
MattedPhoto mattedPhoto = new MattedPhoto(8, 10, "Green");
Console.WriteLine(mattedPhoto.ToString());
//create object of FramedPhoto
FramedPhoto framedPhoto = new FramedPhoto(8, 10, "platinum", "modern");
Console.WriteLine(framedPhoto.ToString());
Console.ReadLine();
}
}

Photo.cs


public class Photo
{
public int width;
public int height;
protected double price;
//constructor function
public Photo(int w, int h)
{
this.width = w;
this.height = h;
if (width == 8 && height == 10)
{
this.price = 3.99;
}
else if (width == 10 && height == 12)
{
this.price = 5.99;
}
else
{
this.price = 9.99;
}
}

//get method
public int GetWidth()
{
return width;
}

public int GetHeight()
{
return height;
}

public double GetPrice()
{
return price;
}

public string ToString()
{
return "Width:" + GetWidth() + ",Height:" + GetHeight() + ",Price:" + GetPrice();
}
}
//class MattedPhoto
public class MattedPhoto : Photo
{
public string color;
//constructor function
public MattedPhoto(int w, int h, string c)
: base(w, h)
{
width = w;
height = h;
color = c;
if (width == 8 && height == 10)
{
price = 3.99 + 10;
}
else if (width == 10 && height == 12)
{
price = 5.99 + 10;
}
else
{
price = 9.99 + 10;
}
}
//set method
public void SetColor(string color)
{
color = color;
}
//get method
public string GetColor()
{
return color;
}
public string ToString()
{
return "Width:" + GetWidth() + ",Height:" + GetHeight() + ",Price:" + GetPrice() + ",Color:" + GetColor();
}

}

//class FramedPhoto
public class FramedPhoto : Photo
{
public string material;
public string style;
//constructor method
public FramedPhoto(int w, int h, string m, string s)
: base(w, h)
{
width = w;
height = h;
material = m;
style = s;
if (width == 8 && height == 10)
{
price = 3.99 + 25;
}
else if (width == 10 && height == 12)
{
price = 5.99 + 25;
}
else
{
price = 9.99 + 25;
}
}
//Get method
public string GetMaterial()
{
return material;
}
//Get method
public string GetStyle()
{
return style;
}
public string ToString()
{
return "Width:" + GetWidth() + ",Height:" + GetHeight() + ",Price:" + GetPrice() + ",Material:" + GetMaterial() + ",Style:" + GetStyle();
}

}