Concept explainers
PreferredCustomer Class
A retail store has a preferred customer plan where customers may 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.
• 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 CustomerData class you created in Programming Challenge 7. The PreferredCustomer class should have the following member variables:
• purchasesAmount (a double)
• discountLevel (a double)
The purchasesAmount variable holds the total of a customer’s purchases to date. The discountLevel variable should be set to the correct discount percentage, according to the store’s preferred customer plan. Write appropriate member functions for this class and demonstrate it in a simple program.
Input Validation: Do not accept negative values for any sales figures.
Want to see the full answer?
Check out a sample textbook solutionChapter 15 Solutions
Starting Out with C++ from Control Structures to Objects (9th Edition)
Additional Engineering Textbook Solutions
Modern Database Management
INTERNATIONAL EDITION---Engineering Mechanics: Statics, 14th edition (SI unit)
Starting Out with Python (4th Edition)
Java: An Introduction to Problem Solving and Programming (8th Edition)
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Web Development and Design Foundations with HTML5 (8th Edition)
- C# Language Create a Product class then create an object from that class using User Input. The program must have Constructor.arrow_forwardExercise 1 Car Dealership Create an ERD for a car dealership. The dealership sells both new and used cars, and it operates a service facility. Base your design on the following business rules: A salesperson may sell many cars, but each car is sold by only one salesperson. A customer may buy many cars, but each car is bought by only one customer. A salesperson writes a single invoice for each car he or she sells. A customer gets an invoice for each car he or she buys. A customer may come in just to have his or her car serviced; that is, a customer need not buy a car to be classified as a customer. When a customer takes one or more cars in for repair or service, one service ticket is written for each car. The car dealership maintains a service history for each of the cars serviced. The service records are referenced by the car’s serial number. A car brought in for service can be worked on by many mechanics, and each mechanic may work on many cars. A car that is…arrow_forwardSequence diagram Create a UML sequence diagram that will show your clients how the system’s classes will interact when customers are buying their flight tickets on the booking website. How to create your assignment Review the code responsible for adding a new item. Make a sequence diagram that captures the interactions of objects in the app when a new item is added. Your sequence diagram should contain the following classes: AddItemActivity ItemList Dimensions Item And contain calls of the following methods: onCreate() loadItems() saveItem() Dimensions constructor Item constructor addItem() saveItems() Lastly, the activation of AddItemActivity should start with the call to “onCreate()”arrow_forward
- Cruise Recreational Activities Example Recreational activities include things like aerobics, shuffle board, and swimming. Each activity is identified by an activity code and includes other information such as description. Classes are offered for each activity. A class is uniquely identified by a combination of the activity code and the day/time at which it is held. It is assumed that a specific class will never be offered for the same activity at the same day and time, although it could be offered on a different day and/or time. Other information about a class includes the enrollment limit and the current enrollment count. A class will never include more than one activity. A passenger can sign up for a class as long as there is sufficient room in the class. Passengers are identified by a unique passenger number. Other information stored about passengers includes name, address, and age. Passengers have no limit on the number and type of classes they can sign up for. When they…arrow_forwardProgram the employee class as indicated in the diagramYour company has 7 employees and you would like1. Capture the data of each employee2. Show the data of each employee3. Show the data of a particular employee4. Calculate and display the average salary5. Calculate and display the name of the employee with the highest salary6. Calculate and display the name of the employee with the lowest salary7. Calculate and show the total payment you will make for all your employeesarrow_forward/* Minimum Gifts - Problem Description A Company has decided to give some gifts to all of its employees. For that, company has given some rank to each employee. Based on that rank, company has made certain rules to distribute the gifts. The rules for distributing the gifts are: Each employee must receive at least one gift. Employees having higher ranking get a greater number of gifts than their neighbours. What is the minimum number of gifts required by company? Constraints 1 < T < 10 1 < N < 100000 1 < Rank < 10^9 Input First line contains integer T, denoting the number of testcases. For each testcases: First line contains integer N, denoting number of employees. Second line contains N space separated integers, denoting the rank of each employee. Output For each testcase print the number of minimum gifts…arrow_forward
- Engineering economicsarrow_forwardC# language Create a Product class then create an object from that class using User Input. The program must have Constructor. please see picture for example output. Instead of first name and last name make it product name and product price and descriptionarrow_forwarddraw class diagram for the following use case using draw ioarrow_forward
- Scenario: Movie Casting You're analyzing the relationship between an actor's education (training), experience, and the likelihood of being cast in a role for a movie. 1. Define the variables: Training: Can be either Formal Training (similar to a degree) or No Formal Training (similar to no degree). Experience: Can be either Relevant Experience (similar to relevant work experience) or Irrelevant Experience (similar to irrelevant work experience). Cast: Can be either Yes (the actor is cast) or No (the actor is not cast). 2. Probabilities: You are given the following probabilities: P(Formal Training) = 0.6 P(No Formal Training) = 0.4 If the actor has Formal Training: P(Relevant Experience | Formal Training) = 0.7 P(Irrelevant Experience | Formal Training) = 0.3 If the actor has No Formal Training: P(Relevant Experience | No Formal Training) = 0.4 P(Irrelevant Experience | No Formal Training) = 0.6 If the actor has Formal Training and Relevant Experience: P(Cast = Yes | Formal…arrow_forwardProblem: Course Information system: Super Class: Specialization Attributes: Semesterid, Courseid Methods: Set the specialization details. Display the specialization details. Sub class: course_details Attributes: course1, credit 1, course2, credit 2, course3, credit 3, course4, credit 4 Methods: Set the values of courses and credits. Find the total number of credits and Return the credits. Display the course details. Driver Class: Display the specialization details and course details. The following information are required for the assignment Properties with proper data types Methods with proper return types and scope Demonstration of OOP feature (Inheritance) Demonstration of user defined package Proper naming convention Proper comments in each program and within program Purpose of each code should be explained. Program Execution (output) Presentation (Word Document)arrow_forwardPlease solve completearrow_forward
- Operations Research : Applications and AlgorithmsComputer ScienceISBN:9780534380588Author:Wayne L. WinstonPublisher:Brooks Cole