![]() |
|
#1
|
|||
|
|||
Calculator Java ClassHello all I am a newcomer to the Java programming scene and I need help desperately with writing this class. This is the prompt given:
You will write an integer Calculator class. This Calculator will have the add, subtract, multiply, divide, power, clear, and getTotal() methods. However, you will not be allowed to use the multiplication (*), division (/) or power method of the Math class to write these methods, but will instead write loops using the add and / or subtract methods for the multiply, divide, and power methods. I know how to do this the quick way without the loops but the whole loop thing is throwing me off and I do not know where to begin. I have to have at least done most of it by tomorrow. Please help. |
|||
|
#2
|
|||
|
|||
Re: Need help ASAP with Calculator Java Class PLZ !Sorry this was also added:
|
|
#3
|
|||
|
|||
Re: Need help ASAP with Calculator Java Class PLZ !Go ahead and post what you have so far. Here is how I would do some of it:
JAVA Code:
|
|
#4
|
|||
|
|||
Re: Need help ASAP with Calculator Java Class PLZ !Thank you so much fakepoo! Right now I am studying for Linear Algebra midterm which I need to ace to get a B at least. I had something similar to what you posted so I'm sorry to say I don't have much different in my code compared to yours. For me loops are very confusing and I've tried but I'm afraid I don't have the time to take a crash course in it now. College leaves me with so little time. This is an extra credit assignment which will really help me out a lot so if maybe someone can contribute I would forever be appreciative and would try to give back in any way possible. Thank you guys so much.
|
|
#5
|
|||
|
|||
Re: Need help ASAP with Calculator Java Class PLZ !fakepoo I am receiving an error from your code. It says int Result should be int Result = 0 because it is not "initialized". I changed it to intResult = 0. That should be fine right? Once again thank you and if other can help I would be greatly appreciated!
|
|
#6
|
|||
|
|||
Re: Need help ASAP with Calculator Java Class PLZ !Yes, it should be initialized to zero. I just happened to miss it.
|
|
#7
|
|||
|
|||
Re: Need help ASAP with Calculator Java Class PLZ !Please help ! =/
|
|
#8
|
|||
|
|||
Re: Need help ASAP with Calculator Java Class PLZ !What do you have so far? You should implement the Divide() method very much the same as the Multiply() method. Post your code and ask specific questions.
|
|
#9
|
|||
|
|||
Re: Need help ASAP with Calculator Java Class PLZ !JAVA Code:
Last edited by admin : 25-Mar-2008 at 21:41.
Reason: Please insert your example Java codes between [JAVA] and [/JAVA] tags
|
|
#10
|
|||
|
|||
Re: Need help ASAP with Calculator Java Class PLZ !thats what i have after no sleep and working on it hard...is that good? i think im done
|
Recent GIDBlog
New Corolla Altis, 10th Generation - Part I by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Returning a Struct to a separate class | usmsci | CPP / C++ Forum | 9 | 07-Feb-2007 08:34 |
| Hard drive/CPU Diagnoses Issues | binarybug | Computer Hardware Forum | 1 | 22-Jan-2007 19:23 |
| Box Class, need help again :( | TransformedBG | CPP / C++ Forum | 7 | 13-Nov-2006 15:11 |
| C++ class -- Please help | vnca_1 | CPP / C++ Forum | 3 | 14-Jun-2006 12:31 |
| a tester class and then some. | postage | Java Forum | 1 | 06-May-2006 15:48 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The