Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import jeliot.io.*;
- import java.awt.Color;
- public final class Shoes {
- //Attributes
- private final Color color; // Colors: Red, Blue, White, Black, Green, Orange, Yellow
- private final ShoeType type; // Types: Slippers , Heels, Sandals, Snickers, Boots, Sports
- private final int size; // Sizes: 20 - 50
- //CTORS
- public Shoes() {
- this (Color.WHITE, ShoeType.SPORTS, 20); // The this refers to the third CTOR - Its called constructor chaining
- }
- public Shoes(Shoes other) {
- this(other.getColor(), other.getType(), other.getSize()); // The this refers to the third CTOR - Its called constructor chaining
- }
- public Shoes(Color color, ShoeType type, int size) {
- this.color = color;
- this.type = type;
- this.size = size;
- }
- /* System.out.println("Choose one of the colors: Red/White/Black/Pink");
- if ((color.equalsIgnoreCase("Red")) || (color.equalsIgnoreCase("Blue")) ||
- (color.equalsIgnoreCase("White")) || (color.equalsIgnoreCase("Black")) ||
- (color.equalsIgnoreCase("Green")) || (color.equalsIgnoreCase("Orange")) ||
- (color.equalsIgnoreCase("Yellow"))) {}
- if ((type.equalsIgnoreCase("Slippers")) || (type.equalsIgnoreCase("Heels")) ||
- (type.equalsIgnoreCase("Sandals")) || (type.equalsIgnoreCase("Snickers")) ||
- (type.equalsIgnoreCase("Boots")) || (type.equalsIgnoreCase("Sports"))) {}
- */
- //Getters
- public Color getColor() {
- return color;
- }
- public ShoeType getType() {
- return type;
- }
- public int getSize() {
- return size;
- }
- }
- public enum ShoeType {
- SLIPPERS,
- HEELS,
- SANDALS,
- SNICKERS,
- BOOTS,
- SPORTS
- }
- public class Start {
- public static void main() {
- Color shoeColor = Input.next();
- Enum shoeType = Input.next();
- int shoeSize = Input.nextInt();
- Shoes s1 = new Shoes(shoeColor, shoeType, shoeSize);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement