-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshape.cpp
More file actions
85 lines (67 loc) · 1.92 KB
/
shape.cpp
File metadata and controls
85 lines (67 loc) · 1.92 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//
// shape.cpp skeleton
// lab3
//
// Created by Tarek Abdelrahman on 2018-08-25.
// Copyright © 2018 Tarek Abdelrahman. All rights reserved.
//
#include <iostream>
#include <string>
using namespace std;
#include "shape.h"
// ECE244 Student:
// Write the implementation (and only the implementation) of the shape
// class below
shape::shape(string n, string t, int x_loc, int y_loc, int x_sz, int y_sz) {
name = n;
type = t;
x_location = x_loc;
y_location = y_loc;
x_size = x_sz;
y_size = y_sz;
}
//Accessors
string shape::getType() { // Returns the type
return type;
}
string shape::getName() { // Returns the name of the shape
return name;
}
int shape::getXlocation() { // Returns location of the shape on the x-axis
return x_location;
}
int shape::getYlocation() { // Returns location of the shape on the y-axis
return y_location;
}
int shape::getXsize() { // Returns the size of the shape in the x-dimension
return x_size;
}
int shape::getYsize() { // Returns the size of the shape in the y-dimension
return y_size;
}
//Mutators
void shape::setType(string t) { // Sets the type (see globals.h)
type = t;
}
void shape::setName(string n) { // Sets the name of the shape
name = n;
}
void shape::setXlocation(int x_loc) { // Sets location of the shape on the x-axis
x_location = x_loc;
}
void shape::setYlocation(int y_loc) { // Sets location of the shape on the y-axis
y_location = y_loc;
}
void shape::setXsize(int x_sz) { // Sets size of the shape in the x-dimension
x_size = x_sz;
}
void shape::setYsize(int y_sz) { // Sets size of the shape in the y-dimension
y_size = y_sz;
}
void shape::setRotate(int angle) { // sets the rotation of the shape
rotation = angle;
}
//Utility method
void shape::draw() { // prints information of the shape
cout << name << ": " << type << " " << x_location << " " << y_location << " " << x_size << " " << y_size << endl;
}