-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFlower.m
More file actions
27 lines (24 loc) · 817 Bytes
/
Flower.m
File metadata and controls
27 lines (24 loc) · 817 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
classdef Flower
properties
petalWidth
petalLength
sepalWidth
sepalLength
species
end
methods
function obj = Flower(pw, pl, sw, sl, s)
obj.petalWidth = pw;
obj.petalLength = pl;
obj.sepalWidth = sw;
obj.sepalLength = sl;
obj. species = s;
end
function SLength = getSLength(obj)
SLength = obj.sepalLength;
end
function report(obj)
disp("The length and width of its sepal are "+ obj.sepalLength+" cm and "+obj.sepalWidth+" cm respectively, while the length and width of its petal are "+ obj.petalLength+ "cm and "+ obj.petalWidth+"cm respectively. It belongs to the "+obj.species+" species.");
end
end
end