Microsoft Visual C#
7th Edition
ISBN: 9781337102100
Author: Joyce, Farrell.
Publisher: Cengage Learning,
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
thumb_up100%
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.
Expert Solution & Answer
Trending nowThis is a popular solution!
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.
Chapter 10 Solutions
Microsoft Visual C#
Ch. 10 - Create an application class named LetterDemo that...Ch. 10 - Prob. 2ECh. 10 - Create an application for Ninas Cookie Emporium...Ch. 10 - Prob. 5ECh. 10 - Prob. 7ECh. 10 - Create an application named TurningDemo that...Ch. 10 - Write a program named SalespersonDemo that...Ch. 10 - Each of the following files in the Chapter.10...Ch. 10 - In Chapter 9, you created a Contestant class for...
Knowledge Booster
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
- You will create a class that could be used to create a Text Adventure game. The class will be called "Player" that will represent a user-controlled character in the game. The Player Class The Player class will have the following 5 properties: A property to represent the player's name A property to represent the player's current x location. A property to represent the player's current y location. An array property that represents the list of items that the player is currently carrying. The length of the array should be 3, so the player will only be able to hold a maximum of 3 items at a time. A property that represents the number of items that the player is currently carrying. (This value should never be greater than 3.) (Note: Your Player class MUST have all of the properties listed above. You are allowed to create additional properties if needed, but please be judicious about it. In other words, you should only create additional properties if you have a legitimate reason for doing…arrow_forwardCreate a class called Account that contains: • An int data field named id that stores the accounts unique identification number. • A double data field named balance that stores the current balance of the account. • A Date data field named dateCreated that stores the date on which the account was created. • A constructor that creates an account with the specified id and initial balance. • Methods that return the values of all data fields. • Methods that set the values of the id and balance data fields. • A method named withdraw that withdraws a specified amount from the Account. • A method named deposit that deposits a specified amount into the account. • A method named printStatement that print the user statement.arrow_forwardCreate a class called Account that contains:• An int data field named id that stores the accounts unique identificationnumber.• A double data field named balance that stores the current balance of theaccount.• A Date data field named dateCreated that stores the date on which theaccount was created.• A constructor that creates an account with the specified id and initial balance.• Methods that return the values of all data fields.• Methods that set the values of the id and balance data fields.• A method named withdraw that withdraws a specified amount from theAccount.• A method named deposit that deposits a specified amount into the account.• A method named printStatement that print the user statement.Create a GUI to simulate how an ATM works in real life. You GUI should be designed as per below requirements. Window 1Should have a welcome message, a textbox to receive AN EXISTING ID of the user and a button to access the data base. All users ID should be saved in a data base (Don’t…arrow_forward
- using JAVA Create a class called Transcript which will take the following parameters for its constructor:- 1. The UoF ID of the student 2. The full name of the student 3. The year in which the student joined 4. The student's GPA score NOTE: The class also has a class field which is a 2D array with 32 elements containing the course codes and grades obtained by the studentarrow_forwardCreate an application named RecoveringDemo that declares objects of three types: Patient, Upholsterer, and FootballPlayer. Create an interface named IRecoverable that contains a single method named Recover(). Create the classes named Patient, Upholsterer, and FootballPlayer so that each implements IRecoverable. Create each class’s Recover() method to display an appropriate message. For example: The Patient’s Recover() method should display I am getting better. The Upholsterer's Recover() method should display I have new material for the couch. The FootballPlayer's Recover() method should display I picked up the ball after a fumble.arrow_forwardDesign a class named Triangle that extends the GeometricObject class. The Triangle class contains:■ Three float data fields named side1, side2, and side3 to denote the threesides of the triangle.■ A constructor that creates a triangle with the specified side1, side2, andside3 with default values 1.0.■ The accessor methods for all three data fields.■ A method named getArea() that returns the area of this triangle.■ A method named getPerimeter() that returns the perimeter of this triangle.■ A method named _ _str_ _() that returns a string description for the triangle. For the formula to compute the area of a triangle, see Exercise 2.14. The_ _str_ _() method is implemented as follows:return "Triangle: side1 = " + str(side1) + " side2 = " +str(side2) + " side3 = " + str(side3)Draw the UML diagrams for the classes Triangle and GeometricObject.Implement the Triangle class. Write a test program that prompts the user to enter the three sides of the triangle, a color, and 1 or 0 to indicate…arrow_forward
- Mick’s Wicks makes color straw in various sizes. Create a class for the business named Straw that contains data fields for color, height, and price. Create get methods for all three fields. Create set methods for color and height, but not for price. Instead, when height is set, determine the price as $4 per inch. Create a child class named CurveStraw that contains an additional data field named ShortStraw and methods to get and set it. In the child class, override the parent’s setHeight() method to set the price of a CurveStraw object at $5 per inch. Write an application that instantiates an object of each type and displays thedetails.arrow_forwardCreate a class called GraduateStudent that has the following attributes: GraduateStudent String - FirstName String - LastName String - Major String - Minor Integer - UIN Double - GPA GraduateStudent() GraduateStudent(FirstName, LastName, Major, Minor, UIN, GPA) calculateFinalGrade(Double, Double, Double) - Double getFirstName() - String setFirstName(String) - void getLastName() - String setLastName(String) - void getMajor() - String setMajor(String) - void getMinor() - String setMinor(String) - void getUIN() - Integer setUIN(Integer) - void getGPA() - Double setGPA(Double) - void toString() - String compareTo(GraduateStudent) - Integer equals(GraduateStudent) - Boolean Note: The calculate final grade takes 3 doubles, each of which will be an exam grade out of 100. The first two exams are worth 25% of the final grade, and the third exam is worth 50% of the final grade. You should return this final grade as a double.arrow_forwardin C# i need to Create an application named TurningDemo that creates instances of four classes: Page, Corner, Pancake, and Leaf. Create an interface named ITurnable that contains a single method named Turn(). The classes named Page, Corner, Pancake, and Leaf implement ITurnable. Create each class’s Turn() method to display an appropriate message. For example: The Page’s Turn() method should display You turn a page in a book.The Corner’s Turn() method should display You turn corners to go around the block.The Pancake's Turn() method should display You turn a pancake when it's done on one side.The Leaf's Turn() method should display A leaf turns colors in the fall. but I keep getting errors witch are Unit Test Incomplete Build Status Build Failed Build Output Compilation failed: 3 error(s), 0 warnings NtTest930946e3.cs(12,26): error CS0246: The type or namespace name `ITurnable' could not be found. Are you missing `TurningDemo' using directive? NtTest930946e3.cs(23,7): error CS0246:…arrow_forward
- in c # i need to Create an application named TurningDemo that creates instances of four classes: Page, Corner, Pancake, and Leaf. Create an interface named ITurnable that contains a single method named Turn(). The classes named Page, Corner, Pancake, and Leaf implement ITurnable. Create each class’s Turn() method to display an appropriate message. For example: The Page’s Turn() method should display You turn a page in a book. The Corner’s Turn() method should display You turn corners to go around the block. The Pancake's Turn() method should display You turn a pancake when it's done on one side. The Leaf's Turn() method should display A leaf turns colors in the fall. i keep getting errors Unit TestIncomplete Page class defined Unit TestIncompletePage class defined Build StatusBuild FailedBuild OutputCompilation failed: 3 error(s), 0 warnings NtTest5c104eb7.cs(12,26): error CS0246: The type or namespace name `ITurnable' could not be found. Are you missing `TurningDemo' using…arrow_forwardin c# i need to Create an application named TurningDemo that creates instances of four classes: Page, Corner, Pancake, and Leaf. Create an interface named ITurnable that contains a single method named Turn(). The classes named Page, Corner, Pancake, and Leaf implement ITurnable. Create each class’s Turn() method to display an appropriate message. For example: The Page’s Turn() method should display You turn a page in a book.The Corner’s Turn() method should display You turn corners to go around the block.The Pancake's Turn() method should display You turn a pancake when it's done on one side.The Leaf's Turn() method should display A leaf turns colors in the fall.i keep getting the errors Unit TestIncompletePage class defined Build StatusBuild FailedBuild OutputCompilation failed: 3 error(s), 0 warnings NtTest4ac148a9.cs(12,26): error CS0246: The type or namespace name `ITurnable' could not be found. Are you missing `TurningDemo' using directive?NtTest4ac148a9.cs(23,7): error CS0246:…arrow_forwardin c# i need to Create an application named TurningDemo that creates instances of four classes: Page, Corner, Pancake, and Leaf. Create an interface named ITurnable that contains a single method named Turn(). The classes named Page, Corner, Pancake, and Leaf implement ITurnable. Create each class’s Turn() method to display an appropriate message. For example: The Page’s Turn() method should display You turn a page in a book.The Corner’s Turn() method should display You turn corners to go around the block.The Pancake's Turn() method should display You turn a pancake when it's done on one side.The Leaf's Turn() method should display A leaf turns colors in the fall.i keep getting the errors Unit TestIncompletePage class defined Build StatusBuild FailedBuild Output Compilation failed: 3 error(s), 0 warnings NtTest65b2de8e.cs(12,26): error CS0246: The type or namespace name `ITurnable' could not be found. Are you missing `TurningDemo' using directive?NtTest65b2de8e.cs(23,7): error CS0246:…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTEBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage