-
Notifications
You must be signed in to change notification settings - Fork 0
/
ball.cpp
41 lines (35 loc) · 840 Bytes
/
ball.cpp
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
#include "ball.h"
#include <string>
#include <iostream>
Ball::Ball(string name, double price, double cost, Design design) :
Product{name, price, cost}, _design{design}, _isInflated{false} { }
bool Ball::inflate()
{
_isInflated = true;
return _isInflated;
}
string Ball::to_string()
{
string ball_design;
string isInflated;
switch(_design){
case 0:
ball_design = "Normal";
break;
case 1:
ball_design = "Special";
break;
case 2:
ball_design = "Custom";
break;
}
if (_isInflated)
{
isInflated = "Inflated";
}
else{
isInflated = "Not Inflated";
}
cout << Product::name() << '|' << _price << '|' << _cost << '|' << ball_design << isInflated << endl;
return ball_design;
}