Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / March 2004

Tip: Looking for answers? Try searching our database.

source code for a program

Thread view: 
GM - 10 Mar 2004 03:47 GMT
Hello.  I am starting my 7th week of an intro to programming class and have
a problem I have been working on.  My instructor said we could look for
source code on the internet and use it as long as we tailor it to fit the
problem at hand.  I have not been able to attack this one with any kind of
success!  Does anybody know of a URL that I can get a similar source code
for the following problem?  Any help would be GREATLY appreciated.  Thanks.

Create class SavingsAccount.  Use static variable annualInterestRate to
store the annual interst rate for all account holders.  Each object of the
class contains a "private" instance variable savingsBalance indicating the
amount the saver currently has on deposit.  Provide method
calculateMonthlyInterest to calculate the monthly interest by multiplying
the savingsBalance by annualInterstRate divided by 12; this interest should
be added to savingsBalance.  Provide a static method modifyInterstRate that
sets the annualInterstRate to a new value.  Write a program to test class
SavingsAccount.  Instantiate two savingsAccount objects, saver1 and saver2,
with balances of $2000.00 and $3000.00, respectively.  Set annualInterstRate
to 4%, then calculate the monthly interest and print the new balances for
both savers.  Then set the annualInterestRate to 5%, calculate the next
month's interest, and print the new balances for both savers.

--GM
Andrew Thompson - 10 Mar 2004 04:13 GMT
> Hello.  I am starting my 7th week of an intro to programming class and have
> a problem I have been working on.  My instructor said we could look for
> source code on the internet and use it as long as we tailor it to fit the
> problem at hand.  

Your instructor is an idiot.  
Ask for a full refund of all
moneys paid.

What is the teaching institution?
I will have to note not to recommend
it to anyone.

[ If you wish to learn Java,
feel free to come back here
with specific questions. ]

Signature

Andrew Thompson
* http://www.PhySci.org/ Open-source software suite
* http://www.PhySci.org/codes/ Web & IT Help
* http://www.1point1C.org/ Science & Technology

Paul O'Donnell - 10 Mar 2004 07:50 GMT
>> Hello.  I am starting my 7th week of an intro to programming class and
>> have a problem I have been working on.  My instructor said we could
[quoted text clipped - 12 lines]
> feel free to come back here
> with specific questions. ]

I don't agree. I think that taking other people's code and modifying it to
solve the problem at hand is a wonderful way to learn. It is not always
necessary to reinvent the wheel every time. How many programmers, now be
honest, could come up with some of the more complicated sorting algorithms
that are an important part of many programs? If I need the best sorting
algorithm, for my particular problem, I will either use a method in the
Java API or I will look it up in Knuth's Art of Computer Programming. The
important thing when incorporating other people's code is that you
UNDERSTAND the code. Look at different algorithms that accomplish the same
task and study them so you may gain an understanding of why one method is
more efficient than another. There are copyright concerns that should be
respected, but nobody has the right to "own" the "Hello, World!"
algorithm.

If you need help come here. Tell us what you are trying to do, be specific
and maybe someone will be able to help you find some sample code. And if
you have already made some progress on your own, show the group and
hopefully that will lessen the chance of being flamed by someone who
doesn't understand that you are trying to learn.

Once I was working on a project and I wanted to explore parsing. I asked
the newsgroup for some code written in Java for a recursive decent parser,
as I was having some trouble getting my head around some C code that I
had. I was flamed big time. I was accused of being a student who wanted
help with homework. The truth is I am not a student (not formally), I am
just a guy who is unemployed due to an illness and I like to play around
with code and learn as much as I can. I've learned a lot over the years
and I am not ashamed to admit I've learned from other peoples code. Does
anyone actually own the code for a recursive decent parser? I don't think
so.

Paul
Andrew Thompson - 10 Mar 2004 08:03 GMT
> ..The
> important thing when incorporating other people's code is that you
> UNDERSTAND the code.

