Loops in method are never executed??

Hello,
I have a short program that I wrote to practice manipulating arrays and to
practice modular design. The source compiles and the program executes,
however the 2 loops in the process() method are never entered, I have tried
do-while loops and the for loop(which was effective for the same program
written with non-modular design). the program will execute the
System.out.println("\nThe array values recieved are:\n");
inside of the process(), but ignores the 2 for loops. I have purposely declared int size; without a value such as int size=0, because I am prompting the user to enter a value for the array and I pass that value into the size of the array.
I have worked and researched for a couple of days on this. I will post the
code below and any help would be greatly appreciated. Thanks, Jeff
import java.io.PrintStream;
import javabook2.*;
public class Tester
public static void main (String [] args)
{  App a;
a = new App();
a.start();
class App//data members of the App class
SimpleInput input;
String tittle;
int size;
double [] rainfall;
public App()
{ //constructor
input = new SimpleInput();
rainfall = new double[size];
public void start()//start method
describe();
process();
public void describe()//prompts the user for info
tittle = SimpleInput.getString("What is your name?\n");
System.out.println("\nNice to meet you " + tittle);
System.out.println("\nWe are now going to get some practice with arrays!");
size = SimpleInput.getInteger("\nPlease enter the size of your array:");
System.out.println("\nThe size array you specified is " + size);
System.out.println("You will be prompted " + size +" times for rainfall values.");
public void process() // array method, declared in the start() method
for( int i =0; i<rainfall.length; i++)
rainfall[i] = SimpleInput.getDouble("\nPlease enter rainfall amount " +(i + 1));
System.out.println("\nThe array values recieved are:\n");
for( int i=0; i<rainfall.length; i++)//.length is used if you dont know the size of aray
System.out.println(rainfall );

Add rainfall = new double[size]; as the first
statement in your process method.Thank you all for your responses. I tried adding the above statement as the first line in the process() method and the program worked perfectly. I learned that I tried to construct the array before I even got the value from the user, and that after I got the value is when I should have just passed that value into the array size. thanks, Jeff

Similar Messages

  • Does anyone know how to contact a responsible, responsive customer service rep?  Promises of resolution to my billing issues are never kept.  Return calls are never made.  I contacted Executive Relations and emailed 3 Verizon executives.  No reponse.  Any

    Does anyone know how to contact a responsible, responsive customer service rep?  Promises of resolution to my billing issues are never kept.  Return calls are never made.  I contacted Executive Relations and emailed 3 Verizon executives.  No reponse.  Any number, email  or help contacting a reponsive person is appreciated!  Thanks!

    http://www.BBB.org
    File a complaint they will call you.
    Good Luck

  • BMP Entity never execute unsetEntityContext

    hi,
    i'm using BMP Entity beans
    1. these seems never executing the unsetentitycontext method.
    2. when undeploying my EJB or stopping my weblogic instance,
    i would like to close properly some sockets, but no events
    occurs.
    What's happening, is it a unfixed problem? or a deployment problem?
    I'm using weblogic server 6.1.1.0 SP1
    thanks in advance

    Entity beans are moved to a pool at the end of a transaction. When talking
    to an entity bean directly, the transaction is a single method call. An
    entity bean is attached at the server on demand (pulled from the pool and
    activated)... and only stays attached during a transaction. So, when you
    make the method call, the server attaches an entity bean, runs the method,
    calls ejbStore(), and releases the bean back to the pool by calling
    ejbPassivate(). Finally, beans that are in the 'pooled' state are garbage
    collected by the server at it's discretion and the unsetEntityContext() is
    called.
    Hence, you have to release all your resources in ejbPassivtae().
    "F Cahon" <[email protected]> wrote in message
    news:3c62ad4e$[email protected]..
    >
    hi,
    i'm using BMP Entity beans
    1. these seems never executing the unsetentitycontext method.
    2. when undeploying my EJB or stopping my weblogic instance,
    i would like to close properly some sockets, but no events
    occurs.
    What's happening, is it a unfixed problem? or a deployment problem?
    I'm using weblogic server 6.1.1.0 SP1
    thanks in advance

  • I have had a reinstall nightmare getting my loops back they are in the apple library, I can access them through the media browser but I only have a few available through the loop browser, how do I get them all back there again? please help

    I have had a reinstall nightmare getting my loops back they are in the apple library, I can access them through the media browser but I only have a few available through the loop browser, how do I get them all back there again? please help

    "Where do I find my hundreds of dollars of downloads I have done since 2005?"
    They will only be where you put them  If you are doing the very basics, then they will be on your computer and they will be in your backup copy of your computer.
    The itunes store is not global at all, never has been. You cannot redownload your content from another country.  You can only use the countrys itunes store for the country that you are physically located.

  • ColdFusion 11 on RHEL, All Files in cfusion/bin are NOT executable.

    Installed CF11 on RHEL and all the files in cfusion/bin are set to rw instead of rwx. I've tried both an upgrade install from CF9 and a fresh, clean install after removing CF9. No change. I've also tried both the prod an prod-secure profiles. How do I get around this? I see nothing related to this in documentation for the Linux installer.

    RESOLVED: The CF installer writes a shell script into /tmp and tries to execute at the end of the install. For us, due to server lockdown for PCI DSS, we set the noexec or umask on certain file systems, so the shell script never executed. Remounted /tmp with execute permission until the installation and setup was done. Also had to update the cf_home directory group and user owner as it was mixed between root and the provided runtime user.

  • Need to find sql/users that is parsing but NEVER executing

    hello all,
    I have been trying to figure out how to find sql or user who are pharse sql but not executing them. thats becoz my execute to prase % in my AWR report is negative. meaning someone is parsing statements and NEVER executing them. They are just chewing up your CPU, latching the shared pool, killing your performance.
    which is not a good thing and i want to find out what user is doing that or what SID or what sql is diong whats its doing. How can i find that out. Any querys out there to do that or ?? THANKS
    this is 10.2.0.3 on AIX. and here is part of AWR
    Instance Efficiency Percentages (Target 100%)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                Buffer Nowait %:  100.00       Redo NoWait %:  100.00
                Buffer  Hit   %:   80.74    In-memory Sort %:   99.10
                Library Hit   %:   92.95        Soft Parse %:   91.24
             Execute to Parse %:  -31.89         Latch Hit %:   99.99
    Parse CPU to Parse Elapsd %:   87.32     % Non-Parse CPU:   99.92
    Edited by: user630084 on Mar 13, 2009 7:51 AM

    true i can use that, I am getting about 8 rows out of it and there are about 100+ connections as of now. But here is the thing. As the app use only one schema(lets call it scott). Everybody login thru that schema (scott/tiger)...so that 87 rows that i am getting..all of them are parsing_schema_name=scott and parsing_user_id=55 ..........but i need those 8 users SID...so i can pin point...hey u are the one who is just prasing and not executing...if you know what i mean...so i need that SID...i got the parsing_schema_name and parsing_user_id...but need the SID...so how can i get that ???

  • If all methods are virtual, what's up with this?

    I've got two class
    Class A {
    public void foo() {
    System.out.println("As foo");
    public void bar() {
    foo();
    Class B extends A{
    public void foo() {
    System.out.println("Bs foo");
    Then in my main method
    B myB = new B();
    myB.foo();
    the output is "As foo". Should it not be "Bs foo"? How can I make it execute Bs foo, without giving B it's own bar() method?

    Ok, problem solved. My foo() type methods were
    actually private. I made them protected and all is
    well.And that answers your question as well. Not all methods are virtual.

  • Scripts are not executing

    Hi,
    we have scheduled scripts through crontab,but from few days these scripts are not executing,there is no problem with time entries in crontab because some of them are executing correctly,what can be possible reasons for the cronjobs to not to execute.we are using sun solaris sparc 64 bit.oracle 10.1.0.4

    I can't say without knowing what the script does. Maybe somebody changed the permissions on another directory that script needs, or maybe another file it needs is no longer available, or ???
    Just suggesting a troubleshooting step. If you can run the script in a similar setup then you can eliminate the script as a likely problem. I didn't see anything on the crontab entry that looked to be a problem.
    PS: "will the date change with the execution of cronjob or it remains the same."
    No, the date on the cron daemon will stay the same. It just wakes up once a minute to check for things to do and kicks them off, it never restarts.

  • Table Button Action - never executes

    Hey Everyone, I have a really strange problem.
    I have a table, which is bound to an ObjectArrayDataProvider. Everything works fine. I then added a command button to one of the colums and bound its action property to the backing bean.
    The problem is; when ever I click the button - the code is never executed.
    <ui:button action="#{Monitor.button_Remove_action}" binding="#{Monitor.button_Remove}" id="button_Remove" text="Remove"/>
    public String button_Remove_action() {
             * Never reaches this code
               doAmazingThings(true);
               return null;
        }

    I am perplexed. Are you using virtual forms? Not
    that that would explain it.
    Do you have the immediate property set to true
    (checked) for any component?
    Do you bypass any phases by calling renderResponse()
    or responseComplete()?No, No and No.
    I have brought the page down to my 1 table with 1 rowgroup with 1 column containing the 1 button.
    Still no go!
    I am dynamically populating the table, if that would matter? In prerender I set the array:
    objectArrayDataProvider1.setArray(getServers());

  • EjbActivate() and ejbPassivate() methods are called million times!!! :(

    Hello All,
    Am I missing some thing here?
    We have a project with many Entity Beans, and all of them have relations with one another. The simple example I can give is Entity A has one to many relation with Entity B.
    i.e There could be one Entity A and for this there could be many Entities B these two entities are managed by CMR fields.
    Entity A has a PK, this would act as a FK in Entity B.
    In the EJB Post create method of Entity B I am trying to find a suitable entity A and trying to execute setEntityA(suitableEntityA), while this method is getting executed here is the things that happen
    the container tries to find all Entity B (if there are 10,000 records in B table then ejbActivate() of B is executed 10,000 times) then it sets the relation with Entity A, then at the end of the Transaction the container will call ejbPassivate() method on Entity B 10,000 times!!! oh god what is happening here...!!!?????
    can some one tell me if I am missing some settings?
    The same thing happends for all the other EJBs which have one to many CMR fields, i.e ejbActivate() and ejbPassivate() of each of these Entity Beans will be called for those many number of times for as many records found in the Datbase of the corresponding Entity.
    I have the follwing setting in my orion-ejb-jar.xml file
    <entity-deployment name="EntityA"
    max-tx-retries="0"
    max-instances="-1"
    location="EntityA"
    table="A"
    data-source="jdbc/oracleDS"
    exclusive-write-access="false"
    locking-mode="optimistic"
    update-changed-fields-only="true"
    delay-updates-until-commit="true">
    similar xml construct for Entity B also!!!
    If some one knows more about this please let me know.
    Thank you
    -Mallik

    Found one more thing for this CMP-CMR relationship and ejbActivate() and ejbPassivate() process of CMP Entity's.
    In this above example if say
    Entity A (Dept) ------ Entity B (Employee) (1:M) has one to many relationship
    Employee holds a FK value which is PK in Dept (dept_id).
    Suppose asssume that there are 10,000 employees working for a dept_id = 5.
    (i.e there are 10,000 records in Employee that references Dept table with dept_id =5)
    Now I want to add one more employee to this dept_id = 5, then I create an Employee entity and in the ejbPostCreate() method of Employee entity I lookup Dept Entity with Dept_PK=5, until this every thing is fine. Now I call setter method with in Employee Entity to set the dept such as setDept_dept_id(detpEntity5), at the execution of this method EJB container calls starts calling Employee Entity's the ejbActivate() method for 10,000 times this equals the number of references Employee table has to Dept table with Dept_ID=5, then at the end of the transaction the container calls ejbPassivate() method 10,000 times to passivate all those ejbs that it activated.
    Did some one experience the same thing with CMP EJBs? please let me know what I have to do to avoid such things?
    Thank you
    Mallik

  • Af:commandMenuItem action and actionListener are not executing

    Hello all!
    I use JDeveloper Studio Edition Version 11.1.1.2.0. Here's the problem. I have a popup menu like this
    <af:popup id="someMenu" animate="default">
    <af:menu id="pt_m1">
    <af:forEach var="item" items="#{ContextMenuHelperBean.availableUserRoles}">
    <af:commandMenuItem text="#{item.roleName}"
    action="#{ContextMenuHelperBean.changeUserRole_Action}"
    actionListener="#{ContextMenuHelperBean.changeUserRole_ActionListener}"
    immediate="true"
    partialSubmit="false"
    id="pt_cmi1" rendered="true">
    <f:attribute name="userRole" value="#{item}"/>
    </af:commandMenuItem>
    </af:forEach>
    </af:menu>
    </af:popup>
    The problem is that action and actionListener are not executing, when the menu item is selected (but the page is reloaded with no changes). ContextMenuHelperBean has a "session" scope set in adfc-config.xml. What can be wrong with this?

    Now I've encountered a new kind of error. I create a menu in a managed bean like this:
    In JSPX
    <f:view beforePhase="#{RolesMenuSupportBean.createMenus}">
    <af:popup id="cxtMenu" animate="default">
                            <af:menu id="pt_m1"
                                     binding="#{RolesMenuSupportBean.rolesMenu}">
                            </af:menu>
                          </af:popup>In com\cs\webb2\view\utils\menu\RolesMenuSupport.java
        public void createMenus(PhaseEvent phaseEvent) {                       
            List<IUserRole> rolesList = getAvailableUserRoles();
            for (IUserRole role: rolesList) {           
                Boolean hasItem = false;           
                for (Iterator iter = rolesMenu.getChildren().iterator(); iter.hasNext(); ) {
                    RichCommandMenuItem item = (RichCommandMenuItem) iter.next();
                    if (!hasItem)
                        hasItem = item.getText().equalsIgnoreCase(role.getRoleName());
                if (!hasItem) {
                    RichCommandMenuItem newItem = new RichCommandMenuItem();                                                       
                    newItem.getAttributes().put("userRole", role);
                    newItem.setText(role.getRoleName());
                    newItem.setId(ITEM_ID);               
                    newItem.setActionExpression(getActionExpression("#{RolesMenuSupportBean.changeUserRole_Action}"));                           
                    newItem.addActionListener(getExpressionActionListener("#{RolesMenuSupportBean.changeUserRole_ActionListener}"));                               
                    rolesMenu.getChildren().add(newItem);  
        } The menu is created successfully, but when I click on any item, I get an exception
    <b>javax.servlet.ServletException: Method not found: com.cs.webb2.view.utils.menu.RolesMenuSupport@d4702.changeUserRole_Action(void)</b>
    But of course I have such a method in my com.cs.webb2.view.utils.menu.RolesMenuSupport:
    In com\cs\webb2\view\utils\menu\RolesMenuSupport.java
        public String changeUserRole_Action()
            System.out.println("Action!");
            // no code yet
            return "adfMenu_Main";
        }And there <b>is</b> a managed bean named RolesMenuSupportBean, which is associated with class com.cs.webb2.view.utils.menu.RolesMenuSupport.
    Can anyone tell me, what can be wrong?

  • 11.1.2- Need to find out what reports are being executed by a user

    Hi,
    We have financial reports executed from workspace.In essbase session , only the user id is displayed and the Request type- mdxreport is displayed. We also tried searching the log for Financial report didnt find anything relevant.
    Is there a way to find out what reports are being executed by the user.
    Thanks in advance.
    Regards,
    Saumya

    STAT will give you the information for a limited period of time and is limited to the server which you are logged onto yourself. Beyond 24 hours it is of even less use even if you change the selection screen values.
    If you want it for a period way back into the past, then you need to use ST03N.
    There are at least 2 dependencies and 1 confusion:
    1 dependency) The length of period is determined by the size (length) of the file. You can change this in ST03N (default 50MB) via the menu settings.
    2 dependency) The stat collector jobs need to be scheduled to write the information to ST03N (once per hour is a legal requirement in some non-banana republic countries).
    1 confusion) There is an obscure function which converts a report submit to a transaction name (there is not much difference anyway) and an even more obsure one which filters what ST03N will record and therefore whether you can read it. You can (un)filter these things away if you search the SAP Marketplace for the term "MONI".
    What is of particular value from this control is that you can even detect a submission of an abap which only existed temporarily.
    Also note that having this information is potentially very powerfull with respect to the users (some of them are human too), so you should expose and use it responsibly.
    You should also ensure that only responsible users / auditors have access to S_TOOLS_EX.

  • Since installing 10.7.3 my downloads say that I do not have enough space on my computer for the download. These downloads are never more that 200 megs or so and I have 270 Gigs left on my hard drive. What can I do to fix this?

    Since installing 10.7.3 my downloads say that I do not have enough space on my computer for the download. These downloads are never more that 200 megs or so and I have 270 gigs left on my hard drive. Somehow the remaining space on my hard drive is not being correctly read. What can I do to fix this? I have run permissions repair several times, but to no avail.

    Th downloads do not finish. I am dowloading to a file on my desktop called MUSIC, but it first starts to download to my desktop and then I move it to the MUSIC file also on my desktop and I have been doing this without incident using 10.7.2 as well as 10.7.1 and 10.7.

  • Which extraction methods are used for extracting AR , AP, GL , cost centre

    which extraction methods are used for extracting AR , AP, GL, cost centre  account   data from R/3 system.
    please let me know what type of extraction we use...generic or FISL.... OR COPA
    ON WHAT SCENARIOS WE USE  THIS EXTRACTIONS..
    if any have documents on it please  email...please  send  an  email    documents ..
    to  [email protected]  
    iam bit confused with sap help...
    will reward full points
    please reply

    Hi,
    For general ledger :
    http://help.sap.com/saphelp_nw70/helpdata/en/57/dd153c4eb5d82ce10000000a114084/frameset.htm
    This is the best how-to guide on AP,AR,GL and TAX.
    http://help.sap.com/saphelp_nw04/helpdata/en/af/16533bbb15b762e10000000a114084/frameset.htm
    Hope it helps.
    Regards,
    Srikanth.

  • Class Won't Activate But Methods Are Active

    We have a problem in our production system where a new method has been transported to production but when trying to activate the class I get an error saying "Method <methodname> does not exist"
    The confusing thing is that this method DOES exist but somehow somewhere there is some kind of reference missing.
    The BSP application based on this class works fine. All the methods are active and get called, yet the class itself won't activate.
    I have seen this problem once before in a report program and the solution was to re-write the report not using OO-ABAP.
    However our current problem is this is a BSP appplication and we not only cannot do that but simply there is 2 years development in this.
    Can anyone offer any suggestions ?
    Many Thanks
    David

    Hi David,
    I don't know the reason for this bad situation.
    Have you take a look in the protocol of the transport?
    Is the transport finished without any errors?
    Contains the transport the whole class or only a part of it? May be that transport was not complete.
    So you could create a new transport that contains the whole class in the transaction SE80 and transport it again to the productive system.
    When the problem still exits, you could open a call in the service market place.
    Perhaps SAP will then take a look on your system and find the reason.
    Good luck,
    Stefan

Maybe you are looking for

  • How to get all files from Archive server

    Hi Experts, My problem is: When i try to read from an archived file, the moment archive_open_for_read function module is executed, a popup box appears asking to choose the name of the archive file to be read. I have to pass only one Export Parameter

  • HTML form in iview not displaying correctly

    Hi I have made a KM document iView and in that I have called a HTML page. The problem is that the margins in the iView are too much and due to this the content is shrinked in between. When I open the page in new window then it is correctly displayed

  • Project Server 2010 Excel Reports

    For the last few weeks I have tried to create an Excel timesheet report. However, the data that is being pulled will not go past May. Timesheets have been submitted and approved for this project. The project is saved, published and checked in. The re

  • Brother printer not working after update

    I downloaded OS X 10.8 and now my Brother printer MFC-J430w-2 will not print. I went to brother's web site and DL'd the drivers I think are correct but the computer wont let me open then. Any ideas? Thanks in advance!

  • MalformedURL : No Protocol

    I have some problems either with the configuration of the weblogic or webgain. I get the exception of malformed URL when I try to run the client application trying to use an EJB or weblogic server. I have tried reinstalling all the things that I coul