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


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Inheritance program help

  1. #1
    Junior Member
    Join Date
    Dec 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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. #2
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default 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. #3
    Junior Member
    Join Date
    Dec 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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. #4
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default 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?

Similar Threads

  1. Help with inheritance
    By jean28 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: November 8th, 2012, 12:07 AM
  2. Replies: 1
    Last Post: July 8th, 2012, 10:23 AM
  3. Inheritance
    By lewzax in forum Object Oriented Programming
    Replies: 4
    Last Post: July 8th, 2011, 01:51 PM
  4. inheritance help
    By justin3492 in forum Object Oriented Programming
    Replies: 3
    Last Post: September 30th, 2010, 07:45 PM
  5. inheritance
    By b109 in forum Java Theory & Questions
    Replies: 3
    Last Post: May 30th, 2010, 09:23 PM

Tags for this Thread