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
• 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 (8th Edition)
Additional Engineering Textbook Solutions
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Software Engineering (10th Edition)
C++ How to Program (10th Edition)
Artificial Intelligence: A Modern Approach
Concepts Of Programming Languages
Modern Database Management (12th Edition)
- C# Language Create a Product class then create an object from that class using User Input. The program must have Constructor.arrow_forwardActivity: Interaction Models Consider the university system. Departments offer courses. Professors teach courses. Students can declare majors and are admitted to university departments if they meet minimum requirements. Students and professors have schedules based on courses they take/teach. Courses have rosters, scheduled times, and instructors. Courses may get full. Students can request to sign up for courses, and if the course is not full and they meet pre-requisites, the course is added to their schedule and the course will have them as a student in that course. Students can also drop courses. Students should be informed of the consequences such as change of status from full-time to part-time, loss of scholarships, and delays in graduation. Perform the following: 1. Create a use-case diagram for this university. Make your use-case diagram as complete as you can. 2. Pick two use cases from your use case diagram, CourseAdd and CourseDrop, and describe these use cases in the standard…arrow_forwardProgramming language C#arrow_forward
- Sequence 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_forwardCruise 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
- Process Scheduling: Select all statements below that are true The waiting time is included in the turnaround time. In interactive systems, short response times are unimportant. The time taken in an interactive program from the issuance of a command to the commencement of a response to that command is known as the response time. The response time is the time required for a particular process to complete, from submission time to completion. Throughput is the number of processes executed per time unit. The concept of virtual (run)time in the Completely Fair Scheduler is used to ensure fairness in the allocation of processor capacity.arrow_forwardCollege Driver Insurance offers discounted auto insurance to college students. The company uses several factors to set discounts, as follows:• A student who has taken a safe driver course earns a 5% discount.• A student with a clean record (no tickets or accidents in the last three years) earns a 5% discount.• A student who is 23 or older earns a 5% discount.• A student who meets all three conditions (has taken a safe driver course and has a clean record and is 23) earns an additional bonus discount of 5%.1. Create a decision table that describes the discount rules.2. Simplify the table you just created. Describe the results.3. Draw a simplified decision tree that shows the discount rules.4. What are the pros and cons of using a decision table versus a decision tree?arrow_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_forward
- Operations Research : Applications and AlgorithmsComputer ScienceISBN:9780534380588Author:Wayne L. WinstonPublisher:Brooks Cole