A process which starts with writing some.

Signature

Andrew Thompson
* http://www.PhySci.org/ Open-source software suite
* http://www.PhySci.org/codes/ Web & IT Help
* http://www.1point1C.org/ Science & Technology

Ryan Stewart - 10 Mar 2004 12:56 GMT
> > ..The
> > important thing when incorporating other people's code is that you
> > UNDERSTAND the code.
>
> A process which starts with writing some.

On top of which, this guy asked this same question in comp.lang.java some
seven hours earlier than his post here. I told him he'd be better off
learning to code than looking for someone's code to copy, and that if he at
least made an attempt at coding something, he could come here for help when
he got stuck. Instead he copied his whole post verbatim from c.l.j and
posted it here.
Paul O'Donnell - 10 Mar 2004 13:42 GMT
Usenet is full of judgemental people who have nothing better to do than
police people who post to more than one newsgroup. Yawn.

We don't even know what sort of code he/she is looking for yet. If he does
post with more detail I am willing to help him if I can. Why the
assumption that he is not writing code? We don't know that. All we know is
that he is looking for some source code to solve a problem. What he is
looking for may be very complicated and he is stuck and trying to learn. I
give him the benefit of the doubt.
Paul O'Donnell - 10 Mar 2004 14:01 GMT
> Usenet is full of judgemental people who have nothing better to do than
> police people who post to more than one newsgroup. Yawn.
[quoted text clipped - 5 lines]
> is looking for may be very complicated and he is stuck and trying to
> learn. I give him the benefit of the doubt.

I am sorry. There is something wrong with my newsreader and I initially
did not see the entire original post. I only saw the first paragraph. Now
that I have seen it I would say that his very well defined task is not the
sort of programming problem that should require the borrowing and
modification of someone else's code. He should just get started solving
the problem himself, post what he is able to do and hopefully someone in
the group can help him if he gets stuck. If the problem is too much for
him then he needs to go over his notes or the textbook and review. If that
is too much for him then perhaps he should reconsider his ability to be a
programmer. The problem is fairly simple and should not be all that
daunting to someone who has been programming Java for 7 weeks. And to the
person who called his instructor and "idiot" is right, if in fact the
instructor said it was ok to look for other people's code in this
particular context.

My apologies for the flame. I was only wanting to defend someone I thought
had been treated unfairly, but now I can see that much of the criticism
was fair.

I've made myself look like an idiot on Usenet yet again. <blush>

Paul
Ryan Stewart - 11 Mar 2004 00:37 GMT
> > Usenet is full of judgemental people who have nothing better to do than
> > police people who post to more than one newsgroup. Yawn.
[quoted text clipped - 28 lines]
>
> Paul
Heh, no problem. Happens to us all. Or at least to you and me. Basically
what you said in your last post is exactly what I told him: the problem
isn't that hard; work on it, and if you have problems, post here.
Andrew Thompson - 11 Mar 2004 01:59 GMT
> "Paul O'Donnell" <odonnellp@rogers.com> wrote in message
>> ...There is something wrong with my newsreader and I initially
>> did not see the entire original post. I only saw the first paragraph.
<snip>..
> Heh, no problem. Happens to us all.
> Or at least to you and me.

I'll 'third' that.

Glad we arrived at a common understanding.
..Wonder where the OP's gone?    ;-)

Signature

Andrew Thompson
* http://www.PhySci.org/ Open-source software suite
* http://www.PhySci.org/codes/ Web & IT Help
* http://www.1point1C.org/ Science & Technology

Ryan Stewart - 11 Mar 2004 02:05 GMT
> > "Paul O'Donnell" <odonnellp@rogers.com> wrote in message
> >> ...There is something wrong with my newsreader and I initially
[quoted text clipped - 7 lines]
> Glad we arrived at a common understanding.
> ..Wonder where the OP's gone?    ;-)

