Perseus

MySecondTask

Jul 2nd, 2020
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. Market Store
  2. Assignment
  3.  
  4. A market store offers to their clients three different types of discount cards: bronze, silver and gold. Each card stores information about its owner, the turnover for the previous month and the initial discount rate. With each card you can calculate the discount of the current purchase. In general this is done using the formula: valueOfPurchase * discountRate.
  5.  
  6. The bronze card comes with no discount rate if the turnover for the previous month is below $100. If it is between $100 and $300, the discount rate is 1%. And if it is above $300, the rate is 2.5%.
  7.  
  8. The silver card comes with an initial discount rate of 2%. In case, the turnover is above $300, the rate is 3.5%.
  9.  
  10. The gold card comes with an initial discount rate of 2%. The discount rate grows 1% for each $100 from the turnover, capping at 10%.
  11.  
  12. Your task is:
  13.  
  14. to write an object-oriented model of this market store system;
  15. to create a class that contains method(s) that output the discount rate, the discount and the total purchase value;
  16. in your application entry point:
  17. create instances with sample data as shown in Example outputs section;
  18. invoke method(s) to print the required information.
  19. Example output
  20. Bronze:
  21. a. Mock data: turnover $0, purchase value $150;
  22. b. Output:
  23.  
  24. Purchase value: $150.00
  25.  
  26. Discount rate: 0.0%
  27.  
  28. Discount: $0.00
  29.  
  30. Total: $150.00
  31.  
  32. Silver:
  33. a. Mock data: turnover $600, purchase value $850;
  34. b. Output:
  35.  
  36. Purchase value: $850.00
  37.  
  38. Discount rate: 3.5%
  39.  
  40. Discount: $29.75
  41.  
  42. Total: $820.25
  43.  
  44. Gold:
  45. a. Mock data: turnover $1500, purchase value $1300;
  46. b. Output:
  47.  
  48. Purchase value: $1300.00
  49.  
  50. Discount rate: 10.0%
  51.  
  52. Discount: $130.00
  53.  
  54. Total: $1170.00
  55.  
  56. Deliverables:
  57. a link to the source code in version control system (GitHub, Bitbucket, GitLab, etc.) or a cloud storage (Google Drive, OneDrive, iCloud, etc.).
Add Comment
Please, Sign In to add comment