Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#include <iomanip> | ||
#include <iostream> | ||
#include <stdlib.h> | ||
#include <Windows.h> | ||
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; | ||
} | ||
} | ||
} | ||
|
||
}; | ||
|