Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. //#include "inventory.h"
  2.  
  3. #pragma once
  4. #include <iostream>
  5.  
  6. using namespace std;
  7.  
  8. class Inventory //string, description, int balance stock
  9. {
  10. string productDesc;
  11. int stock;
  12.  
  13. private:
  14. Inventory(string p0, int s8) // constructor for checking balance, p0, s8
  15. {
  16. productDesc = p0;
  17. stock = s8;
  18.  
  19. if (stock >= 20) {
  20. cout << "This product is stocked" << endl;
  21. }
  22.  
  23. else
  24. {
  25. cout << "Not enough stock" << endl;
  26. }
  27.  
  28. //initialproduct() {
  29.  
  30. }
  31.  
  32. public: //functions
  33. void Purchase(int a)
  34. {
  35. stock = stock + a;
  36. }
  37.  
  38. int Sale(int b)
  39. {
  40. stock = stock - b;
  41. if (stock >> 20)
  42. {
  43. cout << "This product has enough amount " << endl;
  44. }
  45.  
  46. else
  47. cout << "Please restock" << endl;
  48. }
  49.  
  50. void setStock(int c)
  51. {
  52. stock = c;
  53. }
  54.  
  55. void getStock()
  56. {
  57. //return Stock;
  58. }
  59.  
  60. };
  61.  
  62. int main()
  63. {
  64. int purchase;
  65. int sale;
  66. cout << "Enter purchase" << endl;
  67. cin >> purchase;
  68. cout << "Enter sale" << endl;
  69. cin >> sale;
  70. cout << "Stock balance is " << purchase << endl;
  71. //Inventory myInventory;
  72.  
  73. //Inventory myInventory;
  74. //myInventory.setStock(purchase);
  75. //cout << "Stock balance is " << myInventory.getStock() << endl;
  76. system("PAUSE");
  77. return 0;
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement