Skip to content

Added examples and adv. subdirectories #14

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 11 commits into from
Sep 27, 2020
Merged

Added examples and adv. subdirectories #14

merged 11 commits into from
Sep 27, 2020

Conversation

neha-peddinti
Copy link
Contributor

Examples for Ch. 13/14

Created chapter (example, practice, solutions) subdirectories for advanced.

Copy link
Contributor

@JJ27 JJ27 left a comment

Choose a reason for hiding this comment

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

Great Examples! I do not see any issues.

Don't really know what a negative sum is, but if it is just those power and multiplicative operations then it's all good. The iterative/recursive methods for those agree so I think that should be ok.

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/chapter14/examples/TryWithResources.java|2 col 1| 'import' should be separated from previous statement.
src/com/codefortomorrow/advanced/chapter14/examples/TryWithResources.java|2 col 15| Using the '.' form of import should be avoided - java.io..
src/com/codefortomorrow/advanced/chapter14/examples/TryWithResources.java|13 col 13| 'while' construct must use '{}'s.
src/com/codefortomorrow/advanced/chapter14/examples/TryWithResources.java|14 col 54| 'typecast' is not followed by whitespace.
src/com/codefortomorrow/advanced/chapter14/solutions/Bank.java|33 col 9| Distance between variable 'account2' 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/chapter14/solutions/Bank.java|44 col 5| Missing a Javadoc comment.
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/advanced/chapter14/solutions/Bank.java|66 col 9| 'if' construct must use '{}'s.
src/com/codefortomorrow/advanced/chapter14/solutions/Bank.java|77 col 1| Top-level class NotEnoughMoneyException has to reside in its own source file.
src/com/codefortomorrow/advanced/chapter14/solutions/Average.java|3 col 15| Using the '.' form of import should be avoided - java.io..


public static void main(String[] args) {
System.out.println("Iterative:");
int a = 50, b = 40;

Choose a reason for hiding this comment

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

[reviewdog] reported by reviewdog 🐶
Each variable declaration must be in its own statement.

public static void main(String[] args) {
System.out.println("With iterative function:");

int a = 72, b = 20;

Choose a reason for hiding this comment

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

[reviewdog] reported by reviewdog 🐶
Each variable declaration must be in its own statement.


int a = 72, b = 20;
while (a != b) {
if (a > b) a -= b; else if (b > a) b -= a;

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' construct must use '{}'s.


int a = 72, b = 20;
while (a != b) {
if (a > b) a -= b; else if (b > a) b -= a;

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' construct must use '{}'s.


int a = 72, b = 20;
while (a != b) {
if (a > b) a -= b; else if (b > a) b -= a;

Choose a reason for hiding this comment

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

[reviewdog] reported by reviewdog 🐶
Only one statement per line allowed.


import java.io.*;

public class FileIO {

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 'FileIO' must contain no more than '1' consecutive capital letters.

in = new FileInputStream(file);
out = new FileOutputStream("names_upper.txt");
int c;
while ((c = in.read()) != -1) out.write(

Choose a reason for hiding this comment

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

[reviewdog] reported by reviewdog 🐶
'while' construct must use '{}'s.

System.out.println("An IO Exception occurred.");
e.printStackTrace(); // Prints error output stream.
} finally {
if (in != null) in.close();

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' construct must use '{}'s.

e.printStackTrace(); // Prints error output stream.
} finally {
if (in != null) in.close();
if (out != null) out.close();

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' construct must use '{}'s.

}

public static void call(String s) throws MyException {
if (s == null) throw new MyException();

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' construct must use '{}'s.

@JJ27 JJ27 merged commit 4ca5749 into master Sep 27, 2020
@JJ27 JJ27 deleted the neha-practice branch September 27, 2020 16:15
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