Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Adding Recursive Method to an existing file
Old
CaliforniaBoy5
Guest
 
Status:
Posts: n/a
Default Adding Recursive Method to an existing file - 03-08-2010, 05:06 AM

Hello,
As a team project, we (I) need to add a recursive method to our current file but I am need some ideas on how and what to add. I haven't added a recursive method as of yet but if I maybe had a direction to go in I could try to make it work?

Can anyone give me an idea on what would be a nice simple recursive method to add to this and a hint on how to accompish it?? I really really would appriciate it. Are donations allowed to the community? I've read some great stuff on here that have helped me with my hmwk.

This is the synopsis for the file...
"Farmer Brown has a problem. His cows like to type. All day long he hears Click, Clack, moo. Click, clack, moo. Clickety, clack moo.
At first, he couldn't believe his ears. "Cows that type?" "Impossible!" Click, Clack moo. Click, clack moo. Clickety, clack moo. Then, he couldn't believe his eyes. (a note on the barn door stating Dear Farmer Brown, The barn is very cold at night. We'd like some electric blankets. Sincerely, The Cows. It was bad enough the cows had found the old typewriter in the barn, now they wanted electic blankets! “No way”, said Farmer Brown. “No electric blankets” So the cows went on strike they left a note on the barn door. Sorry. We’re closed No milk today. “No milk today!’ cried Farmer Brown. In the background, he heard the cows busy at work: Click, clack moo. Click, clack, moo. Clickety, clack, moo. The next day, he got another note: Dear Farmer Brown, The hens are cold too. They’d like electric blankets. Sincerely The Cows. The cows ere growing impatient with the farmer. They left anew note on the barn door. Closed. No Milk. No eggs. “No eggs!” cried Farmer Brown. In the background he heard them. Click, Clack, moo. Click, clack, moo. Clickety, clack moo. “Cows that type. Hens on strike!” Whoever heard of such a thing? How can I run a farm with no milk and no eggs!” Farmer Brown was furious. Farmer Brown got out his own typewriter. Dear Cows and Hens: There will be no electric blankets you are cows and hens. I demand milk and eggs. Sincerely, Farmer Brown. Duck was a netutral party, so he brought the ultimatum to the cows. The cows held an emergency meeting. All the animals gathered around the barn to snoop, but none of them could understand MOO. All night long, Farmer Brown waited for an answer. Duck knocked on the door early the next morning. He handed Farmer Brown a note: Dear Farmer Brown, We will exchange our typewriter for electric blankets. Leave them outside the barn door and we will send Duck over with the typewriter. Sincerely The Cows. Farmer Brown decided this was a good deal. He left the blankets next to the barn door and waited for Duck to come with the typewriter. The next morning he got a note: Dear Farmer Brown, The pond is quite boring We’d like a dving board Sincerely, The Ducks. Click, clack, quack. Click, Clack, quack. Clickety, clack, quack."
Attached Files
File Type: a2w Cows That Type.a2w (6.43 MB, 41 views)
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 03-08-2010, 07:21 AM

For a recursive method, you could have a method called typeCow which has the barn say "Click Clack Moo" and increments a number variable by one, then calls itself again if the number variable is less than how many times you want the method to be called.


(')>
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2023, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.