Results 1 to 4 of 4
  1. #1
    msixty is offline Member
    Join Date
    Apr 2009
    Posts
    6
    Rep Power
    0

    Unhappy I really need help

    Im supposed to design an object oriented application using Java, The application will be used to test a virtual computer. The virtual computer will be made up of various components, each of which will be given a performance index. This index will be used to calculate a performance score for the virtual computer

    This application is intended to simulate an application which would be used to build your own computer.

    the base class will be Component class and the subclasses that will extend the base class will be the different items that can be inserted into a computer, for examlpe the hard drive, memory, mother board, etc. Each subclass will act as a parent class to other classes, for example, memory will inherit from the component class and the different types of memory available will inherit from the memory class.

    I have a hard part figuring out all the "Getters" which I must use to get the desired output:

    This is a piece of what Ive started with:

    Java Code:
    Class Components {
    	String type = "Component";
    	String Hardware = "Component";
    	
    	String get Type() {
    	retuen type;
    	}
    
    	String getHardware() {
    
    	}
    }
    
    class MotherBoards extends components {
    	String type = "Mother Boards";
    
    	String get Type() {
    	retuen type;
    	}
    }
    
    class Acer extends MotherBoards {
    	String type = "Acer Mother Boards";
    	String Spec[] = {“400”, “INtel slot”, “350watts power”};
    	String get Type() {
    	retuen type;
    	}
    }
    
    class Intel extends MotherBoards {
    	String type = "Intel Mother Boards";
    
    	String get Type() {
    	retuen type;
    	}
    }
    
    class Gigabyte extends MotherBoards {
    	String type = "Gigabyte Mother Boards";
    
    	String get Type() {
    	retuen type;
    	}

  2. #2
    mtyoung is offline Senior Member
    Join Date
    Dec 2008
    Location
    Hong Kong
    Posts
    473
    Rep Power
    6

    Default

    if all getType method call are the same, you only need to define it in the base class

  3. #3
    Singing Boyo is offline Senior Member
    Join Date
    Mar 2009
    Posts
    552
    Rep Power
    6

    Default

    Also, the get Type() methods should not be get Type(), but getType(). Also, you may want to put a constructor in your Component class that takes parameters for the type/hardware. You would then create constructors within your other classes that call this constructor using super(type, hardware). BTW, your returns have typos, they are being spelled retuen.
    If the above doesn't make sense to you, ignore it, but remember it - might be useful!
    And if you just randomly taught yourself to program, well... you're just like me!

  4. #4
    CJSLMAN's Avatar
    CJSLMAN is offline Moderator
    Join Date
    Oct 2008
    Location
    Mexico
    Posts
    1,159
    Rep Power
    7

    Default Miss Spell?

    Java Code:
    retuen type;
    "return" is misspelled in all the program.

    Luck,
    CJSL
    Chris S.
    Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •