Skip to content

Ch. 16 practice problems #20

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

Merged
merged 3 commits into from
Nov 21, 2020
Merged

Ch. 16 practice problems #20

merged 3 commits into from
Nov 21, 2020

Conversation

neha-peddinti
Copy link
Contributor

Access
Ch. 16
Benefits of Linked Lists

Sort
Ch. 16
LinkedLists

Names
Ch. 16
LinkedLists

SinglyLinkedListInsert
Ch. 16
SinglyLinkedList DIY

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

reviewdog

src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|50 col 5| '}' at column 5 should be on the same line as the next part of a multi-block statement (one that directly contains multiple blocks: if/else-if/else, do/while or try/catch/finally).
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|51 col 5| 'else' has incorrect indentation level 4, expected level should be 8.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|54 col 9| 'else' child has incorrect indentation level 8, expected level should be 12.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|55 col 9| 'while' has incorrect indentation level 8, expected level should be 12.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|56 col 13| 'while' child has incorrect indentation level 12, expected level should be 16.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|57 col 9| 'while rcurly' has incorrect indentation level 8, expected level should be 12.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|60 col 9| 'else' child has incorrect indentation level 8, expected level should be 12.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|61 col 5| 'else rcurly' has incorrect indentation level 4, expected level should be 8.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|62 col 3| 'method def rcurly' has incorrect indentation level 2, expected level should be 4.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|64 col 3| 'method def modifier' has incorrect indentation level 2, expected level should be 4.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|64 col 3| Missing a Javadoc comment.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|66 col 5| 'if' construct must use '{}'s.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|66 col 5| 'if' has incorrect indentation level 4, expected level should be 8.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|70 col 5| 'method def' child has incorrect indentation level 4, expected level should be 8.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|70 col 10| Local variable name 'new_node' must match pattern '^a-z?$'.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|71 col 5| 'method def' child has incorrect indentation level 4, expected level should be 8.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|74 col 5| 'if' has incorrect indentation level 4, expected level should be 8.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|75 col 7| 'if' child has incorrect indentation level 6, expected level should be 12.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|76 col 7| 'if' child has incorrect indentation level 6, expected level should be 12.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|77 col 5| 'if rcurly' has incorrect indentation level 4, expected level should be 8.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|78 col 7| 'while' has incorrect indentation level 6, expected level should be 12.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|79 col 9| 'if' has incorrect indentation level 8, expected level should be 16.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|81 col 11| 'if' child has incorrect indentation level 10, expected level should be 20.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|82 col 11| 'if' child has incorrect indentation level 10, expected level should be 20.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|83 col 11| 'if' child has incorrect indentation level 10, expected level should be 20.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|84 col 9| 'if rcurly' has incorrect indentation level 8, expected level should be 16.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|86 col 9| 'if' has incorrect indentation level 8, expected level should be 16.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|86 col 9| 'if' is not followed by whitespace.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|86 col 9| WhitespaceAround: 'if' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3)
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|87 col 11| 'if' child has incorrect indentation level 10, expected level should be 20.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|88 col 11| 'if' child has incorrect indentation level 10, expected level should be 20.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|89 col 9| 'if rcurly' has incorrect indentation level 8, expected level should be 16.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|90 col 9| 'while' child has incorrect indentation level 8, expected level should be 16.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|91 col 7| 'while rcurly' has incorrect indentation level 6, expected level should be 12.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|92 col 5| 'else rcurly' has incorrect indentation level 4, expected level should be 8.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|93 col 3| 'method def rcurly' has incorrect indentation level 2, expected level should be 4.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|95 col 3| 'method def modifier' has incorrect indentation level 2, expected level should be 4.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|98 col 5| 'if' construct must use '{}'s.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|98 col 5| 'if' has incorrect indentation level 4, expected level should be 8.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|98 col 5| 'if' is not followed by whitespace.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|98 col 5| WhitespaceAround: 'if' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3)
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|99 col 7| 'if' child has incorrect indentation level 6, expected level should be 12.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|101 col 5| 'method def' child has incorrect indentation level 4, expected level should be 8.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|104 col 5| 'method def' child has incorrect indentation level 4, expected level should be 8.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|105 col 5| 'while' has incorrect indentation level 4, expected level should be 8.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|105 col 5| 'while' is not followed by whitespace.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|105 col 5| WhitespaceAround: 'while' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3)
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|106 col 7| 'while' child has incorrect indentation level 6, expected level should be 12.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|107 col 7| 'while' child has incorrect indentation level 6, expected level should be 12.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|108 col 5| 'while rcurly' has incorrect indentation level 4, expected level should be 8.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|109 col 5| 'method def' child has incorrect indentation level 4, expected level should be 8.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|110 col 5| 'method def' child has incorrect indentation level 4, expected level should be 8.
src/com/codefortomorrow/advanced/chapter16/solutions/SinglyLinkedListInsert.java|111 col 3| 'method def rcurly' has incorrect indentation level 2, expected level should be 4.
src/com/codefortomorrow/advanced/chapter16/solutions/Access.java|2 col 1| 'import' should be separated from previous statement.
src/com/codefortomorrow/advanced/chapter16/solutions/Access.java|2 col 17| Using the '.' form of import should be avoided - java.util..
src/com/codefortomorrow/advanced/chapter16/solutions/Access.java|18 col 9| Distance between variable 'b' declaration and its first usage is 4, but allowed 3. Consider making that variable final if you still need to store its value in advance (before method calls that might have side effects on the original value).
src/com/codefortomorrow/advanced/chapter16/solutions/Access.java|18 col 9| Each variable declaration must be in its own statement.
src/com/codefortomorrow/advanced/chapter16/solutions/Access.java|22 col 9| 'for' construct must use '{}'s.
src/com/codefortomorrow/advanced/chapter16/solutions/Access.java|22 col 9| 'for' is not followed by whitespace.
src/com/codefortomorrow/advanced/chapter16/solutions/Access.java|22 col 9| WhitespaceAround: 'for' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3)
src/com/codefortomorrow/advanced/chapter16/solutions/Access.java|26 col 9| 'for' construct must use '{}'s.
src/com/codefortomorrow/advanced/chapter16/solutions/Access.java|26 col 9| 'for' is not followed by whitespace.
src/com/codefortomorrow/advanced/chapter16/solutions/Access.java|26 col 9| WhitespaceAround: 'for' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3)
src/com/codefortomorrow/advanced/chapter16/solutions/Access.java|33 col 45| WhitespaceAround: '-' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3)
src/com/codefortomorrow/advanced/chapter16/solutions/Access.java|33 col 45| WhitespaceAround: '-' is not preceded with whitespace.
src/com/codefortomorrow/advanced/chapter16/solutions/Access.java|38 col 46| WhitespaceAround: '-' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3)
src/com/codefortomorrow/advanced/chapter16/solutions/Access.java|38 col 46| WhitespaceAround: '-' is not preceded with whitespace.
src/com/codefortomorrow/advanced/chapter16/solutions/Sort.java|2 col 1| 'import' should be separated from previous statement.
src/com/codefortomorrow/advanced/chapter16/solutions/Sort.java|2 col 17| Using the '.' form of import should be avoided - java.util..
src/com/codefortomorrow/advanced/chapter16/solutions/Sort.java|22 col 5| Missing a Javadoc comment.
src/com/codefortomorrow/advanced/chapter16/solutions/Sort.java|23 col 9| 'if' construct must use '{}'s.
src/com/codefortomorrow/advanced/chapter16/solutions/Sort.java|23 col 9| 'if' is not followed by whitespace.
src/com/codefortomorrow/advanced/chapter16/solutions/Sort.java|23 col 9| WhitespaceAround: 'if' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3)
src/com/codefortomorrow/advanced/chapter16/solutions/Sort.java|24 col 9| 'for' is not followed by whitespace.
src/com/codefortomorrow/advanced/chapter16/solutions/Sort.java|24 col 9| WhitespaceAround: 'for' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3)
src/com/codefortomorrow/advanced/chapter16/solutions/Sort.java|27 col 13| 'if' is not followed by whitespace.
src/com/codefortomorrow/advanced/chapter16/solutions/Sort.java|27 col 13| WhitespaceAround: 'if' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3)
src/com/codefortomorrow/advanced/chapter16/solutions/Sort.java|27 col 45| WhitespaceAround: '-' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3)
src/com/codefortomorrow/advanced/chapter16/solutions/Sort.java|27 col 45| WhitespaceAround: '-' is not preceded with whitespace.
src/com/codefortomorrow/advanced/chapter16/solutions/Sort.java|30 col 17| 'for' is not followed by whitespace.
src/com/codefortomorrow/advanced/chapter16/solutions/Sort.java|30 col 17| WhitespaceAround: 'for' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3)
src/com/codefortomorrow/advanced/chapter16/solutions/Sort.java|31 col 21| 'if' is not followed by whitespace.
src/com/codefortomorrow/advanced/chapter16/solutions/Sort.java|31 col 21| WhitespaceAround: 'if' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3)
src/com/codefortomorrow/advanced/chapter16/solutions/Sort.java|34 col 38| WhitespaceAround: '+' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3)
src/com/codefortomorrow/advanced/chapter16/solutions/Sort.java|34 col 38| WhitespaceAround: '+' is not preceded with whitespace.
src/com/codefortomorrow/advanced/chapter14/solutions/Bank.java|54 col 1| Top-level class BankAccount has to reside in its own source file.
src/com/codefortomorrow/intermediate/chapter12/practice/pokemon/Pokemon.java|8 col 17| Abbreviation in name 'maxHP' must contain no more than '1' consecutive capital letters.
src/com/codefortomorrow/intermediate/chapter12/practice/pokemon/Pokemon.java|9 col 17| Abbreviation in name 'currentHP' must contain no more than '1' consecutive capital letters.
src/com/codefortomorrow/intermediate/chapter12/practice/pokemon/Pokemon.java|10 col 17| Abbreviation in name 'XP' must contain no more than '1' consecutive capital letters.
src/com/codefortomorrow/intermediate/chapter12/practice/pokemon/Pokemon.java|10 col 17| Member name 'XP' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9]$'.
src/com/codefortomorrow/intermediate/chapter12/practice/TestPiano.java|45 col 1| Top-level class Instrument has to reside in its own source file.
src/com/codefortomorrow/intermediate/chapter12/solutions/TimeAndDate.java|49 col 1| Top-level class MyTime has to reside in its own source file.
src/com/codefortomorrow/intermediate/chapter12/solutions/TimeAndDate.java|72 col 1| Top-level class MyDate has to reside in its own source file.
src/com/codefortomorrow/intermediate/chapter12/solutions/geometric/Shape.java|65 col 19| Member name 'x' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9]
$'.
src/com/codefortomorrow/intermediate/chapter12/solutions/geometric/Shape.java|66 col 19| Member name 'y' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9]$'.
src/com/codefortomorrow/intermediate/chapter12/solutions/geometric/Shape.java|68| First sentence of Javadoc is missing an ending period.
src/com/codefortomorrow/intermediate/chapter12/solutions/geometric/Rectangle.java|68| First sentence of Javadoc is missing an ending period.
src/com/codefortomorrow/intermediate/chapter12/solutions/geometric/Circle.java|67| First sentence of Javadoc is missing an ending period.
src/com/codefortomorrow/intermediate/chapter12/solutions/pokemon/Pokemon.java|8 col 17| Abbreviation in name 'maxHP' must contain no more than '1' consecutive capital letters.
src/com/codefortomorrow/intermediate/chapter12/solutions/pokemon/Pokemon.java|9 col 17| Abbreviation in name 'currentHP' must contain no more than '1' consecutive capital letters.
src/com/codefortomorrow/intermediate/chapter12/solutions/pokemon/Pokemon.java|10 col 17| Abbreviation in name 'XP' must contain no more than '1' consecutive capital letters.
src/com/codefortomorrow/intermediate/chapter12/solutions/pokemon/Pokemon.java|10 col 17| Member name 'XP' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9]
$'.
src/com/codefortomorrow/intermediate/chapter12/solutions/TestPiano.java|40 col 1| Top-level class Piano has to reside in its own source file.
src/com/codefortomorrow/intermediate/chapter12/solutions/TestPiano.java|74 col 1| Top-level class Instrument has to reside in its own source file.
src/com/codefortomorrow/intermediate/chapter12/solutions/TestTriangle.java|46 col 1| Top-level class Triangle has to reside in its own source file.
src/com/codefortomorrow/intermediate/chapter12/examples/TestInstrument.java|17 col 1| Top-level class Instrument has to reside in its own source file.
src/com/codefortomorrow/intermediate/chapter12/examples/TestInstrument.java|38 col 1| Top-level class Guitar has to reside in its own source file.
src/com/codefortomorrow/intermediate/chapter12/examples/TestPoint.java|19 col 1| Top-level class Point has to reside in its own source file.
src/com/codefortomorrow/intermediate/chapter12/examples/TestPoint.java|20 col 19| Member name 'x' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9]$'.
src/com/codefortomorrow/intermediate/chapter12/examples/TestPoint.java|21 col 19| Member name 'y' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9]
$'.
src/com/codefortomorrow/intermediate/chapter12/examples/TestPoint.java|23| First sentence of Javadoc is missing an ending period.
src/com/codefortomorrow/beginner/chapter2/examples/Variables.java|23 col 1| Top-level class A has to reside in its own source file.
src/com/codefortomorrow/beginner/chapter2/examples/Variables.java|27 col 1| Top-level class B has to reside in its own source file.

