-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShirts.cpp
More file actions
49 lines (38 loc) · 861 Bytes
/
Shirts.cpp
File metadata and controls
49 lines (38 loc) · 861 Bytes
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
// Mauricio Sampaio Bonatte
// CS 201
// Fall 2014
// Program 5
#include <iostream>
#include <string>
#include "Shirts.h"
using namespace std;
Shirts::Shirts() // the default constructor
{
size = "";
}
void Shirts::setSize(string setSize) //this sets the Size
{
size = setSize;
}
void Shirts::print(ofstream &foutOutput) // this will print the product
{
foutOutput.width(3);
foutOutput << right << quantity << " ";
foutOutput.width(28);
foutOutput << left << size + " " + description;
foutOutput << "$";
foutOutput.width(7);
foutOutput.precision(2);
foutOutput << right << fixed << calculateTotal() << endl;
}
double Shirts::calculateTotal() // get the total price
{
if (size == "2XL" || size == "3XL")
{
return quantity * (price + 1);
}
else
{
return (quantity * price);
}
}