In: Computer Science
write a program in java that contain a class for botique . data member include code , color , size , quantity . your class should contains all accessor and mutator methods , non paraqmetric constructor , parametric constructor , input andvidsplay method
solution:
CODE:
public class Botique {
private String code;
private String color;
private int size;
private int quantity;
public Botique() {
// TODO Auto-generated constructor
stub
System.out.println("non prametrized
contructor");
}
public Botique(String code, String color, int size,
int quantity) {
this();
this.code = code;
this.color = color;
this.size = size;
this.quantity = quantity;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
@Override
public String toString() {
return "Botique [code=" + code + ",
color=" + color + ", size=" + size + ", quantity=" + quantity
+ ", getCode()=" + getCode() + ", getColor()=" +
getColor() + ", getSize()=" + getSize()
+ ", getQuantity()=" + getQuantity() + ",
getClass()=" + getClass()
+ "]";
}
public static void main(String[] args) {
// TODO Auto-generated method
stub
Botique obj=new Botique();
obj.setCode("ABC");
obj.setColor("RED");
obj.setSize(6);
obj.setQuantity(10);
System.out.println(obj.toString());
}
}
OUTPUT:
please give me thumb up