@@ -1,88 +0,0 @@
package com.codefortomorrow.advanced.chapter15.solutions;

import java.util.Arrays;
Copy link

Choose a reason for hiding this comment

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

[reviewdog] reported by reviewdog 🐶
Top-level class Student has to reside in its own source file.

package com.codefortomorrow.advanced.chapter15.solutions;

import java.util.Arrays;

Copy link

Choose a reason for hiding this comment

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

[reviewdog] reported by reviewdog 🐶
Abbreviation in name 'GPA' must contain no more than '1' consecutive capital letters.

package com.codefortomorrow.advanced.chapter15.solutions;

import java.util.Arrays;

Copy link

Choose a reason for hiding this comment

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

[reviewdog] reported by reviewdog 🐶
Member name 'GPA' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9]*$'.


/*
Create a Measurable interface
that is used to “measure” anything. Add necessary methods.
Copy link

Choose a reason for hiding this comment

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

[reviewdog] reported by reviewdog 🐶
Abbreviation in name 'GPA' must contain no more than '1' consecutive capital letters.


/*
Create a Measurable interface
that is used to “measure” anything. Add necessary methods.
Copy link

Choose a reason for hiding this comment

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

[reviewdog] reported by reviewdog 🐶
Parameter name 'GPA' must match pattern '^a-z?$'.

// add() method from SinglyLinkedList DIY section, adds to end of list
public void add(int data) {
// Create a new node with given data
Node new_node = new Node(data);
Copy link

Choose a reason for hiding this comment

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

[reviewdog] reported by reviewdog 🐶
'method def' child has incorrect indentation level 4, expected level should be 8.

// add() method from SinglyLinkedList DIY section, adds to end of list
public void add(int data) {
// Create a new node with given data
Node new_node = new Node(data);
Copy link

Choose a reason for hiding this comment

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

[reviewdog] reported by reviewdog 🐶
Local variable name 'new_node' must match pattern '^a-z?$'.


// If the Linked List is empty,
// then make the new node as head
if (head == null) {
Copy link

Choose a reason for hiding this comment

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

[reviewdog] reported by reviewdog 🐶
'if' has incorrect indentation level 4, expected level should be 8.

// If the Linked List is empty,
// then make the new node as head
if (head == null) {
head = new_node;
Copy link

Choose a reason for hiding this comment

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

[reviewdog] reported by reviewdog 🐶
'if' child has incorrect indentation level 8, expected level should be 12.

// then make the new node as head
if (head == null) {
head = new_node;
}
Copy link

Choose a reason for hiding this comment

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

[reviewdog] reported by reviewdog 🐶
'if rcurly' has incorrect indentation level 4, expected level should be 8.

@JJ27 JJ27 merged commit 1701891 into master Nov 21, 2020
@JJ27 JJ27 deleted the neha-practice branch November 21, 2020 22:42
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