HINT: start simple and build up. e.g. i) Basic class ii) add a method iii) return a value
Abdulhameed Usman wrote:I haven't done it before I have no idea on how to do it
Abdulhameed Usman wrote:I haven't done it before I have no idea on how to do it
Abdulhameed Usman wrote:Am I going to instantiate each gate before before returning each value
Abdulhameed Usman wrote:Am I going to instantiate each gate before before returning each value
Please check what is a method signature. And this tutorial. Please research a lot about your problem, about non known words to you yet. Once you have all information crammed and written on your note book, please ask which parts exactly are not clear about your assignment.Abdulhameed Usman wrote:As in how Argument data type??
Yes, primitive. Which one? There are few of them.Abdulhameed Usman wrote:Oh you mean the primitive data type
Liutauras Vilda wrote:Great. So please try as suggested earlier, create one method for the start with AND or OR operator, which takes 2 arguments and gives you an output of operation result.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
That was a few days ago, Thursday. You must not need to use true or false, but that could be a good point to start for you in order to start getting an idea, so you could satisfy the bottom instruction a bit later.Campbell Ritchie wrote:Can you simply use true/false?
Posted instructions wrote:It should accept binary input
I also could use 1 and 0, or even a pair of objects called ON/OFF or similar.Liutauras Vilda wrote:. . . Cambell Ritchie in his 2nd post mentioned, . . .
. . .Can you simply use true/false?
Winston Gutkowski wrote:
I don't want to criticise, or confuse Abdulhameed too much; but there is an alternative way of looking at this:
Create an empty Gate class.
Why? Because that's the one thing you know right at the start: A "gate" is something that processes a binary digit (or stream) in a specific way.
The 'NAND' (or 'AND' or 'XOR') simply tells you how it does it; but nothing is going to happen without the gate itself.
<snip other bits>
Each gate will be a method in your class (you should have one class for all the gates LogicGatesSimulator and a tester class)
Dave Tolls wrote:From the requirements in the first post:
So we're talking 6 methods, one per logic gate, with however many parameters that particular gate requires.Each gate will be a method in your class (you should have one class for all the gates LogicGatesSimulator and a tester class)
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Don't get me started about those stupid light bulbs. |