Page 1 of 1

I need help...literally

Posted: Tue Oct 25, 2005 9:02 pm
by jackie_r
Hey everyone'
I am brand new to this Basic programming and I have no idea what I am doing. I need help! My teacher doesn't help us with anything, she justs says you'll figure it out. But anyways I would be very grateful if someone would help me with this one problem in my book and please don't laugh at me I am new to this Basic programming: Thanks :D

Here's the problem :
Maria Maderas is thinking about starting a business selling pet rabbits. She currently has one pair of rabbits and would like to know approximately how many rabbits will be born during a given period of time. Assume that each female rabbit will reproduce every four months and that the litters will have an average of eight rabbits. Also assume that half of the rabbits are female. The program should allow Maria to enter a given number of months and then output the number of rabbits she should have by the end of that time period.
~That was out of Chapter 7 Loop Structures in QBasic Second Edition

If anyone could help me that would be wonderful! Thank you! :P :D

Posted: Wed Oct 26, 2005 2:50 am
by RayBritton
i can't help you but generally at this site (and probably most others) you will not get any help with homework

Posted: Wed Oct 26, 2005 4:44 am
by Seb McClouth
Let's be nice another time:

Code: Select all

print "Number of months: ";
input "",months%

if month%  =< 4 then
  goto display
else
  goto calculate
end if

calculate:

cmonths%=0

do
cmonths%=cmonths%+1
if cmonths%\4 = cmonths%/4 then
a%=cmonths%\4
b%=a%*8
end if
loop while cmonths%<months%

Display:
print "Rabbits by end of period: males: ";b%\2 ;" females: ";b%\2
My advice with other homework is: Read your book, more then once, redo programs you've already written and try to make things yourselfs, it works...

grtz & good luck

Posted: Wed Oct 26, 2005 8:02 am
by {Nathan}
Seb, when you said to do:

Code: Select all

print "Number of months: ";
input "",months% 
You do realize that you could have done

Code: Select all

INPUT "Number of months: ", months%
Instead? Also, I THINK that that makes it without a question mark, but if it doesnt then just change the "," after the string to a ";".

Posted: Wed Oct 26, 2005 8:17 am
by Seb McClouth
Well that's for jackie to find out... We're not gonna explain all our tricks... right? Same that the program isn't doing completly what it should. I do have the complete right with me... Jacky, if you post you're own attempt I'll tell ya if you're wrong or right...

grtz
Seb

Posted: Wed Oct 26, 2005 8:40 am
by matt2jones
Seriously, don't write up guys homework for them. That helps no-one. If they're teacher is seriously as incompetant as they say, the whole class will fail and something will be done about it, so if you help a few, the teacher will think she's teaching it fine and the students are fork up, and the whole class will suffer (speaking from personal experiance).

And if the teacher is good and the person is lazy you've just shown them how easy it is to get by exploiting other people... And the world we live in does not need more people learning that particular lesson.

Assuming they're going through the book chronolgicly (which doesn't alway happen), they've been doing this for a while. Unless loops are the first area of difficulty (and I doubt that from the preamble), posting up code with no-explanation will not help anyone understand, and will just encourage the people your trying to help, to copy.

Posted: Thu Oct 27, 2005 7:59 am
by Seb McClouth
You're right there. Say, Jackie... What do you actually not understand of programming? 'cause have you thought to yourselfs:"Is this want I want to do?"

I learned Basic without any book at first. I only had this build-in manual (a.k.a. help) of Qbasic v1.1. Later on I had a couple of books and tried to do things.

grtz
Seb

Posted: Thu Oct 27, 2005 1:10 pm
by Rattrapmax6
The problem may not be BASIC,. there is math there too... :P .. Tho basic math (No pun intended)...

Okay, yeah, what are you having problems with? :?:

Posted: Thu Oct 27, 2005 4:20 pm
by Nodtveidt
If you want an INPUT without the question mark, use LINE INPUT instead. :D

Posted: Thu Oct 27, 2005 4:25 pm
by Rattrapmax6
Nekrophidius wrote:If you want an INPUT without the question mark, use LINE INPUT instead. :D
ROFLOL,... *Ahem* ... :lol:

Posted: Thu Oct 27, 2005 6:57 pm
by {Nathan}
holy crap I completly forgot about line input for the last year and a half... i always just used the , and ; to control punctuation.

I need to go back and read the first 5 chapters of my old QB book...

to busy with java to do that.

Posted: Thu Oct 27, 2005 8:38 pm
by Rattrapmax6
You do know the difference between LINE INPUT and INPUT right, nath? It's not to controll puntuation if that's what your thinking.... =)

Posted: Sat Oct 29, 2005 7:35 pm
by Zamaster
*snickers* (no candy bars here)

Posted: Sun Oct 30, 2005 12:50 pm
by {Nathan}
Yeah, I know, but when I read about it in my QB book I didnt really care, and normal input as always done what I needed just fine.