-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRoses.java
More file actions
44 lines (38 loc) · 994 Bytes
/
Copy pathRoses.java
File metadata and controls
44 lines (38 loc) · 994 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
class Flowers{
//made two varibles
String name, color;
int amount;
public void setValues(String name,int amount,String color) {
this.name=name;
this.amount=amount;
this.color=color;
}
public void getName() {
System.out.println("Name of the flower are " + name);
}
public void getamount() {
System.out.println("Amount ordered "+ amount);
}
public void getcolor() {
System.out.println("Color is " + color);
}
// Whatever is in the () needs a data type!!
// this. shows the varible belongs to the obj
}
public class Main
{
public static void main(String[] args) {
//creating object
Flowers C1=new Flowers();
Flowers C2=new Flowers();
C1.setValues("Roses",12,"Red");
C2.setValues("Bluebells",30,"Blue");
C1.getName();
C1.getamount();
C1.getcolor();
C2.getName();
C2.getamount();
C2.getcolor();
//System.out.println();
}
}