Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Group 3 #21

wants to merge 1 commit into from

Conversation

johanneskross
Copy link

No description provided.

import Planes.MilitaryPlane;
import Planes.Plane;

import java.util.*;
Copy link

@themasterlink themasterlink Sep 6, 2021

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 {

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

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());

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;

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<>();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
List<MilitaryPlane> transportMilitaryPlanes = new ArrayList<>();

Not used

List<MilitaryPlane> transportMilitaryPlanes = new ArrayList<>();
Plane maxPlane = null;

// print banner

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.

Comment on lines +17 to +19
System.out.println ("*********************************************");
System.out.println ("***** Largest Transport Military Plane ******");
System.out.println ("*********************************************");

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()) {

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.

Comment on lines +29 to +31
else {

} // else

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

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

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

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();

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() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing documentation

Copy link

@themasterlink themasterlink left a 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.

@TheJJ TheJJ removed their request for review September 7, 2021 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants