-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBulkFoods.cpp
More file actions
39 lines (31 loc) · 762 Bytes
/
BulkFoods.cpp
File metadata and controls
39 lines (31 loc) · 762 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
// Mauricio Sampaio Bonatte
// CS 201
// Fall 2014
// Program 5
#include <iostream>
#include <string>
#include "BulkFoods.h"
using namespace std;
BulkFood::BulkFood() //the default constructor
{
weight = 0.00;
}
void BulkFood::setWeight(double setWight) // will set the Weight
{
weight = setWight;
}
void BulkFood::print(ofstream &foutOutput) // will print the product
{
foutOutput.width(3);
foutOutput << right << quantity << " ";
foutOutput.width(28);
foutOutput << left << description;
foutOutput << "$";
foutOutput.width(7);
foutOutput.precision(2);
foutOutput << right << fixed << calculateTotal() << endl;
}
double BulkFood::calculateTotal() // get the total price
{
return weight*quantity*price;
}