Skip to content

Conversation

@buddiex
Copy link

@buddiex buddiex commented Jun 5, 2017

Assignment completed

@buddiex buddiex changed the title completed Assignment 2 (Programming Methodology)- Omigie Osayamen Jun 9, 2017
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.

* This file is the starter file for the FindRange problem.
*/

import acm.program.*;

Choose a reason for hiding this comment

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

Great solution. However you missed one edge case:

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.

So if for example the user enters 0 the program should report:
No values has been entered.
Your program instead reports:
Smallest: 0
Largest: 0

*/

import acm.program.*;

Choose a reason for hiding this comment

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

Excellent solution.

public class Hailstone extends ConsoleProgram {
public void run() {
/* You fill this in */
println("This program finds the largest and smallest numbers");

Choose a reason for hiding this comment

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

I assume you copied this from the Find Range problem because it is not true that this program finds the largest and smallest numbers.

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.

Excellent solution.


private GRect createLabelledBox(String content, int x, int y) {
GLabel label = new GLabel(content);
// label.setFont("Times-72");

Choose a reason for hiding this comment

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

Commented out code should be deleted.

import java.awt.*;


public class Pyramid extends GraphicsProgram {

Choose a reason for hiding this comment

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

Excellent solution.


import acm.program.*;

public class PythagoreanTheorem extends ConsoleProgram {

Choose a reason for hiding this comment

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

Excellent solution.

import java.awt.*;


public class Target extends GraphicsProgram {

Choose a reason for hiding this comment

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

Program works well...just a few coding techniques need to be changed.

public void run() {
/* You fill this in. */

double radius_1 = 72;

Choose a reason for hiding this comment

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

The radius should have been declared as constants outside of the run method, also you should have named them outer_radius, middle_radius and inner_radius, that way someone knows which radius corresponds to which circl. So something like

private static final double OUTER_RADIUS= 72;
private static final double MIDDLE_RADIUS = OUTER_RADIUS * 0.65;
private static final double INNER_RADIUS = OUTER_RADIUS * 0.3;

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