import java.util.Scanner;
public class Shoe {
public String brand;
public int model;
public String type;
public String color;
public double size;
public void displayBrand(){
System.out.println("The brand of your shoes is "+brand);
}
public void displayModel(){
if(model<2011){
System.out.println("You have an old model of shoes ");
} else {
System.out.println("You have the latest model of shoes ");
}
}
public void displayType(){
System.out.println("Your shoes is a "+ type);
}
public void displayColor(){
System.out.println("The color of your shoes is "+ color);
}
public void displaySize(){
System.out.println("The size of your shoes is "+size);
}
}
-------------------------------------------
import java.util.Scanner;
public class ShoesImp {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
Shoe Shoe = new Shoe();
System.out.println("What is the brand of your shoes: ");
String brand = input.next();
System.out.println("What year is the model of your shoes: ");
int model = input.nextInt();
System.out.println("What is the type of your shoes: ");
String type = input.next();
System.out.println("What is the color of your shoes: ");
String color = input.next();
System.out.println("What is the size of your shoes: ");
int size = input.nextInt();
Shoe.brand = (brand);
Shoe.model = (model);
Shoe.type = (type);
Shoe.color = (color);
Shoe.size = (size);
System.out.println();
System.out.println();
System.out.println();
Shoe.displayBrand();
Shoe.displayModel();
Shoe.displayType();
Shoe.displayColor();
Shoe.displaySize();
}
}
No comments:
Post a Comment