| /home/chloe/ASDV-Java/Semester 2/Assignments/MP4_ChloeFontenot/src/main/java/com/chloefontenot/mp4_chloefontenot/Details.java |
package com.chloefontenot.mp4_chloefontenot;
@author
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;
}
}