Skip to content

Conversation

@Ahameed01
Copy link

No description provided.

Copy link

@abeprosper abeprosper left a comment

Choose a reason for hiding this comment

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

Great effort. I hope for future assignments you will be able to attempt all questions. Here is a link to your grade:
https://docs.google.com/document/d/1wAnW7AIuZm4eOW7u7SpwLjalPV0UMJMeG__VA2kBzTM/edit?usp=sharing

}

/*
* File: FindRange.java

Choose a reason for hiding this comment

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

Your program doesn't work correctly because you have an incorrect value of the SENTINEL. You set it to 20 instead of 0. Also it misses the following two edge cases:

If the user enters only one value before the sentinel, the program should report
that value as both the largest and smallest

and

If the user enters the sentinel on the very first input line, then no values have been
entered, and your program should display a message to that effect.

println("The minimum value is " +min);
println("The maximum value is " +max);
}
private static final int SENTINEL = 20;

Choose a reason for hiding this comment

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

This should be 0.

* Name:
* Section Leader:
* --------------------
* This file is the starter file for the Hailstone problem.

Choose a reason for hiding this comment

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

Great solution.


import acm.graphics.*;
import acm.program.*;
import java.awt.*;

Choose a reason for hiding this comment

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

I suppose you didn't have enough time to code this part. :(

}
}


Choose a reason for hiding this comment

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

Excellent solution.

/* You fill this in */
}
}
/*

Choose a reason for hiding this comment

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

Excellent solution.

/* You fill this in. */
}
}
/*

Choose a reason for hiding this comment

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

Great solution. Just a few technical issues.

public void run() {
/*
* This program draws an archery target
*/

Choose a reason for hiding this comment

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

These values should have been declared as constants outside of the run method. So something like:

private static final int INCH_TO_PIX = 72;
private static final double MAXI_RADIUS = 1 * INCH_TO_PIX;
private static final double MEDI_RADIUS = 0.65 * INCH_TO_PIX;
private static final double MINI_RADIUS = 0.3 * INCH_TO_PIX;

miniTarget.setFilled(true);
miniTarget.setColor(Color.RED);
add(miniTarget);
}

Choose a reason for hiding this comment

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

The operation to draw the circles should have been done in a method since they all share code. So something like this:

private void drawCircle(double centerX, double centerY, double rad, Color c) {
    GOval circle = new GOval(centerX - rad, centerY - rad, 2*rad, 2*rad);
    circle.setColor(c); 
    circle.setFillColor(c);
    circle.setFilled (true);
    add (circle);
}

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