/home/caleb/ASDV-Java/Semester 2/Assignments/MP4_CalebFontenot/src/main/java/com/calebfontenot/mp4_calebfontenot/Details.java |
package com.calebfontenot.mp4_calebfontenot;
@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;
}
}