M Ford

+ Follow
since Mar 06, 2012
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by M Ford

Thank you guys for pointing me out to the right direction. I'm such a nooby its hard when somebody replies with a solutions as someone who is an expert at this and I'm only on Chapter 5 of the book. Anyhow, comparing my solution to yours... I'm not ever close lol. Trying to figure to that infinity thing tho. Also, I don't get that font size thing... not sure if up to chapter 5 of the book have covered that yet.
8 years ago
Hi guys

I'm going through CS106A(Programming Methodology) course from iTunes where in the The Art & Science of Java book associated with the course, there is an exercise called Checkers.

Below is that exercise and as you can see, I've completed the program but not as polished as I hope.

I am using Eclipse and had no Programming Knowledge prior to this course.


How do get rid of the circles or blank checkers from the white squares?

Also how do I make the checkers smaller and centred in each black squares?

Thank you guys.
9 years ago
Hi guys

Could someone who has done or is doing CS106A course probably via iTunesU The Art & Science of Java help me out with this?

Preferably someone who knows CS106A one way or another as then you know what this course is all about and what I am talking about. This course is called Programming Methodology and I have no knowledge of computer programming prior.

Basically this exercise consist of GraphicsProgram and GLabel where I have to write a program that simulates a news headline display by moving a GLabel across the screen.

I am doing this from iTunesU so everything I know is from that course. I am using Eclipse.

Below is what I've managed to achieve so far but its not doing what I hope to achieve. For example I can't get the GLabel to scroll from the left hand side. Instead it just appears on screen and then moves to the right. Also once it gone off the window screen, I can't get it to loop. I have tried different statements and below is the closest one I've come out with to achieve this task.

* FILE: NewsHeadline.java
* -----------------------
* This program simulates news headline display by moving a GLabel
* across the screen. The headline initially begins to appear at the
* top right edge of the screen and then moves quickly from right to
* left. This program should be created containing the headline and then
* position it so the entire text of the label is clipped beyond the right
* edge of the screen. It should then execute an animation loop that moves
* the GLabel a few pixels to the left on each time step. After a few time
* steps, the display will display the first letter of the headline.

import acm.graphics.*;
import acm.program.*;

public class NewsHeadline extends GraphicsProgram {
public void run(){

//Setting the starting point of the message
int dx = 0;
int dy = 100;

GLabel msg = new GLabel("DEWEY DEFEATS TRUMAN", dx,dy);

//Getting the message to move//
for(int i=0; i<N; i++){



/*Private constants*/

private static final int PAUSE_TIME = 200;
private static final int N = 10; //Number of repeats//



I'm not quite sure if I am actually on the right track to achieve this specific exercise or way off and I much appreciate it if someone could point me out to the right direction. I've done a bouncing ball exercise but that exercise uses GOval and it seems to be different to GLabel.
9 years ago
Hi guys, Im a little stuck with this one. Im doing this Java programming using the book The Art & Science of Java by Eric Roberts.

Basically what this program should achieve is that the user enters in a list of integers, one line at a time, and keep going until the SENTINEL(in this case 0) is called. When the SENTINEL is called, the program "SHOULD" takes a look back at all the integers entered and displays the LARGEST of them all.

I think if you see below, I shouldn't think I'm that far off but can anyone help me out and point out what exactly that I am missing from what you can see below:

At the moment, what mine displays is the last integer entered instead of the Largest integer in the list.

Any input is much appreciated.
9 years ago
Thank you very much for your help.. finally got it.
9 years ago
I understand how to get the average. I've tried different ways to add how many times an integer is entered so I can divide the total by that but I just cant seem to figure it out. Tried creating another integer outside the loop but which ever way I do it, instead of adding how many times the integers are being added, it just adds the value for them instead.
9 years ago
sorry but as you can gather i am a complete novice at this... can you show me the syntax for that?
9 years ago
Hi guys.

Im trying to figure out The AverageList exercise and I think I've got it but just missing that last final piece in the puzzle. I cant think of what to do from here..

I know the int average = total/value; is wrong but i just cant figure out how to get the average. I can add the exam scores together.....

Could anybody help me out with this one? Any input is much appreciated.

[HENRY: Added code tags]
9 years ago

Meaty Chi wrote:Finally I have it, well almost:

I am still having problems appending the text "The number reversed is " without it printing it out four times.

I have tried


neither produce:

"The number reversed is 9271"


Well thank you for your solutions as I just could not figure it out without assessing your solution but to answer your question, I've managed to modify your solutions slightly and as you can see, the finish product did indeed show 9271

*File: ReverseDigits.java

import acm.program.*;

public class ReverseDigits extends ConsoleProgram{
public void run(){
println("This program generates the number that has the same digits in the reverse order.");
int n = readInt("Enter a positive integer: ");
int a = n % 10;
int b = n % 100;
int c = n % 1000;
int d = n % 10000;
int num1 = a;
int num2 = (b-a)/10;
int num3 = (c-b)/100;
int num4 = (d-c)/1000;

println("The same digits in the reverse order is " + num1 + num2 + num3 + num4);


9 years ago