Maybe he took the hint this time? :) It would be nice to see him back asking
about some code.
Andrew Thompson - 11 Mar 2004 02:21 GMT
> "Andrew Thompson" <SeeMySites@www.invalid> wrote in message
..
>> ..Wonder where the OP's gone?    ;-)
>>
> Maybe he took the hint this time? :) It would be nice to see him back asking
> about some code.

Yeah it would.  I doubt it
will happen though.

Signature

Andrew Thompson
* http://www.PhySci.org/ Open-source software suite
* http://www.PhySci.org/codes/ Web & IT Help
* http://www.1point1C.org/ Science & Technology

GM - 12 Mar 2004 02:03 GMT
> > Maybe he took the hint this time? :) It would be nice to see him

> > back asking about some code.

> Yeah it would. I doubt it

> will happen though.

OK, I've let all of you have your fun throwing mud, let me post a reply.
First, I agree with a lot of what everyone said in reply to my post. I am in
my first semester of programming. The way I am being taught is to learn
through reusing code. My instructor told us all that that is the direction
programming is heading and that there is nothing wrong with that. All of our
exercises are based off of code that he has already given us. We just modify
it. Right, wrong, or indifferent that is how I am learning...maybe not that
well or else I'd be able to write this program without any problem. I'm sure
in the grand scheme of things, it IS a fairly easy program to write. I also
have him as an instructor for pre-calculus. He has the same beliefe with
that class -- if you can get the job done with a calculator, then there is
no sense in learning the long method by hand. So on our tests, there is very
little work shown to him because we all have graphing calculators. My
programming tests are all multiple choice questions about what classes do or
what a certain string would do in a program. Not that hard -- just look it
up in the text book or type it in on the computer. Now, about the project he
assigned this week. Everyone got a different one, and most people got
assigned something like drawing random boxes on the screen or something that
is easily found on the internet. So that is exactly what the rest of the
students did -- got it off of the internet and modified it a little to suit
their needs. I am not saying he is a bad teacher. He has been doing it for
many years and I'm sure he has made some really good programmers. Maybe that
is just not my style of learning. This programming language is one of the
more basic languages out there, but a lot of it still looks greek to me even
after looking through the book and notes. I have been spending time looking
at it and trying to figure it out, and it is just not coming. If I didn't
have a deadline coming, I would not have asked for help on here. But at any
rate, my intention was not to start a string of comments like I did. Thanks
for your insight.
Andrew Thompson - 12 Mar 2004 02:55 GMT
>>> ...It would be nice to see him
>>> back asking about some code.
..
>> Yeah it would. I doubt it
>> will happen though.
>
> OK, I've let all of you have your fun throwing mud, let me post a reply.
<snip yada, yada, yada>

And your *code*??

I will point out that I have a complete
GUI'd ATM that does similar things you
were asking, but no interest calcs.

Some of the reasons I did _not_
point it out to you are..
a) I suspect it is overkill for what
you want (the code is 1394 lines)
b) It would have you coming back
asking 'what lines do I change
to make it calculate interest, and
what changes do I make?'

That is just not how (this) group
operates.  People who help here have
had to work beside, or correct the
code of, too many clueless individuals
who got through their course on
'borrowed code'.

I disagree vehemently with your
instructors approach, and making
assurances here that that is how
he/she does it will get you nowhere
(we care about helping people to learn
Java, but not the slightest bit about
this instructors dubious teaching methods).

Do something useful for yourself,
write _some_ code, and ask a specific
question, otherwise, take it back to
the instructor.

BTW - you still have not mentioned
which school/institution this is.

Signature

Andrew Thompson
* http://www.PhySci.org/ Open-source software suite
* http://www.PhySci.org/codes/ Web & IT Help
* http://www.1point1C.org/ Science & Technology

GM - 12 Mar 2004 03:10 GMT
> BTW - you still have not mentioned
> which school/institution this is.

