/home/caleb/ASDV-Java/Semester 2/Assignments/MP4_CalebFontenot/src/main/java/com/calebfontenot/mp4_calebfontenot/Details.java
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.calebfontenot.mp4_calebfontenot;

/**
 *
 * @author caleb
 */
public class Details {

    private int rank;
    private String info;

    public int getRank()
    {
        return rank;
    }

    public String getInfo()
    {
        return info;
    }

    public static Details getDetails(Bicycle b)
    {
        Details d = new Details();
        if (b instanceof SpeedBike) {
            if (((SpeedBike) b).getWeight() < 1) {
                d.rank = 10;
            } else if (((SpeedBike) b).getWeight() > 1 && ((SpeedBike) b).getWeight() < 8) {
                d.rank = 9;
            } else {
                d.rank = 0;
            }
        } else if (b instanceof MountainBike) {
            if (((MountainBike) b).getSeatHeight() > 2) {
                d.rank = 10;
            } else {
                d.rank = 0;
            }
        } else if (b instanceof ChildBike) {
            if (((ChildBike) b).isHelpWheels()) {
                d.rank = 10;
            } else {
                d.rank = 0;
            }
        } else {
            return null;
        }

        d.info = b.toString();
        return d;
    }

}