Microsoft Visual C#
7th Edition
ISBN: 9781337102100
Author: Joyce, Farrell.
Publisher: Cengage Learning,
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 10, Problem 4E
- Create an application for Nina’s Cookie Emporium named CookieDemo that declares and demonstrates objects of the CookieOrder class and its descendants. The CookieOrder class includes auto-implemented properties for an order number, recipient’s name, and cookie type (for example, chocolate chip), and fields for number of dozens ordered and price. When the field value for number of dozens ordered is set, the price field is set as $15 per dozen for the first two dozen and $13 per dozen for each dozen over two.
- Create a child class named Special Cookieorder, which includes a field with a description as to why the order is special (for example, gluten-free). Override the method that sets a CookieOrder’s price as described in part a, but also to include special handling, which is SIO for orders up to $40 and $8 for higher-priced orders. Create an application named CookieDem02 that demonstrates using several Special CookieOrder objects.
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
Write an application for Nina’s Cookie Emporium named CookieDemo that declares and demonstrates objects of the CookieOrder class and its descendants. The CookieOrder class includes the following auto-implemented properties:
OrderNum - The order number
Name - The recipient’s name
CookieType - The cookie type (for example, chocolate chip)
The class should also include fields for number of dozens ordered and price (named Dozens and Price). When the field value for number of dozens ordered is set, the price field is set as $15 per dozen for the first two dozen and $13 per dozen for each dozen over two.
Next, create a child class named SpecialCookieOrder, which includes a field with a description as to why the order is special (for example, gluten-free). Override the method that sets a CookieOrder’s price as described in the step above, but also to include special handling, which is $10 for orders up to $40 and $8 for higher-priced orders.
An example of the program is shown below:
Order…
Write an application for Nina’s Cookie Emporium named CookieDemo that declares and demonstrates objects of the CookieOrder class and its descendants. The CookieOrder class includes the following auto-implemented properties:
OrderNum - The order number
Name - The recipient’s name
CookieType - The cookie type (for example, chocolate chip)
The class should also include fields for number of dozens ordered and price (named Dozens and Price). When the field value for number of dozens ordered is set, the price field is set as $15 per dozen for the first two dozen and $13 per dozen for each dozen over two.
Next, create a child class named SpecialCookieOrder, which includes a field with a description as to why the order is special (for example, gluten-free). Override the method that sets a CookieOrder’s price as described in the step above, but also to include special handling, which is $10 for orders up to $40 and $8 for higher-priced orders.
An example of the program is shown below:
Order…
Write an application for Nina’s Cookie Emporium named CookieDemo that declares and demonstrates objects of the CookieOrder class and its descendants. The CookieOrder class includes the following auto-implemented properties:
OrderNum - The order number
Name - The recipient’s name
CookieType - The cookie type (for example, chocolate chip)
The class should also include fields for number of dozens ordered and price (named Dozens and Price). When the field value for number of dozens ordered is set, the price field is set as $15 per dozen for the first two dozen and $13 per dozen for each dozen over two.
Next, create a child class named SpecialCookieOrder, which includes a field with a description as to why the order is special (for example, gluten-free). Override the method that sets a CookieOrder’s price as described in the step above, but also to include special handling, which is $10 for orders up to $40 and $8 for higher-priced orders.(assume "OrderNum" is actually a string and the…
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
- Write an application for Nina’s Cookie Emporium named CookieDemo that declares and demonstrates objects of the CookieOrder class and its descendants. The CookieOrder class includes the following auto-implemented properties: OrderNum - The order number Name - The recipient’s name CookieType - The cookie type (for example, chocolate chip) The class should also include fields for number of dozens ordered and price (named Dozens and Price). When the field value for number of dozens ordered is set, the price field is set as $15 per dozen for the first two dozen and $13 per dozen for each dozen over two. Next, create a child class named SpecialCookieOrder, which includes a field with a description as to why the order is special (for example, gluten-free). Override the method that sets a CookieOrder’s price as described in the step above, but also to include special handling, which is $10 for orders up to $40 and $8 for higher-priced orders. (assume "OrderNum" is actually a string and the…arrow_forwardThis is the question - Write an application that uses an abstract Insurance class and Health and Life subclasses to display different types of insurance policies and the cost per month. The Insurance class contains a String representing the type of insurance and a double that holds the monthly price. The Insurance class constructor requires a String argument indicating the type of insurance, but the Life and Health class constructors require no arguments. The Insurance class contains a get method for each field; it also contains two abstract methods named setCost() and display(). The Life class setCost() method sets the monthly fee to $36, and the Health class sets the monthly fee to $196. Code I was given - import java.util.*; public class Health extends Insurance { public Health() { // write your code here } public void setCost() { // write your code here } public void display() { // write your code here } } public…arrow_forwarda. Write a FractionDemo program that instantiates several Fraction objects and demonstrates that their methods work correctly. Create a Fraction class with fields that hold a whole number, a numerator, and a denominator. In addition: Create properties for each field. The set access or for the denominator should not allow a 0 value; the value defaults to 1. Add three constructors. One takes three parameters for a whole number, numerator, and denominator. Another accepts two parameters for the numerator and denominator; when this constructor is used, the whole number value is 0. The last constructor is parameterless; it sets the whole number and numerator to 0 and the denominator to 1. (After construction, Fractions do not have to be reduced to proper form. For example, even though 3/9 could be reduced to 1/3, your constructors do not have to perform this task.) Add a Reduce() method that reduces a Fraction if it is in improper form. For example, 2/4 should be reduced to 1/2. Add an operator+() method that adds two Fractions. To add two fractions, first eliminate any whole number part of the value. For example, 2 1/4 becomes 9/4 and 1 3/5 becomes 8/5. Find a common denominator and convert the fractions to it. For example, when adding 9/4 and 8/5, you can convert them to 45/20 and 32/20. Then you can add the numerators, giving 77/20. Finally, call the Reduce() method to reduce the result, restoring any whole number value so the fractional part of the number is less than 1. For example, 77/20 becomes 3 17/20. Include a function that returns a string that contains a Fraction in the usual display format—the whole number, a space, the numerator, a slash (D, and a denominator. When the whole number is 0, just the Fraction part of the value should be displayed (for example, 1/2 instead of 0 1/2). If the numerator is 0, just the whole number should be displayed (for example, 2 instead of 2 0/3). b. Add an operator*() method to the Fraction class created in Exercise 11a so that it correctly multiplies two Fractions. The result should be in proper, reduced format. Demonstrate that the method works correctly in a program named FractionDemo2. c. Write a program named FractionDem03 that includes an array of four Fractions. Prompt the user for values for each. Display every possible combination of addition results and every possible combination of multiplication results for each Fraction pair (that is, each type will have 16 results).arrow_forward
- Write a program named DemoJobs for Harolds Home Services. The program should instantiate several Job objects and demonstrate their methods. The Job class contains four data fields—description (for example, wash windows), time in hours to complete (for example, 3.5), per-hour rate charged (for example, $25.00), and total fee (hourly rate times hours). Include properties to get and set each field except the total fee—that field will be read-only, and its value is calculated each time either the hourly fee or the number of hours is set. Overload the + operator so that two Jobs can be added. The sum of two Jobs is a new Job containing the descriptions of both original Jobs (joined by and), the sum of the time in hours for the original Jobs, and the average of the hourly rate for the original Jobs. Harold has realized that his method for computing the fee for combined jobs is not fair. For example, consider the following: His fee for painting a house is $100 per hour. If a job takes 10 hours, he earns $1000. His fee for dog walking is $10 per hour. If a job takes 1 hour, he earns $10. If he combines the two jobs and works a total of 11 hours, he earns only the average rate of $55 per hour, or $605. Devise an improved, weighted method for calculating Harolds fees for combined Jobs and include it in the overloaded operator+() method. Write a program named DemoJobs2 that demonstrates all the methods in the class work correctly.arrow_forwardWrite a C# application AutomobileDemo that prompts a user for data for eight Automobile objects. The Automobile class includes the following auto-implemented properties: IdNumber - The ID number (an int) Make - The make (a string) Year - The year (an int) Price - The price (a double) Override the ToString() method to return all the details for an Automobile. During data entry, re-prompt the user if any ID number is a duplicate. Sort the objects in ID number order, and display all their data as well as a total of all their prices. For example if, the output should be in the following format (only two automobiles shown): Automobile 1 2017 honda Price is $30,000.00 Automobile 45 2016 Toyota Price is $20,000.00 Total for all Automobiles is $50,000.00. using System; using static System.Console; using System.Globalization; class AutomobileDemo { static void Main() { // Your code here } }arrow_forwardThis is the question - Create a class named Rock that acts as a superclass for rock samples collected and catalogued by a natural history museum. The Rock class contains the following fields: sampleNumber - of type int description - A description of the type of rock (of type String) weight - The weight of the rock in grams (of type double) Include a constructor that accepts parameters for the sample number and weight. The Rock constructor sets the description value to "Unclassified". Include get methods for each field. Create three child classes named IgneousRock, SedimentaryRock, and MetamorphicRock. The constructors for these classes require parameters for the sample number and weight. Search the Internet for a brief description of each rock type and assign it to the description field using a method named setDescription inside of the constructor. This is the code I have, the program does not like at all what I have - import java.util.*; public class DemoRock { public static…arrow_forward
- This is the question - Create a class named Rock that acts as a superclass for rock samples collected and catalogued by a natural history museum. The Rock class contains the following fields: sampleNumber - of type int description - A description of the type of rock (of type String) weight - The weight of the rock in grams (of type double) Include a constructor that accepts parameters for the sample number and weight. The Rock constructor sets the description value to "Unclassified". Include get methods for each field. Create three child classes named IgneousRock, SedimentaryRock, and MetamorphicRock. The constructors for these classes require parameters for the sample number and weight. Search the Internet for a brief description of each rock type and assign it to the description field using a method named setDescription inside of the constructor. I am only missing two checks and they seem to be with the rock, here is my code then I will copy one check - import java.util.*;…arrow_forwardSammy's Seashore Supplies rents beach equipment such as kayaks, canoes, beach chairs, and umbrellas to tourists. In Chapter 3, you created a Rental class for the company. The Rental class contains two public final static fields that hold the number of minutes in an hour and the hourly rental rate ($40), and four private fields that hold a contract number, number of hours for the rental, number of minutes over an hour, and the price. It also contains two public set methods and four public get methods. Now, modify the Rental class to contain two overloaded constructors. One constructor accepts a contract number and number of minutes as parameters. Pass these values to the setContractNumber() and setHoursAndMinutes() methods, respectively. The setHoursAndMinutes() method will automatically calculate the hours, extra minutes, and price. The other constructor is a default constructor that passes "A000" and 0 to the two-parameter constructor. Save the file as Rental.java. b. In Chapter…arrow_forwardin C# i need to Write a FractionDemo program that instantiates several Fraction objects and demonstrates that their methods work correctly. Create a Fraction class with the following fields, all of type int: wholeNum - Holds a whole number numerator - The numerator denominator - The denominator In addition: Create properties for each field. The set accessor for the denominator should not allow a 0 value; the value defaults to 1. Add three constructors. One takes three parameters for a whole number, numerator, and denominator. Another accepts two parameters for the numerator and denominator; when this constructor is used, the whole number value is 0. The last constructor is parameterless; it sets the whole number and numerator to 0 and the denominator to 1. (After construction, Fractions do not have to be reduced to proper form. For example, even though 3/9 could be reduced to 1/3, your constructors do not have to perform this task.) Add a Reduce() method that reduces a Fraction if…arrow_forward
- This has to be done in visual studio, c# windows form application (.net fromework). Question: The application should be able to do the following :• Create a class called Person which contains 4 private fields : Name(string), Surname (string),Course(string), CRNumber(int).• The class must contain 4 public properties which will be used to get and set the values of the private fields.• The class must contain a default constructer. The class must also contain an overloaded constructer which should be able to set the values of each of the private fields.• The class must contain a static ViewInfo method which will be used to display information of a queue of person objects back to the user neatly grouped underneath each other as displayed above.• Once a user clicks on the “Add Person” button then the information in the respective textboxes should be used to create a Person object (using the properties or the overloaded constructor) and add it to a queue which is of type Person. The…arrow_forwardWrite the application AutomobileDemo that prompts a user for data for eight Automobile objects in C# language The Automobile class includes the following auto-implemented properties: IdNumber - The ID number (an int) Make - The make (a string) Year - The year (an int) Price - The price (a double) Override the ToString() method to return all the details for an Automobile. During data entry, re-prompt the user if any ID number is a duplicate. Sort the objects in ID number order, and display all their data as well as a total of all their prices. For example if, the output should be in the following format (only two automobiles shown): Automobile 1 2017 honda Price is $30,000.00 Automobile 45 2016 Toyota Price is $20,000.00 Total for all Automobiles is $50,000.00arrow_forwardWrite a class named Employee that has the following fields: name: The name field is a String object that holds the employee's name. idNumber: The idNumber is an integer variable that holds the employee's ID number. department: The department field is a String object that holds the name of the department where the employee works. position: The position field is a String object that holds the employee's job title. Write mutator methods that store values in these fields and accessor methods that return the values in these fields. Once you have written the class, write a separate program that creates three Employee objects to hold the following data. Name ID Number Azah Samsudin Mira Kamal Che Yah Sam Department Computer Science Biomedical Language Position Programmer Researcher Lecturer 11011 35125 80001 The program should store the data in the three objects and then display the data for each employee on the screen.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 - CONSIGNMENTProgramming 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
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Introduction to Classes and Objects - Part 1 (Data Structures & Algorithms #3); Author: CS Dojo;https://www.youtube.com/watch?v=8yjkWGRlUmY;License: Standard YouTube License, CC-BY