Where do i make  the array???

I have an a problem for my class.i need to make a room class, a house class that extends a building class. i am making the room class first with the instance vaiables of length and width. The house class is suppose to add the array of the rooms to accumulate the floor space. I'm thinking the house class is where i would make the array so it would keep adding the arrays there. Also i have the test class to input the data. My professor worte
"Each instance of the room class represents a single room. Make an
array of them to pass into the constructor of the House class."
I didn't understand to much please advise me for the placement of the array.

// Test class
public class Test {
   public static void main(String[] arghs) {
        Room[] rooms = new Room[3];
        rooms[0] = new Room("Living Room",12,20);
        rooms[1] = new Room("Kitchen",8,11);
        rooms[2] = new Room("Bedroom",25,40);
        House myHouse = new House(rooms);
        myHouse.printRooms();
// Room class
public class Room {
    String name;
    int length, width;
    public Room(String name, int length, int width) {
        this.name=name;
        this.length=length;
        this.width=width;
    public String toString() { return name+"("+length+"x"+width+")"; }
// House class
public class House {
    Room[] deRooms;
    public House(Room[] someRooms) {
        this.deRooms = someRooms;
    public void printRooms() {
        for (int i=0; i<deRooms.length; i++) System.out.println(deRooms);

Similar Messages

  • I want to create an array that goes into a case structure where each element in the array is an individual case and gets done in order

    I want to create an array that goes into a case structure where each element in the array is an individual case and gets done in order. Any ideas, I've been playing with the idea but have had no luck, is this even possible?

    Hi,
    Please check it out the attached Vi.. Is this you need?
    Sasi.
    Certified LabVIEW Associate Developer
    If you can DREAM it, You can DO it - Walt Disney
    Attachments:
    Event.vi ‏11 KB

  • Can you guys help me find where did I make the mistake?

    Hi guys...
    I am working in two different frames, where in one of them I have a user input text field and besides I have a button that takes me to the next frame.
    In the next frame I have the output box, but I dont get there what I typed in the input one.
    Any help?
    This is what I have:
    FRAME 1
    import flash.utils.Timer;
    import flash.events.TimerEvent;
    import flash.text.Font;
    import flash.text.FontStyle;
    import flash.text.FontType;
    import flash.display.SimpleButton;
    var txt_inp:TextField = new TextField();
    txt_inp.x = 20;                  
    txt_inp.y = 700;
    txt_inp.width = 400;
    txt_inp.height = 50;
    txt_inp.restrict = "0-9 a-z A-Z";
    txt_inp.maxChars = 28;
    var myText:String = "Type your name here / Escriba su nombre aqui";
    var format:TextFormat = new TextFormat();
    format.font = "CooperBlack";
    format.size = 20;
    txt_inp.defaultTextFormat = format;
    var ok:Ok = new Ok();
    captureText();
    function captureText():void
                txt_inp.type = TextFieldType.INPUT;
                txt_inp.background = true;
                addChild(txt_inp);
                txt_inp.text = myText;
                txt_inp.addEventListener(TextEvent.TEXT_INPUT, textInputCapture);
    function textInputCapture(event:TextEvent):void
                                  ok.x = 450;
                                  ok.y = 720;
                                  ok.width = 80
                                  ok.height = 80;
      addChild(ok);
    var str:String = txt_inp.text;
    ok.addEventListener(MouseEvent.CLICK, toGameOver);
    function toGameOver (e:MouseEvent):void {
              ok.removeEventListener(MouseEvent.CLICK, toGameOver)
              gotoAndStop(5);
    FRAME 2
    removeChild(ok);
    removeChild(txt_inp);
    var myOutputBox:TextField = new TextField();
    var GOver:gameOver = new gameOver();
    GOver.x = 300;
    GOver.y = 337,85;
    GOver.width = 1500;
    GOver.height = 1000;
    myOutputBox.x = 420;                  
    myOutputBox.y = 700;
    myOutputBox.width = 400;
    myOutputBox.height = 50;
    myOutputBox.defaultTextFormat = format;
    addChild(GOver);
    createOutputBox(str);
    function createOutputBox(str:String):void
    myOutputBox.background = true;
    myOutputBox.x = 200;
    addChild(myOutputBox);
    myOutputBox.text = str;
    Thanks a lot!!!

    You need to be mindful of when you assign the str value....
    var str:String = txt_inp.text;
    The way you have it as shown, it is going to assign the nothing that is in the textfield since that line will execute before any text gets assigned.
    You would want to have that assignment done after the text in the textfield changes.  You still need to declare the variable outside any function so that it can be available to frame two in terms of scope, but the assignment needs to happen in your textInputCapture function.
    Also, using the TextEvent.TEXT_INPUT event will likely miss the mark as well since it triggers before the text is changed in the textfield, which will cause the text to be missing the last character entered.  You should use the Event.CHANGE event instead.

  • How can i make the input/output field to a multiple lines in ModulePool...

    hi all...
    can any one please let me know, is there any possibility thru Module Pool program where i can make the input/output field to a multiple lines...
    say, when we drag & drop the input/output field on the screen - it'll come with single line display. so, how to make the same field to multiple lines field.
    rather i can say my question like, how to increase the height of the input/output field.
    Desired Functionality:
    • The user wants to display a long text.
    • now the input/output field should not display the record as a single line, now the field has to display the text in multiple lines (something like wrap option in ms excel).
    hope u got my question...
    please help me in this regards...

    hi Rengith, i'm not using Text Field, i'm using Inpu/Output Field to display the long text.
    If u mean text field as input/output field then can u let me know the process for this, how to do the same thru module pool program...
    Edited by: murashali on Mar 18, 2008 1:36 PM

  • Service PO want to make the service Number mandatory thru config

    Dear All,
    I am not able to find the node where I can make the service number mandatory in the screen layout config.
    Please help
    Thanks in advance!

    Unable to understand
    4     Purchase Order     .......-...............*................*....-.-..----     -
    what this means  ?
    Please guide
    Thanks

  • Initialise the array length via a function

    Dear forum,
    II need a number of integers as an array, but I don't know how many in advance. An I need this array only in the scope, then do waya with it. So I used
    #include <iostream>
    using namespace::std;
    const int f ();
    int main () {
    int array[f ()];
    return 0;
    const int f () {
    return 42;
    . It worked fine under gcc, but CC compains with
    Error: An integer constant expression is required within th\
    e array subscript operator.
    Is there a switch which makes CC swallow this program?
    Cheers, Peter.

    You are posting this question in the C forum, but
    your question is about the C++ compiler.Hello Clamage,
    this I realised 1e-6 s after clicking submit. It shall not happen again. Anyway, thanks for the quick response!
    >
    In standard C++, the dimension of an array allocated
    statically or in a block must be a constant integer
    expression. Reference: C++ Standard, section 8.3.4.
    If g++ allows a non-constant value, that would be
    non-standard extension.... which are getting at you after a while...
    >
    You can get the effect by allocating the array on the
    heap:
    int* array = new int[f()];Indeed. But what made me make the array static is that with new[], you also have to delete[] (which one always forgets).
    >
    But in C++ you have alternatives to C-style arrays.
    You can use the standard vector class template. It
    manages memory for you, allows a vector to be
    expanded, optionally checks subscripts for being in
    range. When you create a vector, you can specify the
    starting capacity when you know the sizeI should try this.
    Once again, thanks for your patience!
    Cheers, Peter.

  • I migrated info from a hard drive to a new mac under time machine. It says I have shared files, but I don't see the old info on the new machine. Where do I look for it ? How do I make the old backup the base for my new macbook ?

    I migrated info from a hard drive to a new mac under time machine. It says I have shared files, but I don't see the old info on the new machine. Where do I look for it ? How do I make the old backup the basis for my new macbook ?
    The old OS was Mac X 10.5.8.   I think the new one is  10.7.2     Lion.

    Have a read here How do I set up a new Mac from an old one, its backups, or a PC?
    Stefan

  • I was given an assingment, but have no idea where to begin. The assingment is to create a text file using notepad with all of my digital inputs and some how make those imputs show up on my digital indicators on my control pannel

    I was given an assingment, but have no idea where to begin. The assingment is to create a text file using notepad with all of my digital inputs and some how make those imputs show up on my digital indicators on my control pannel.
    When it was explained to me it didn't sound to hard of a task, I have no LabVIEW experience and the tutortial sucks.

    StevenD: FYI, I did NOT give you the one star rating. I would never do that!
    StevenD wrote:
    Ow. Someone is grumpy today.
    Well, this is an assignment, so it is probably homework.
    Why else would anyone give HIM such an assigment, after all he has no LabVIEW experience and the tutorials are too hard for him?
    This would make no sense unless all of it was just covered in class!
    This is not a free homework service with instant gratification.
    OK! Let's do it step by step. I assume you already have a VI with the digital indicators.
    "...but have no idea where to begin".
    open notepad.
    decide on a format, possibly one line per indicator.
    type the document.
    close notepad.
    open LabVIEW.
    Open the existing VI with all the indicators.
    (are you still following?)
    look at the diagram.
    Who made the program?
    Does the code make sense so far?
    Is it a statemachine or just a bunch of crisscrossed wires?
    Where do you want to add the file read?
    How should the file be read (after pressing a read button, at the start of the program ,etc.)
    See how far you get!
    Message Edited by altenbach on 06-24-2008 11:23 AM
    LabVIEW Champion . Do more with less code and in less time .

  • I am having a problem where pdf files on the web (i.e., links in a Word doc) open after an extended time and only as gobbldygook ( a file containing a series of characters and letters that make no sense).  This also happens for another Mac user coworker

    Hi There:  I am having a problem where pdf files on the web (i.e., links in a Word doc) open after an extended time and only as gobbldygook ( a file containing a series of characters and letters that make no sense).  This also happens for another Mac user coworker in my office, while the PCs don't have this problem...  Any help/suggestions for a fix would be most appreciated! 

    Just adding more info - MacBookPro running 10.5.8 and using Safari as the browser.  The problem comes and goes - sometimes the linked Word files will open OK, n others its just a strring of crazy characters... 

  • You need to have xlsm where you can access the macro in numbers.  this is frustrating that the idea of Numbers is to make it like Excel yet you dont have this capability.  Question is, when will it happen or will it happen????

    You need to have xlsm where you can access the macro in numbers.  this is frustrating that the idea of Numbers is to make it like Excel yet you dont have this capability.  Question is, when will it happen or will it happen????

    Hi brev,
    Several points here:
    1. Although there is some compatibility between Numbers and Excel files, I doubt very much that "the idea of Numbers is to make it like Excel." The two applications share some similarities, but also have several differences.
    2. Your Question is unanswerable in this forum. Apple does not generally reveal future development plans or schedules for its applications, and anyone with knowledge of those plans will be bound by a non-disclosure agreement.
    3. "You need to" implies a feature request. If you want to request that a feature be added to a future version of Numbers, that request is better made directly to Apple, via the Feedback channel, than here, where the readers and responders are all users of the software, not developers. From the application menu (the "Numbers" menu in Numbers), choose Provide Numbers Feedback, then make your request for a feature to be added to Numbers.
    Meantime, if you absolutely need the macros capabilities of MS Excel, try one of the Office clones—OpenOffice.org, LibreOffice, or NeoOffice, which may offer macro support, or use the Mac version of Excel itself.
    Regards,
    Barry

  • TS3406 My phone doesn't make and receive calls. It doesn't have coverage where other iPhones with the same network do.

    My phone doesn't make and receive calls. It doesn't have coverage where other iPhones with the same network do. Please, let me know how way I sort this problem out?

    My wife is having the exact same issue after updating to the new iOS 8.1.1 and we've tried all the same steps even restoring the phone as a new phone. We've contacted our service provider and they've told us to go to apple to potentially "remove" her serial number from their servers to allow it to work properly on the service we have. We are desperate as purchasing a new phone right now is not an option and she desperately needs her phone for work and life.
    Iphone 5 8.1.1

  • Excel allows array arithmetic (e.g. sum(a1:a5* b1:b5) where the contents of the cells are the results of formulae.  Numbers only allows constants in the array cells. Right?  Any work-arounds?

    Excel allows array arithmetic (e.g. sum{(a1:a5* b1:b5)} where the contents of the cells are the results of formulae.  Numbers only allows constants in the array cells. Right?  Any work-arounds?

    CJPerry wrote:
    Any work-arounds?
    There is a very simple one : use libreOffice.
    Yvan KOENIG (VALLAURIS, France) dimanche 1 janvier 2012
    iMac 21”5, i7, 2.8 GHz, 12 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
    My iDisk is : http://public.me.com/koenigyvan
    Please : Search for questions similar to your own before submitting them to the community
    For iWork's applications dedicated to iOS, go to :
    https://discussions.apple.com/community/app_store/iwork_for_ios

  • Where is the Patterns pop-up menu, and how do I make the little ?

    Where is the Patterns pop-up menu, and how do I make the little crapper pop up? (huh. They don't have and emoticon for furious.)
    I have been searching the "Help" system for hours.  All I want to do is find a picture of an empty blue sky to put behind two airplanes.

    From the Toolbox, select the Paint bucket tool
    In the Paint bucket options at the top, change from "Foreground" to "Pattern".
    Click on the Pattern block to the right and the Pattern dialog will pop up.

  • Intavieuw en instadesk account: Perfectly dowload it but I cant find where I can make an account. Whithout an account I cant loggin on both programs. Who can help me sow I can use the apps!

    Intavieuw en instadesk account: Perfectly dowload it but I cant find where I can make an account. Whithout an account I cant loggin on both programs. Who can help me sow I can use the apps! Thank you.

    Tina,
    I would go crazy if this was me.  You may find this interesting from the customer agreement (to see full agreement go here:Customer Agreement | Verizon Wireless):
    "HOW AND WHEN CAN I DISPUTE CHARGES?
    If you're a Postpay customer, you can dispute your bill within 180 days of receiving it, but unless otherwise provided by law or unless you're disputing charges because your wireless device was lost or stolen, you still have to pay all charges until the dispute is resolved. If you're a Prepaid customer, you can dispute a charge within 180 days of the date the disputed charge was incurred. YOU MAY CALL US TO DISPUTE CHARGES ON YOUR BILL OR ANY SERVICE(S) FOR WHICH YOU WERE BILLED, BUT IF YOU WISH TO PRESERVE YOUR RIGHT TO BRING AN ARBITRATION OR SMALL CLAIMS CASE REGARDING SUCH DISPUTE, YOU MUST WRITE TO US AT THE CUSTOMER SERVICE ADDRESS ON YOUR BILL, OR SEND US A COMPLETED NOTICE OF DISPUTE FORM (AVAILABLE AT VERIZONWIRELESS.COM), WITHIN THE 180–DAY PERIOD MENTIONED ABOVE. IF YOU DO NOT NOTIFY US IN WRITING OF SUCH DISPUTE WITHIN THE 180-DAY PERIOD, YOU WILL HAVE WAIVED YOUR RIGHT TO DISPUTE THE BILL OR SUCH SERVICE(S) AND TO BRING AN ARBITRATION OR SMALL CLAIMS CASE REGARDING ANY SUCH DISPUTE."
    This may help you also: Arbitration and Mediation FAQs | Verizon Wireless
    You can dispute any charges by doing an Arbitration or Mediation.  I have never done it, so I can not help much there but this all may get you started.
    Let me know if any of this works! Good Luck! Please keep me updated. I really hope they help you.

  • IPhone 5S IOS 8. Can't figure out how to disable the "live" location feature within the native calendar app used for mapping/travel time.  Have looked everywhere and it's driving me nuts.  Thanks for any help on where to make the change!!

    iPhone 5S IOS 8. Can't figure out how to disable the "live" location feature within the native calendar app used for mapping/travel time etc.  Have looked everywhere and it's driving me nuts.  Thanks for any help on where to make the change!!

    iPhone 5S IOS 8. Can't figure out how to disable the "live" location feature within the native calendar app used for mapping/travel time etc.  Have looked everywhere and it's driving me nuts.  Thanks for any help on where to make the change!!

Maybe you are looking for

  • .FLV Video will not work when linked to on intranet (Captivate 5)

    I have a project with video (.FLV). 1. Project was developed and published to a folder on the local hard drive of a PC. 2. Project was copied to my company's intranet server. 3. If I click on "My computer" and navigate to the network folder where the

  • How do I use a tag within a tag?

    I have a tag that takes a variable input that is produced from another tag. But I can't figure out how to use the output of one, as the input for another. I'm using the value produced as a value for a form. ex <input type="text" value="<x:tag var="<x

  • Iphone 6 iOS 8.1 no longer playing properly with car audio system

    Hi there, I have an iphone 6 running ios 8.1 and it is no longer allowing me to play/pause songs through the car's audio system. I have a USB port in the car that allows me to plug my iphone in and control the Music through the car audio system. I ha

  • HP Officejet Pro 8500A Plus (Error E0060)

    I have a HP Officejet Pro 8500A Plus and when I power it up it shows the HP logo on the screen then the paper feed starts to run then it stops and I get a message saying  "Unable to send or recieve fax" then it says Error E0060. Then the another mess

  • OBIEE and Essbase- Would you yet? Do you Yet?

    How many of you are using OBIEE with Essbase? IF you are does it give you the functionality you need? Is it better to wait for the next release where tree structures and asymitrical hierarchies are supported? I have mixed feeling about the current im