-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKeyboard.cpp
More file actions
51 lines (41 loc) · 1.38 KB
/
Keyboard.cpp
File metadata and controls
51 lines (41 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Tyeon Ford
#include "Keyboard.h"
#include <iostream>
#include <iomanip>
using namespace std;
// Initialize static members
int Keyboard::totalKeyboardsSold = 0;
double Keyboard::totalKeyboardRevenue = 0.0;
// keyboard constructor
Keyboard::Keyboard(string name, double price, int stock, string desc, string switchT, bool rgb, string lay)
: Product(name, price, stock, desc), switchType(switchT), hasRGB(rgb), layout(lay) {}
void Keyboard::displayDetails() const {
cout << "\n===== KEYBOARD DETAILS =====\n";
cout << "Name: " << name << "\n";
cout << "Price: $" << fixed << setprecision(2) << price << "\n";
cout << "Stock: " << stock << " units\n";
cout << "Description: " << description << "\n";
cout << "Switch Type: " << switchType << "\n";
cout << "RGB Lighting: " << (hasRGB ? "Yes" : "No") << "\n";
cout << "Layout: " << layout << "\n";
cout << "============================\n";
}
string Keyboard::getSwitchType() const {
return switchType;
}
bool Keyboard::getHasRGB() const {
return hasRGB;
}
string Keyboard::getLayout() const {
return layout;
}
void Keyboard::recordSale(int quantity, double price) {
totalKeyboardsSold += quantity;
totalKeyboardRevenue += (quantity * price);
}
int Keyboard::getTotalKeyboardsSold() {
return totalKeyboardsSold;
}
double Keyboard::getTotalKeyboardRevenue() {
return totalKeyboardRevenue;
}