I've been working on this for hours just as practice and everything should work perfectly as I've used another class and objects example as a template for this. when I put in the scanner "shirt", "M", and "400", this is what comes up.
Shirt
M
400
Shirt isShirt@f6f4d33
public class Shirt {
private String shirtColor;
private String size;
private int price;
public Shirt(String shirtColor, String size, int price) {
}
public void setColor(String shirtColor) {
this.shirtColor = shirtColor;
}
public String getColor() {
return this.shirtColor;
}
public void setSize(String size) {
this.size = size;
}
public String getSize() {
return this.size;
}
public void setPrice(int price) {
this.price = price;
}
public int getPrice() {
return this.price;
}
}
and this is my main that I run the previous class from(my driver)
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String shirtColor;
String size;
int price;
shirtColor = scan.next();
size = scan.next();
price = scan.nextInt();
Shirt shirter = new Shirt(shirtColor, size, price);
System.out.print("Shirt is" + shirter);
}
}