Starting out with Visual C# (4th Edition)
Starting out with Visual C# (4th Edition)
4th Edition
ISBN: 9780134382609
Author: Tony Gaddis
Publisher: PEARSON
bartleby

Concept explainers

bartleby

Videos

Textbook Question
Book Icon
Chapter 10, Problem 5PP

PreferredCustomer Class

A retail store has a preferred customer plan where customers can earn discounts on all their purchases. The amount of a customer’s discount is determined by the amount of the customer’s cumulative purchases in the store as follows:

  • When a preferred customer spends $500, he or she gets a 5 percent discount on all future purchases.
  • When a preferred customer spends $1,000, he or she gets a 6 percent discount on all future purchases.
  • When a preferred customer spends $1,500, he or she gets a 7 percent discount on all future purchases.
  • When a preferred customer spends $2,000 or more, he or she gets a 10 percent discount on all future purchases.

Design a class named PreferredCustomer, which is derived from the Customer class you created in Programming Problem 4. The PreferredCustomer class should have properties for the amount of the customer’s purchases and the customer’s discount level. Demonstrate the class in a simple application.

Blurred answer
Students have asked these similar questions
Timer Class Concepts tested: Classes 1) Write a class called Timer that models a stopwatch with start, stop, and reset buttons.  It has the following members:     a) -int startTime; // variable tracking when the timer was started (unused when timer is not running). In number of seconds since 1970     b) -int timeOnClock; // variable tracking the time on the clock since last reset in seconds     c) -bool isRunning; //variable tracking wether the clock is running or stopped     d) +Timer(); //constructor, initializes all to zero/false     e) +Timer(bool startNow); // constructur that starts clock automatically if startNow is true     f) +int getTime(); // returns time on clock in seconds. If clock is running, this must also include the time since it was last started     g) +void addTimeToClock(int seconds); // allows manually adding time to the clock     h) +void reset(); // resets time on clock to zero     i) +void start(); // starts clock     j) +void stop(); // stops clock     k)…
Nutritional information (classes/constructors) PYTHON ONLY Complete the FoodItem class by adding a constructor to initialize a food item. The constructor should initialize the name (a string) to "None" and all other instance attributes to 0.0 by default. If the constructor is called with a food name, grams of fat, grams of carbohydrates, and grams of protein, the constructor should assign each instance attribute with the appropriate parameter value. The given program accepts as input a food item name, fat, carbs, and protein and the number of servings. The program creates a food item using the constructor parameters' default values and a food item using the input values. The program outputs the nutritional information and calories per serving for both food items. Ex: If the input is: M&M's10.034.02.01.0   where M&M's is the food name, 10.0 is the grams of fat, 34.0 is the grams of carbohydrates, 2.0 is the grams of protein, and 1.0 is the number of servings, the output is:…
Problem: Employee and ProductionWorker Classes Write a python class named ProductionWorker that is a subclass of the Employee class. The ProductionWorker class should keep data attributes for the following information: • Shift number (an integer, such as 1, 2, or 3)• Hourly pay rateThe workday is divided into two shifts: day and night. The shift attribute will hold an integer value representing the shift that the employee works. The day shift is shift 1 and the night shift is shift 2. Write the appropriate accessor and mutator methods for this class. Once you have written the class, write a program that creates an object of the ProductionWorker class, and prompts the user to enter data for each of the object’s data attributes. Store the data in the object, then use the object’s accessor methods to retrieve it and display it on the screen   Note: The program should be written in python.     Sample Input/Output: Enter the name: Ahmed Al-AliEnter the ID number: 12345Enter the department:…

Chapter 10 Solutions

Starting out with Visual C# (4th Edition)

Ch. 10.3 - What must be done with an abstract property before...Ch. 10.3 - How can you create an abstract read-only property?Ch. 10 - When one object is a specialized version of...Ch. 10 - In an inheritance relationship, the_______ is the...Ch. 10 - In an inheritance relationship, the___________ is...Ch. 10 - Base classes are sometimes called____________. a....Ch. 10 - Derived classes are sometimes called______________...Ch. 10 - The refers to the base class. a. friend keyword b....Ch. 10 - Prob. 7MCCh. 10 - When a derived class method has the same name as a...Ch. 10 - The declares that a derived class is allowed to...Ch. 10 - The declares that this method overrides a method...Ch. 10 - A class that is not intended to be instantiated,...Ch. 10 - To declare a class as abstract, you use the...Ch. 10 - A regular, nonabstract class is sometimes called a...Ch. 10 - A(n) __________ is a method that appears in a base...Ch. 10 - A(n) __________ is a property that appears in a...Ch. 10 - __________ allows a base class reference variable...Ch. 10 - The base class inherits fields, properties, and...Ch. 10 - Polymorphism allows a class variable of the base...Ch. 10 - Properties in a base class cannot be overridden in...Ch. 10 - A base class reference variable can reference an...Ch. 10 - A statement that tries to use the new operator to...Ch. 10 - A class that is not intended to be instantiated,...Ch. 10 - When an abstract property appears in a class, it...Ch. 10 - What does a derived class inherit from its base...Ch. 10 - Look at the following code, which is the first...Ch. 10 - Can methods in the derived class directly access...Ch. 10 - When you create an instance of a derived class,...Ch. 10 - In what kind of situation would you want to use an...Ch. 10 - What is primary difference between an abstract...Ch. 10 - Can abstract classes also contain abstract...Ch. 10 - Write the first line of the definition for a...Ch. 10 - Look at the following class declarations: class...Ch. 10 - Write a parameterized constructor for a base class...Ch. 10 - Prob. 4AWCh. 10 - Create an abstract class called Star. Include an...Ch. 10 - Employee and ProductionWorker Classes Create an...Ch. 10 - ShiftSupervisor Class In a particular factory, a...Ch. 10 - TeamLeader Class In a particular factory, a team...Ch. 10 - Person and Customer Classes Design a class named...Ch. 10 - PreferredCustomer Class A retail store has a...

Additional Engineering Textbook Solutions

Find more solutions based on key concepts
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
    Systems Architecture
    Computer Science
    ISBN:9781305080195
    Author:Stephen D. Burd
    Publisher:Cengage Learning
Text book image
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
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