From a9c74464c61c61ba89dec443092fdc8475c2a421 Mon Sep 17 00:00:00 2001 From: "Tanzim Chowdhury (chowdhur2)" Date: Fri, 20 Mar 2020 17:00:39 +0000 Subject: [PATCH] Add files via upload --- Inventory.h | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++ timer.h | 50 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+) create mode 100644 Inventory.h create mode 100644 timer.h diff --git a/Inventory.h b/Inventory.h new file mode 100644 index 0000000..2d7aadb --- /dev/null +++ b/Inventory.h @@ -0,0 +1,59 @@ +#pragma once +class Inventory +{ +private: + int itemID; + int amount; + double cost; + double totalCost; +public: + Inventory() // declare the Inventory object using the constructor + { + itemID = 0; + amount = 0; + cost = 0; + totalCost = 0; + + } + Inventory(int newItemID, int newamount, double newCost) + { + itemID = newItemID; + amount = newamount; + cost = newCost; + setTotalCost(amount, cost); + } + + void setItemID(int) + { + itemID = itemID; + } + void setamount(int) + { + amount = amount; + } + void setCost(double) + { + cost = cost; + } + void setTotalCost(int, double) + { + totalCost = amount * cost; + } + + int getItemID() + { + return itemID; + } + int getQuantity() + { + return amount; + } + double getCost() + { + return cost; + } + double getTotalCost() + { + return totalCost; + } +}; diff --git a/timer.h b/timer.h new file mode 100644 index 0000000..dc5c681 --- /dev/null +++ b/timer.h @@ -0,0 +1,50 @@ +#include +#include +#include +#include +using namespace std; +class timer +{ + int hours = 0; + int minutes = 0; + int seconds = 0; + + // function to display the timer + void CounterClock() + { + // system call to clear the screen + system("cls"); + + cout << setfill(' ') << setw(26) << " COUNTERCLOCK \n"; + cout << setfill(' ') << setw(26) << " ..........................\n"; + cout << setfill(' ') << setw(19); + cout << "| " << setfill('0') << setw(2) << hours << " hrs | "; + cout << setfill('0') << setw(2) << minutes << " min | "; + cout << setfill('0') << setw(2) << seconds << " sec |" << endl; + cout << setfill(' ') << setw(26) << " ...........................\n"; + } + + void countdown() + { + while (true) { + CounterClock(); + + Sleep(1); + + seconds++; + + if (seconds == 60) { + minutes++; + + if (minutes == 60) { + hours++; + minutes = 0; + + } + seconds = 0; + } + } + } + +}; +