Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

>> REGISTER NOW TO START POSTING

1. ## Inheritance program help

I have to write is program and I have no idea where to start with it. I'm not that good at java which is why i'm seeking help.

Write a Java program to simulate the operation of the four basic gates (AND, OR, NAND, NOR), USING the principles of INHERITANCE.
a. The Gates SuperClass has 2-Inputs and 1-Output.
b. The three individual SubClasses inherit the number of Inputs [a, b] and Output [c] from the SuperClass (Gates).
c. The four SubClass gates have their own specific and independent functions:

AND: a && b OR: a || b NAND: !( a && b) NOR: !(a || b )

could anyone please give me some code or basic directions on how I should start this it would be greatly appreciated

2. ## Re: Inheritance program help

basic directions
Ok
1)Write a Java program to simulate the operation of:
A)AND: a && b
B)OR: a || b
C)NAND: !( a && b)
D)NOR: !(a || b )
2)Using:
A)the principles of INHERITANCE
B)The Gates SuperClass has 2-Inputs and 1-Output.
C)The three individual SubClasses inherit the number of Inputs [a, b] and Output [c] from the SuperClass (Gates).
D)The four SubClass gates have their own specific and independent functions:
Before you begin
Define INHERITANCE in Java.
Turn the instructions into pseudo-code

3. ## Re: Inheritance program help

my main confusion with the assignment is what the purpose of this is and what the outcome should look like. From what I understand I'm creating a Superclass called Gates and AND OR NAND NOR will all be subclasses and that I should extend them using keyword.

4. ## Re: Inheritance program help

my main confusion with the assignment is what the purpose of this is
Instructors get a pay-raise every time someone asks that question on a forum. It is like a bonus.
what the outcome should look like
What did the instructions say the output should look like? ... Exactly like that.
From what I understand I'm creating a Superclass called Gates and AND OR NAND NOR will all be subclasses and that I should extend them using keyword.
Sounds like a plan. Does this plan solve the problem while following all of the rules?