-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Group 3 #21
base: master
Are you sure you want to change the base?
Group 3 #21
Conversation
import Planes.MilitaryPlane; | ||
import Planes.Plane; | ||
|
||
import java.util.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* import are considered bad in python (no idea about java), clutter the global namespace
|
||
import java.util.*; | ||
|
||
public class Airport { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Class has no documentation
public class Airport { | ||
|
||
/** | ||
* Prints transport military planes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add content for documentation
|
||
} // else | ||
} //for | ||
System.out.println("model:" + maxPlane.getModel()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No seg fault check
*/ | ||
private void printMaxTransportMilitaryPlane() { | ||
List<MilitaryPlane> transportMilitaryPlanes = new ArrayList<>(); | ||
Plane maxPlane = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this line to before the for loop.
* Prints transport military planes | ||
*/ | ||
private void printMaxTransportMilitaryPlane() { | ||
List<MilitaryPlane> transportMilitaryPlanes = new ArrayList<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
List<MilitaryPlane> transportMilitaryPlanes = new ArrayList<>(); |
Not used
List<MilitaryPlane> transportMilitaryPlanes = new ArrayList<>(); | ||
Plane maxPlane = null; | ||
|
||
// print banner |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment can be omitted.
System.out.println ("*********************************************"); | ||
System.out.println ("***** Largest Transport Military Plane ******"); | ||
System.out.println ("*********************************************"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No white space before opening parenthesis.
for (Plane plane : planes) { | ||
if (plane instanceof MilitaryPlane) { | ||
if (((MilitaryPlane) plane).getType() == MilitaryType.TRANSPORT) { | ||
if (maxPlane != null && maxPlane.getMaxLoadCapacity() < plane.getMaxLoadCapacity()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maxPlane
is always null
. Therefore this is always false, which leads to a seg fault in Line 33.
else { | ||
|
||
} // else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code can be omitted.
maxPlane = plane; | ||
} | ||
} | ||
} //if |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove empty docu
else { | ||
|
||
} // else | ||
} //for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove empty docu
System.out.println("capacity:" + maxPlane.getMaxLoadCapacity()); | ||
} | ||
|
||
//Constructor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove empty docu, and please add explicit documentation on the constructor
//Constructor | ||
public Airport(List<? extends Plane> planes) { | ||
this.planes = planes; | ||
this.printMaxTransportMilitaryPlane(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not call a print fct in a constructor
|
||
private List<? extends Plane> planes; | ||
|
||
public List<? extends Plane> getPlanes() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing documentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The order of the functions should be public and then private. At the top we would like to see the constructor. For the rest see the comments.
No description provided.