I don't plan on it.  It is a large one.  Thank you for your help.  I DO plan
and always HAVE palnned on continuing to grow in my studies and grasp this
the best I can.
Andrew Thompson - 12 Mar 2004 03:45 GMT
>> BTW - you still have not mentioned
>> which school/institution this is.
..
> I don't plan on it.  

To protect them, or yourself?

[ To be quite blunt, I do not now,
and never did, accept your claim
that your instructor OK'd this.

If it is indeed true, I feel an
obligation to advise the instructor's
employer of the p**s-poor job they
are doing. ]

> ..It is a large one.  

If true, that is a distinct worry.

>..Thank you for your help.  I DO plan
> and always HAVE palnned on continuing to grow in my studies and grasp this
> the best I can.

Good.  So why do you not follow the
advice we have been giving you, and
present some code?

We *would* be happy to answer
specific questions you have.

Signature

Andrew Thompson
* http://www.PhySci.org/ Open-source software suite
* http://www.PhySci.org/codes/ Web & IT Help
* http://www.1point1C.org/ Science & Technology

Ryan Stewart - 12 Mar 2004 03:13 GMT
> OK, I've let all of you have your fun throwing mud, let me post a reply.
> First, I agree with a lot of what everyone said in reply to my post. I am in
[quoted text clipped - 25 lines]
> rate, my intention was not to start a string of comments like I did. Thanks
> for your insight.

That may be the worst teaching method I've ever heard. I hope you manage to
learn what you need, because it sounds like you could get through his
coursing without knowing much at all, and that will kill you later. He's
either lazy, short-sighted, or totally clueless to say that you don't need
to know the principles of calculus, not to mention computer programming. His
definition of code reuse also sounds way off.
Alex Hunsley - 14 Mar 2004 00:48 GMT
>>OK, I've let all of you have your fun throwing mud, let me post a reply.
>>First, I agree with a lot of what everyone said in reply to my post. I am
[quoted text clipped - 80 lines]
> to know the principles of calculus, not to mention computer programming. His
> definition of code reuse also sounds way off.

Agreed.

Either the OP is lying when he claims that his tutor said this form of
"re-use" (!!) was ok, or his tutor is a bit hopeless...

Out of interest, I googled for the problem descrition, and located this:

http://www.cs.rpi.edu/~puninj/JAVA/tests/esum98.html

Looks like the source of this question. Whether this institution has
anything to do with the homework in question is anyones guess.

alex
Andrew Thompson - 14 Mar 2004 01:34 GMT
> Out of interest, I googled for the problem descrition, and located this:
>
> http://www.cs.rpi.edu/~puninj/JAVA/tests/esum98.html
>
> Looks like the source of this question. Whether this institution has
> anything to do with the homework in question is anyones guess.

Why guess?  I put it to John.
<http://www.cs.rpi.edu/~puninj/>

Awaiting a reply..

Signature

Andrew Thompson
* http://www.PhySci.org/ Open-source software suite
* http://www.PhySci.org/codes/ Web & IT Help
* http://www.1point1C.org/ Science & Technology

Alex Hunsley - 17 Mar 2004 17:52 GMT
>>Out of interest, I googled for the problem descrition, and located this:
>>
[quoted text clipped - 7 lines]
>
> Awaiting a reply..

heheh! let me know what he says. I found that page also when I was
looking about that site!

alex
Alex Hunsley - 17 Mar 2004 17:53 GMT
[snip lack of my snipping a quoted post]

ack! whassa wrong with me? I should have snipped more in that last post.
10 lashes!

alex
Tom - 10 Mar 2004 13:45 GMT
It seems to me that the problem is pretty well defined.  It shouldn't
be that hard to create the code yourself.  In fact, it might be easier
than trying to modify someone else's code to fit the problem.

> Hello.  I am starting my 7th week of an intro to programming class and have
> a problem I have been working on.  My instructor said we could look for
[quoted text clipped - 18 lines]
>
> --GM


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.