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

    Unhappy Some one pls Help

    I've been asked to develop an object oriented application using Java which 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. Thi 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 the component class and the subclasses that will extend the base class will be the different items that can inserted into a computer, for example the hard drive, memory, mother board, etc. Each sub class will act as a parent class to other classes, for example, memory will inherit from the component class and the different types of memories available will inherit from the memory class.

    I'm begging anyone who can to please help me:(

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    You're question is a bit too general to be answered simply here in this forum. What I recommend that you do first:
    * read the instructions very carefully then reread the instructions, again carefully.
    * using what you know from this study of the problem, split this main problem up into several component subproblems. Do this on paper.
    * start tackling each subproblem individually, often this requires that you subdivide these problems some more.
    * come on back here if you have a specific question over one of these smaller subproblems.

    Wishing you much luck!

    edit: also, please realize that details matter here. I imagine that your actual instructions will have greater detail in how the components will be tested and all that. If not, please talk to your instructor to get as much specific instructions as you can get.

    Pete
    Last edited by Fubarable; 04-23-2009 at 01:53 PM.

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Also, you can build the "skeleton" of your classes first and build on from these. Something like:

    Java Code:
    public abstract class BaseComponent
    {
      // whatever all components require should be here
    }
    Java Code:
    public abstract class AbstractMemory extends BaseComponent
    {
      private long bytes
      public AbstractMemory()
      {
        bytes = 0;
      }
    
      public AbstractMemory(long bytes)
      {
        this.bytes = bytes;
      }
    
      // getters and setters
    }
    Java Code:
    public class RAM extends AbstractMemory
    {
    
      public RAM()
      {
        super();
      }
    
      public RAM(long bytes)
      {
        super(bytes);
      }
      
      // getters and setters go here
    }

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

    Default

    Thank you for replying and for the Skeleton code, I had already started defining my Classes and Subclasses which are similar to the example which you sent me. my only problem now is the Display method I should use in displaying the specific components which would be in the classes. Such as the specifications (RAM: DDR 512mb, Kingston, 144hz), which will be calculated in the performance index i.e. the Computer OPERATES @ 3.4Ghz processing speed
    Memory of 512mb
    Capacity of 200Gb

  5. #5
    msixty is offline Member
    Join Date
    Apr 2009
    Posts
    6
    Rep Power
    0

    Default

    This how I thouhgt my classes should look:

    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 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;
    }
    }

    class Processors extends components {
    String type = "Processors";

    String get Type() {
    retuen type;
    }
    }

    class Intel extends Processors {
    String type = "Intel Processors";

    String get Type() {
    retuen type;
    }
    }

    class AMD extends Processors {
    String type = "AMD Processors";

    String get Type() {
    retuen type;
    }
    }

    class RAM extends components {
    String type = "(RAM) Random Access Memory";

    String get Type() {
    retuen type;
    }
    }

    class DDR extends RAM {
    String type = "DDR RAM";

    String get Type() {
    retuen type;
    }
    }

    class SDR extends RAM {
    String type = "SDR RAM";

    String get Type() {
    retuen type;
    }
    }

    class HardDrives extends components {
    String type = "Hard Drive";

    String get Type() {
    retuen type;
    }
    }

    class SATA extends HardDrives {
    String type = "SATA Hard Drives";

    String get Type() {
    retuen type;
    }
    }

    class IDE extends HardDrives {
    String type = "IDE Hard Drives";

    String get Type() {
    retuen type;
    }
    }

    class PowerSupplies extends components {
    String type = "Power Supplies";

    String get Type() {
    retuen type;
    }
    }

    class Thermal extends PowerSupplies {
    String type = "Thermal PowerSupplies";

    String get Type() {
    retuen type;
    }
    }

    class Monitors extends components {
    String type = "Monitors";

    String get Type() {
    retuen type;
    }
    }

    class LCD extends Monitors {
    String type = "LCD Monitors";

    String get Type() {
    retuen type;
    }
    }

    class VGA extends Monitors {
    String type = "VGA Monitors";

    String get Type() {
    retuen type;
    }
    }

    class GraphicCards extends components {
    String type = "Graphic Card";

    String get Type() {
    retuen type;
    }
    }

    class Gigabyte extends GraphicCards {
    String type = "Gigabyte Graphic Card";

    String get Type() {
    retuen type;
    }
    }

    class ATI extends GraphicCards {
    String type = "ATI Graphic Card";

    String get Type() {
    retuen type;
    }
    }
    public class MyComponents {

    public static void main(String[] args) {
    Components Mb = new MotherBvoards
    System.out.println(Mb.getType());
    System.out.println(Mb.Hardware());
    Components Pc = new Processors
    System.out.println(Pc.getType());
    System.out.println(Pc.Hardware());
    Components Ram = new RAM
    System.out.println(Ram.getType());
    System.out.println(Ram.Hardware());
    Components Mt = new Monitors
    System.out.println(Mt.getType());
    System.out.println(Mt.Hardware());
    Components Gc = new GraphicCards
    System.out.println(Gc.getType());
    System.out.println(Gc.Hardware());
    Components Hd = new HardDrives
    System.out.println(Hd.getType());
    System.out.println(Hd.Hardware());
    Components Ps = new PowerSupplies
    System.out.println(Ps.getType());
    System.out.println(Ps.Hardware());


    }
    }

  6. #6
    corlettk is offline Member
    Join Date
    Apr 2009
    Location
    Brisbane
    Posts
    86
    Rep Power
    0

    Default

    Quote Originally Posted by msixty View Post
    This how I thouhgt my classes should look ...
    Was there a question there somewhere, or in your previous post?

    Please use CODE tags when posting code... to make it legible.

  7. #7
    msixty is offline Member
    Join Date
    Apr 2009
    Posts
    6
    Rep Power
    0

    Question What I have on Paper, pls help

    :confused:This is what I have on paper, havent started coding I need Help.

    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;
    	}
    }
    
    class Processors extends components {
    	String type = "Processors";
    	
    	String get Type() {
    	retuen type;
    	}
    }
    
    class Intel extends Processors {
    	String type = "Intel Processors";
    
    	String get Type() {
    	retuen type;
    	}
    }
    
    class AMD extends Processors {
    	String type = "AMD Processors";
    
    	String get Type() {
    	retuen type;
    	}
    }
    
    class RAM extends components {
    	String type = "(RAM) Random Access Memory";
    
    	String get Type() {
    	retuen type;
    	}
    }
    
    class DDR extends RAM {
    	String type = "DDR RAM";
    
    	String get Type() {
    	retuen type;
    	}
    }
    
    class SDR extends RAM {
    	String type = "SDR RAM";
    
    	String get Type() {
    	retuen type;
    	}
    }
    
    class HardDrives extends components {
    	String type = "Hard Drive";
    
    	String get Type() {
    	retuen type;
    	}
    }
    
    class SATA extends HardDrives {
    	String type = "SATA Hard Drives";
    
    	String get Type() {
    	retuen type;
    	}
    }
    
    class IDE extends HardDrives {
    	String type = "IDE Hard Drives";
    
    	String get Type() {
    	retuen type;
    	}
    }
    
    class PowerSupplies extends components {
    	String type = "Power Supplies";
    
    	String get Type() {
    	retuen type;
    	}
    }
    
    class Thermal extends PowerSupplies {
    	String type = "Thermal PowerSupplies";
    
    	String get Type() {
    	retuen type;
    	}
    }
    
    class Monitors extends components {
    	String type = "Monitors";
    
    	String get Type() {
    	retuen type;
    	}
    }
    
    class LCD extends Monitors {
    	String type = "LCD Monitors";
    
    	String get Type() {
    	retuen type;
    	}
    }
    
    class VGA extends Monitors {
    	String type = "VGA Monitors";
    
    	String get Type() {
    	retuen type;
    	}
    }
    
    class GraphicCards extends components {
    	String type = "Graphic Card";
    
    	String get Type() {
    	retuen type;
    	}
    }
    
    class Gigabyte extends GraphicCards {
    	String type = "Gigabyte Graphic Card";
    
    	String get Type() {
    	retuen type;
    	}
    }
    
    class ATI extends GraphicCards {
    	String type = "ATI Graphic Card";
    
    	String get Type() {
    	retuen type;
    	}
    }
    public class MyComponents {
    	
    	public static void main(String[] args) {
    		Components Mb = new MotherBvoards
    		System.out.println(Mb.getType());
    		System.out.println(Mb.Hardware());
    		Components Pc = new Processors
    		System.out.println(Pc.getType());
    		System.out.println(Pc.Hardware());
    		Components Ram = new RAM
    		System.out.println(Ram.getType());
    		System.out.println(Ram.Hardware());
    		Components Mt = new Monitors
    		System.out.println(Mt.getType());
    		System.out.println(Mt.Hardware());
    		Components Gc = new GraphicCards
    		System.out.println(Gc.getType());
    		System.out.println(Gc.Hardware());
    		Components Hd = new HardDrives
    		System.out.println(Hd.getType());
    		System.out.println(Hd.Hardware());
    		Components Ps = new PowerSupplies
    		System.out.println(Ps.getType());
    		System.out.println(Ps.Hardware());
    			
    	
    	}
    }

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

    Default

    Java Code:
    Components Mb = new MotherBvoards
    The above:
    • doesn't have a semicolon ";" at the end
    • MotherBoard is misspelled;
    • The correct way to intantiate a class is:

    Java Code:
    Components Mb = new MotherBoards();
    • Your classes probably should have constructors
    • These apply to all your class intantiations


    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
  •