HELP WITH COUNT (URGENT)

I need to get the count of two fields in a table.
The structure of the table is:
id | date | hour_in | Hour_out
#table1
id NUMBER;
date DATE;
hour_in DATE;
hour_out DATE NULL;
I need to get the count of hour_in and hour_out to a date (Ex. COUNT(hour_in), COUNT(hour_out)), I mean, how many data have hour_in and hour_out in a date.
but I can't do well the query. Note: hour_out can be null.

There is more than one way to chop this particular cabbage but my approach is an old favourite:
SELECT date
       , count(*) AS cnt_hr_in
       , sum(nvl2(hour_out, 1, 0)) AS cnt_hr_out
FROM table1
GROUP BY date
/Cheers, APC

Similar Messages

  • Help with count and sum query

    Hi I am using oracle 10g. Trying to aggregate duplicate count records. I have so far:
    SELECT 'ST' LEDGER,
    CASE
    WHEN c.Category = 'E' THEN 'Headcount Exempt'
    ELSE 'Headcount Non-Exempt'
    END
    ACCOUNTS,
    CASE WHEN a.COMPANY = 'ZEE' THEN 'OH' ELSE 'NA' END MARKET,
    'MARCH_12' AS PERIOD,
    COUNT (a.empl_id) head_count
    FROM essbase.employee_pubinfo a
    LEFT OUTER JOIN MMS_DIST_COPY b
    ON a.cost_ctr = TRIM (b.bu)
    INNER JOIN MMS_GL_PAY_GROUPS c
    ON a.pay_group = c.group_code
    WHERE a.employee_status IN ('A', 'L', 'P', 'S')
    AND FISCAL_YEAR = '2012'
    AND FISCAL_MONTH = 'MARCH'
    GROUP BY a.company,
    b.district,
    a.cost_ctr,
    c.category,
    a.fiscal_month,
    a.fiscal_year;
    which gives me same rows with different head_counts. I am trying to combine the same rows as a total (one record). Do I use a subquery?

    Hi,
    Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables involved.
    Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
    user610131 wrote:
    ... which gives me same rows with different head_counts.If they have different head_counts, then the rows are not the same.
    I am trying to combine the same rows as a total (one record). Do I use a subquery?Maybe. It's more likely that you need a different GROUP BY clause, since the GROUP BY clause determines how many rows of output there will be. I'll be able to say more after you post the sample data, results, and explanation.
    You may want both a sub-query and a different GROUP BY clause. For example:
    WITH    got_group_by_columns     AS
         SELECT  a.empl_id
         ,     CASE
                        WHEN  c.category = 'E'
                  THEN  'Headcount Exempt'
                        ELSE  'Headcount Non-Exempt'
                END          AS accounts
         ,       CASE
                        WHEN a.company = 'ZEE'
                        THEN 'OH'
                        ELSE 'NA'
                END          AS market
         FROM              essbase.employee_pubinfo a
         LEFT OUTER JOIN  mms_dist_copy             b  ON   a.cost_ctr     = TRIM (b.bu)
         INNER JOIN       mms_gl_pay_groups        c  ON   a.pay_group      = c.group_code
         WHERE     a.employee_status     IN ('A', 'L', 'P', 'S')
         AND        fiscal_year           = '2012'
         AND        fiscal_month          = 'MARCH'
    SELECT    'ST'               AS ledger
    ,       accounts
    ,       market
    ,       'MARCH_12'          AS period
    ,       COUNT (empl_id)       AS head_count
    FROM       got_group_by_columns
    GROUP BY  accounts
    ,            market
    ;But that's just a wild guess.
    You said you wanted "Help with count and sum". I see the COUNT, but what do you want with SUM? No doubt this will be clearer after you post the sample data and results.
    Edited by: Frank Kulash on Apr 4, 2012 5:31 PM

  • Help with counter

    Hi everyone,
    I am writing this page for users to register and to login, but the problem i have is knowing who are the most active users.
    I am trying to do this with a hit counter, as you can see in my last "if", but is not working as it should be.
    Can somebody help with this.
    thanks.
    <html>
    <head>
                     <title>   2  </title>
    </head>
    <body>
    <body bgcolor="#FFFFFF">
    <center>
    <br>
    <%
      Cookie[] cookies = request.getCookies();
      if (cookies == null){
        cookies = new Cookie[0];
      Cookie c = new Cookie("users","");
      response.addCookie(c);
      String username  = request.getParameter("username");
      String password = request.getParameter("password");
      Cookie newuser = null;
      if (username!=null && password!=null && username.length()>0) {
        newuser = new Cookie(username,password);
        response.addCookie(newuser);
          for (int i=0; i<cookies.length; i++) {
          if (newuser!=null && newuser.getName().equals(cookies.getName())){
    newuser = null;
    out.println("><BR> <H3>" + "That username already exists, please enter another."+"<BR> </H3>");
    if (newuser != null){
    out.println("<H3> Welcome new user: <BR>"+newuser.getName()+":\t"+ newuser.getValue()+"<BR> </H3>");
    int counter = 0;
    if (request.getParameter("registereduser") != null){
         for (int i=0; i<cookies.length; i++) {
              if (request.getParameter("registereduser").equals( cookies[i].getName() ) ){
         out.println("><BR> <H3>" + "Welcome again, "+ cookies[i].getName()+counter++"<BR> </H3>");
    %>
    </center>
    </body>
    </html>

    I'm trying to do it this way:
    I have declared an static counter to do the task, and is incrementing everytime the page is visited, but,
    I want that depending of the user, it will print a different output, for example:
    user "a", visted 3 times,
    or user "b" visited 8 times.
    I was thinking in a counter for each user, and to save it and restore it every time the user visits.
    how can i do that?
    <%! static int staticCounter = 1; %>
    <%
    if (request.getParameter("registereduser") != null){
               for (int i=0; i<cookies.length; i++) {
                     if (request.getParameter("registereduser").equals( cookies.getName() ) ){
         out.println("><BR> <H3>" + "Welcome again, "+ cookies[i].getName()+staticCounter++"<BR> </H3>");
    %>

  • Help with counting XML elements and converting from MS SQL 2008 to ORACLE

    Hello,
    My ORACLE DB version is:
    ('Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production');
    ('PL/SQL Release 11.2.0.2.0 - Production');
    ('CORE     11.2.0.2.0     Production');
    ('TNS for Linux: Version 11.2.0.2.0 - Production');
    ('NLSRTL Version 11.2.0.2.0 - Production');
    I'm trying to convert the below SQL Server 2008 query to work on Oracle. It's important to note that the XMLData column type is CLOB.
    Query 1)
    -- Number of validations
    select br.rulename, CAST(( CAST(br.XMLData as XML)).query('count(//Validation/Expressions/Expression)') as nvarchar(50)) as "Number of //Validation/Expressions/Expression"
    from AsBusinessRules br
    where
    DATALENGTH(br.XMLData)>10
    and CAST(( CAST(br.XMLData as XML)).query('count(//Validation/Expressions/Expression)') as nvarchar(50)) not like '0'
    Any help is greatly appreciated.

    Hi,
    You can try one of these :
    select br.rulename
         , count(*) as "Num. of Expression"
    from AsBusinessRules br
       , xmltable(
           '//Validation/Expressions/Expression'
           passing xmltype(br.XMLData)
         ) x
    where length(br.XMLData) > 10
    group by br.rulename
    having count(*) != 0
    ;or,
    select br.rulename
         , xmlcast(
             xmlquery(
               'count(//Validation/Expressions/Expression)'
               passing xmltype(br.XMLData)
               returning content
             as number
           ) as "Num. of Expression"
    from AsBusinessRules br
    where length(br.XMLData) > 10
    and xmlcast(
          xmlquery(
            'count(//Validation/Expressions/Expression)'
            passing xmltype(br.XMLData)
            returning content
          as number
        ) != 0
    It's important to note that the XMLData column type is CLOB.Could you consider migrating the column to XMLType datatype?
    Given your version, it would be binary XML by default and therefore a lot more performant with XQueries, compared to a simple CLOB storage.

  • Need some help with count query

    Hello,
    I'm terrible @ oracle, so bear with me. I am trying to use the count function with my query but it counts rows from different tables.
    I want my query to basically add a column from another table but have it not be a part of the count.
    Say, table1 table2 table3. My count is right between the first two tables (Buyers,5).But since in table3 there are duplicate values(or accounts in this case(3), the count multiples by that many (15).
    I need it to read Buyers,5,account #. I've tried distinct and a union but to no avail.
    Help me please.

    If I understand you correctly, you want to count the records in table1 and table2 which have a one-to-one relationship, but you need to display additional data from table3 which has a one-to-many relationship. If this is correct, you need to use an in-line view to join table1 and table2 then join that in-line view to table3 to display the data from it. Something along the lines of:
    SELECT v.col1, v.col2, v.col3, v.col4, v.cnt, t3.col1 t3col1, t3.col2 t3col2
    FROM (SELECT t1.col1, t1.col2, t2.col1 col3, t2.col2 col4, COUNT(*) cnt
          FROM table1 t1, table2 t2
          WHERE <join conditions between t1 and t2> and
                <other conditions if required>
          GROUP BY t1.col1, t1.col2, t2.col1, t2.col2) v,
         table3 t3
    WHERE <join conditions between v and t3>
          <other conditions if required>John

  • Please help with an urgent purchase issue

    Hello all
    I have finally decided that since I am planning a trip to US it would be a wonderful opportunity to purchase a Mac and fulfill my dream!
    Despite the fact that I was thinking of purchasing an iMac for a desktop computer (my office laptop is a windows 8) I ended up in selecting a MacBook Pro 15 retina as a desktop replacement combining increased portability and enhanced specifications. The use is strictly personal meaning transferring and listening to music, home movies editing, watching movies, Internet and generally transferring all my home staff to apple ecosystem using also external drives.
    Now the serious staff: since  I have a one time opportunity ( the trip is not repetitive) I would extremely appreciate your help in the following:
    - my current selection is with 2,7 ghz quad core i7 with 8  gb ram and 512 flash. How is this configuration compared to the basic one? Basically I chose the 2.7 because of the relatively small price difference and the increased hard drives because of future programs installations (all storage will be done in time capsule and external drives)
    - since I have to purchase it now when Mavericks are released will the update require payment (based on your experience from the past)
    - how do the above compare to the new MacBook Air (if it is worthwhile I would go to an enhanced version of the 13")
    My true apologies for the length of my message but any help is invaluable to solve my confusion
    Many thanks in advance. 

    - my current selection is with 2,7 ghz quad core i7 with 8  gb ram and 512 flash. How is this configuration compared to the basic one? Basically I chose the 2.7 because of the relatively small price difference and the increased hard drives because of future programs installations (all storage will be done in time capsule and external drives)
    - since I have to purchase it now when Mavericks are released will the update require payment (based on your experience from the past)
    - how do the above compare to the new MacBook Air (if it is worthwhile I would go to an enhanced version of the 13")
    My true apologies for the length of my message but any help is invaluable to solve my confusion
    Many thanks in advance. 
    We do not know yet what Mavericks will cost or what machines Apple will update for free but based on past experience it will probably not be a free update unless you purchase the computer after Mavericks has been released to the public. As recent operating system upgrades have been relatively inexpensive - Mountain Lion was $20 - I wouldn't worry a lot about this.
    I agree with your choice of the 512GB SSD. The bigger the better as application files and data are only going to get larger. The faster processor may not make enough difference for your intended uses to make it worth the extra money however.
    The retina display on the MacBook Pro is quite a bit better than the MacBook Air.
    Best of luck.

  • Help with an urgent application please

    algier please recommend me I need a web application that meets the characteristics of a forum system and database must be Oracle 10g or 11g
    I hope I'll be able to help many grasias pendiende and those who can help me

    We do not use urgent applications.

  • Need some help with threads, urgent!!

    Hi I am really new to threads and I cannot figure out why the code below will not work. After my thread goes into a wait, it never wakes up. Can someone please help me? When stepping through the code, I get an invalid stack frame message as well. Thanks in Advance!!!
    Colin
    import java.io.*;
    import java.util.*;
    public class XMLInputCompression extends InputStream implements Runnable
    private InputStream in;
    private ByteArrayOutputStream baos = new ByteArrayOutputStream();
    private boolean closed = false;
    private boolean foundDTD = false;
    private Vector elementsList = new Vector();
    private Vector attributesList = new Vector();
    private BufferedReader br = null;
    private StringTokenizer st = null;
    final static int BUFF_SIZE = 500;
    final static String HEADER = "<?xml version=\"1.0\"?><!DOCTYPE Form SYSTEM ";
    final static char CLOSE_ELEMENT = '>';
    final static String END_ELEMENT = ">";
    final static char START_ELEMENT = '<';
    final static char START_ATTRIBUTE = '[';
    final static String ATTLIST = "<!ATTLIST";
    final String XMLTAG ="<?xml";
    final String ELEMENTTAG = "<!ELEMENT";
    public static void main(String[] args)
         try
    FileInputStream fis = new FileInputStream("c:/Dump.txt");
    XMLInputCompression compress = new XMLInputCompression(fis);
    int r = 0;
    while(r != -1)
    byte b[] = new byte[200];
    r = compress.read(b);
    System.out.println("r is: " + r);
    if( r == -1)
    compress.close();
    }catch(Exception e)
    e.printStackTrace();
    } // end main
    public XMLInputCompression(InputStream is) throws IOException
    this.in = is;
    baos.write(HEADER.getBytes());
    new Thread(this).start();
    public void run()
    try
    Vector elementNames = new Vector();
    //Vector attributeNames = new Vector();
    StringBuffer sb = new StringBuffer(BUFF_SIZE);
    char c = (char)in.read();
    switch (c)
    case START_ELEMENT:
    if (!foundDTD)
    wakeUp(sb.toString().getBytes());
    //populate the elements and atrributes vectors
    FileInputStream fis = new FileInputStream("C:/form.dtd");
    processDTDElements(fis);
    foundDTD = true;
    sb.setLength(0);
    else
    sb.append("<");
    String element = (String)elementsList.get((int)in.read());
    elementNames.addElement(element);
    sb.append(element);
    wakeUp(sb.toString().getBytes());
    //baos.write(sb.toString().getBytes());
    sb.setLength(0);
    break;
    case START_ATTRIBUTE:
    sb.append("[");
    sb.append(attributesList.get((int)in.read()));
    wakeUp(sb.toString().getBytes());
    //baos.write(sb.toString().getBytes());
    sb.setLength(0);
    break;
    case CLOSE_ELEMENT:
    wakeUp(sb.toString().getBytes());
    //baos.write(sb.toString().getBytes());
    sb.setLength(0);
    sb.append(elementNames.get(0));
    elementNames.remove(0);
    sb.append(">");
    break;
    default:
    sb.append(c);
    synchronized (baos)
    baos.notify();
    System.out.println(" in run method*****");
    }catch(Exception e)
    e.printStackTrace();
    } // end run
    private void wakeUp(byte b[])
    System.out.println(" in wakeup method*****");
    synchronized (baos)
    try
    baos.write(b);
    catch(Exception e)
    System.out.println("exception caught");
    e.printStackTrace();
    baos.notify();
    public boolean markSupported()
    return false;
    public int read(byte[] b1, int off, int len) throws IOException
    return readData(b1, off, len);
    public int read() throws IOException
    return readData(null, 0, 1);
    public int read(byte[] b1) throws IOException
    return readData(b1, 0, b1.length);
    private int readData(byte[] b1, int off, int len) throws IOException
    String s = null;
    while(true)
    if (closed && baos.size() == 0)
    return -1;
    int size = baos.size();
    if (baos.size() > 0) // Have at least one byte
    if( b1 == null)
    byte b[] = baos.toByteArray();
    baos.reset();
    baos.write(b, 1, b.length-1); // baos contains all data except b[0]
    return b[0];
    else
    int minLen = Math.min(baos.size(), len);
    //System.out.println(" baos contents are: " + baos.toString());
    byte b[] = baos.toByteArray();
    s = b.toString();
    int length = baos.size() - minLen;
    baos.reset();
    baos.write(b, 0, length );
    System.arraycopy(b, 0, b1, off, minLen);
    return minLen;
    try
    synchronized (baos)
    if (!closed)
    baos.wait();
    catch(java.lang.InterruptedException ie)
    ie.printStackTrace();
    }// end read data
    private boolean hasMoreTokens()
    String s = null;
    try
    if (br != null)
    if (st == null || !st.hasMoreTokens())
    // read in a line, create a st
    s = br.readLine();
    st = new StringTokenizer(s,"\n\r\t ");
    }catch(Exception e)
    e.printStackTrace();
    return st.hasMoreTokens();
    private String nextToken() throws Exception
    String token = null;
    if(st.hasMoreTokens())
    token = st.nextToken();
    }else
    String s = br.readLine();
    st = new StringTokenizer(s,"\n\r\t ");
    token = st.nextToken();
    return token;
    private void processDTDElements(FileInputStream is)
    try
         // get the file desriptor from the input Stream
         FileDescriptor fd = is.getFD();
         // create a new buffered reader
    br = new BufferedReader(new FileReader(fd));
    boolean lookForEndTag=false;
    boolean lookForEndAtt=false;
    while (hasMoreTokens())
    String token = nextToken();
    if (lookForEndTag)
    if (!token.endsWith(END_ELEMENT))
    continue;
    }else
    lookForEndTag = false;
    continue;
    if (token.startsWith(XMLTAG))
    lookForEndTag = true;
    else if (token.startsWith(ELEMENTTAG))
    token = nextToken();
    if ( elementsList.indexOf(token)<0)
    elementsList.addElement(token);
    lookForEndTag = true;
    else if (token.startsWith(ATTLIST))
    String dummy = nextToken(); // discard element name
    do
    token = nextToken();
    if (token.endsWith(">"))
    break;
    if (attributesList.indexOf(token)<0 )
    attributesList.addElement(token);
    token = nextToken();
    if ( token.startsWith("CDATA") || token.startsWith("ID") )
    token = nextToken();
    if (token.equals("#FIXED "))
    token = nextToken();
    lookForEndAtt = token.endsWith(END_ELEMENT);
    else if ( token.startsWith("(") )
    do
    token = nextToken();
    }while ( token.indexOf (")") == -1);
    token = nextToken();
    lookForEndAtt = token.endsWith(END_ELEMENT);
    } while (!lookForEndAtt);
    }//end if
    }//end while
    }catch(Exception e)
    e.printStackTrace();
    }finally
    try
    br.close();
    }catch(Exception e)
    e.printStackTrace();
    }// end process elements
    public void close() throws IOException
    closed = true;
    synchronized(baos)
    baos.notify();
    }// end XMLinputCompression class

    Your problem probably has something to do with where you tell baos (or rather, the thread that it is in) to wait. You have:synchronized (baos)
        if (!closed)
            baos.wait();
    }Which acquires a lock on baos, then tells its own thread to wait without ever relinquishing its lock on baos. So when your main method calls the read method, it hangs immediately when it tries to access baos because it is still locked. So what you're seeing is a basic deadlock condition.
    Really, you're not gaining anything with your multithreading in this case. But that's a different issue.

  • Some help with counter

    I am very new to java and would like a little assistance with the following code. The problem is in the iCount, it is supposed to count to 30 and then exit the program. Program fails to exit. Any clue as to where to look would be appreciated.
    Thanks!!
    // Program Name:Mortgage Payment Calculator
    // Date Written:04-09-06
    // Student Name: XXXXXXXX
    // Facilitator: XXXXXXXX     
    // Purpose of Program:Calculate mortgage payments
    // Modified 04-21-06:Revision 1.1 added Amortized payment data.
    // Write the program in Java (without a graphical user
    // interface) using a loan amount of $200,000 with an
    // interest rate of 5.75% and a 30 year term. Display
    // the mortgage payment amount and then list the loan
    // balance and interest paid for each payment over the
    // term of the loan. If the list would scroll off the
    // screen, use loops to display a partial list, hesitate,
    // and then display more of the list.
    // Modified 04-28-06: Revision 1.2, Write the program in Java
    //                    (without a graphicaluser interface) and have it 
    //                    calculate the payment amount for 3 mortgage loans:
    //                         7 year at 5.35%
    //                         15 year at 5.5%
    //                         30 year at 5.75%
    // Use an array for the different loans. Display the mortgage
    // payment amount for each loan.
    // Modified 05-01-06: Revision 1.3, Write the program in Java
    //                           (without a graphical user interface) and
    //                           have it calculate the payment amount for
    //                            3 mortgage loans:
    //                         7 year at 5.35%
    //                         15 year at 5.5%
    //                         30 year at 5.75%
    // Use an array for the different loans. Display the
    // mortgage payment amount for each loan and then list the
    // loan balance and interest paid for each payment over the
    // term of the loan. Use loops to prevent lists from
    // scrolling off the screen.
    // load API's needed to perform the formatting ofvariables
    import java.io.*;
    import java.text.DecimalFormat;
    import java.text.NumberFormat;
    import java.util.Locale;
    // Here we declare our class
    public class MortgageCalculatorwk5
        // Declaration of the main method
        public static void main (String[] args)throws IOException
            // Used to format the outputs
               NumberFormat currency = NumberFormat.getCurrencyInstance(Locale.US);
             DecimalFormat percentage = new DecimalFormat("0.00%");
              DecimalFormat decimalPlaces = new DecimalFormat("0.00");
              BufferedReader keyboardInput = new BufferedReader (new InputStreamReader (System.in));
                   //Declaration of variables used **Restructured Variable block in Revision 1.1**
                   //Revision 1.3 Variables restructured for Arrays
                  double monthlyPayment[];
                  double loanAmount;
                  //double yearlyInterest;     //changed to an array in Revision 1.2
                  double monthlyPrinciple[];
                  double calcPrinciple[];          //Not Needed in 1.2**added back in Revision 1.3 as an array**
                  double calcInterest[];          //Not Needed in 1.2**added back in Revision 1.3 as an array**
                  double calcBalance[];          //Not Needed in 1.2**added back in Revision 1.3 as an array**
                  int iCount;                         //Not Needed in 1.2**added back in Revision 1.3**
                  //int termYears;                     //changed to an array in Revision 1.2
                  int termMonths = 360;
                  int Amortized;                    //Not Needed in 1.2**added back in Revision 1.3**
                  String keyPress;               //Added in Revision 1.3 for keyboard input
                      // Assigned variables declared above.**Updated variable block in Rev. 1.1 to match declarations**
                      // Revision 1.3, variables to match declarations
                      loanAmount = 200000;
                      //yearlyInterest = .0575;             //Revised in 1.2
                      monthlyPayment = new double[3];       //Changed to Array in Revision 1.3
                      Amortized = 0;                            //Not needed in 1.2**added back in Revision 1.3**
                      //termYears = 30;                      //Not needed in 1.2
                      calcPrinciple = new double[3];        //Not Needed in 1.2**added back in Revision 1.3**
                      calcBalance = new double[3];        //Not Needed in 1.2**added back in Revision 1.3**
                          calcInterest = new double[3];       //Not Needed in 1.2**added back in Revision 1.3**
                          monthlyPrinciple = new double[3]; //Added in Revision 1.3
                          keyPress = "";                           //Added in Revision 1.3
                          iCount = termMonths;
                     //Array for yearly interest rates     
                     double[] yearlyInterest = {.0535,.055,.0575}; //added in Revision 1.2
                     //Array for loans in years
                     int[] termYears = {7,15,30};//added in Revision 1.2
            //Output to the display**Revision 1.1 added rev level and title        
            System.out.println ();     
              System.out.println ("\t\t\t McBride Financial Services ");
              System.out.println ();
              System.out.println ("\t\t\t     Mortgage Calculator");
              System.out.println ("\t\t\t         Version 1.3     ");
              System.out.println ();
         for (int a = 0; a < yearlyInterest.length; a++)
                   //Calculations for yearly interest rate and 
                   //total number of months for each loan
                   calcBalance[a] = loanAmount;//Added in Revision 1.3
                   termMonths = termYears[a] * 12;
                   monthlyPrinciple[a] = yearlyInterest[a] / 12;
         if      (iCount < (termYears[a] * 12))
              iCount = (termYears[a] * 12);
              // Here is the Calculator Algorithm**Revision1.1 updated variables and caclulations
                 monthlyPayment[a] = (loanAmount * (Math.pow((1 + monthlyPrinciple[a]), termMonths)) * monthlyPrinciple[a]) / (Math.pow((1 + monthlyPrinciple[a]), termMonths)-1);
                      //calcBalance = loanAmount; //Not Needed in Revision 1.2
                      //iCount = termMonths; //Not Needed in Revision 1.2
              System.out.println("For " + termYears[a] + " years: ");
              System.out.print(currency.format(loanAmount));
              System.out.print(" at a yearly rate of ");
              System.out.print(percentage.format(yearlyInterest[a]) + ", ");
              System.out.print("Monthly Payment is " + currency.format(monthlyPayment[a]) + ".");
              System.out.println("\n\n");
              //System.out.println(decimalPlaces.format(monthlyPayment)); Revision 1.2 changed to currency format
    }// end for loop
         System.out.print ("Press ~Enter~ to Continue");
         keyPress = keyboardInput.readLine();
         System.out.println("\n\n\n");
    /***THE FOLLOWING BLOCK OF CODE HAS BEEN REMOVED PER REVISION 1.2************
    *Added and slightly modified the following block of code for Revision 1.3*/     
         //try
              //Thread.sleep(2000);  //2 second hesitation **Removed on Revision 1.3
         // This checks to see if an interruption
         // has occured in the count sequence.
         //The braces are empty because we will
         //not have any other code call for an interruption.
         //catch (InterruptedException e) {}
            System.out.println("\n\n             7 Years\t            15 Years\t\t    30 Years");     
              System.out.println("Pmnt\tInterest/Balance\tInterest/Balance\tInterest/Balance");
            System.out.println("=============================================================================");       
            System.out.println();      
        for (; iCount>0;)//This loop will run as long as iCount is greater than 0.
                 Amortized++;
                 System.out.print("\n " + Amortized);
        for
                  (int a = 0; a < yearlyInterest.length; a++)
                 calcInterest[a] = calcBalance[a] * monthlyPrinciple[a];
                 calcPrinciple[a] = monthlyPayment[a] - calcInterest[a];
                 calcBalance[a] = calcBalance[a] - calcPrinciple[a];
         switch (a)
              case 0:
                      if (calcBalance[a] <= 0.0)
                           calcBalance[a] = 0.0;
                   if
                        (calcInterest[a] <= 0.0)
                        System.out.print("\t\t\t    ");     
                   else
                        System.out.print("\t  " + currency.format(calcInterest[a]) + "\t\t");
    } //end if statment
                     else //calcBalance[a] is NOT <= 0
                 if (calcInterest[a] < 1000.0) //Used for alignment
                          System.out.print("\t" + currency.format(calcInterest[a]) + "\t");
                     else
                          System.out.print("\t" + currency.format(calcInterest[a]));
                          System.out.print(currency.format(calcBalance[a]));
    } //end else statment
                 break;
    } //end case
              case 1:
                      if
                           (calcBalance[a] <= 0.1)
                       calcBalance[a] = 0.0;
                 if
                      (calcInterest[a] <= 0.0)
                       System.out.print("\t\t\t");     
                 else
                       System.out.print("\t" + currency.format(calcInterest[a]) + "\t\t");
    } //end if statment
                  else
                 if
                      (calcInterest[a] < 1000.0) //For alignment
                          System.out.print("\t" + currency.format(calcInterest[a]) + "\t");
                     else
                          System.out.print("\t" + currency.format(calcInterest[a]));
                          System.out.print(currency.format(calcBalance[a]));
    } //end else
                 break;
    } //end case
                case 2:
                 if
                      (calcBalance[a] <= 0.0)
                       calcBalance[a] = 0.0;
                 if
                      (calcInterest[a] <= 0.0)
                       System.out.print("\t\t\t    ");     
                  else
                       System.out.print("\t" + currency.format(calcInterest[a]) + "\t\t");
    } //end if
                  else //calcBalance[a] is not <= 0
                  if
                       (calcInterest[a] < 1000.0) //For alignment
                          System.out.print("\t" + currency.format(calcInterest[a]) + "\t");
                     else
                          System.out.print("\t" + currency.format(calcInterest[a]));
                          System.out.print(currency.format(calcBalance[a]));
    } //end else
                 break;
    } //end case
    } //end switch
    } //end loop                    
        if (Amortized % 12 ==0 ) { //Screen prints 12 (1 year) lines then waits for input from keyboard
                   System.out.println();
                   System.out.print("=============================================================================\n");       
         for
              (int a = 0; a<yearlyInterest.length; a++)
                   System.out.print("  At " + (Amortized/12) + " year(s) ");
                  System.out.print("Balance on Loan " + (a+1) + " is $");
                  System.out.println(currency.format(calcBalance[a]) + ".");          
                     //Thread.sleep(2000); //2 second hesitation Replaced with Keyboard input on Revision 1.3
                     System.out.print ("Press ~Enter~ to Continue");
                   keyPress = keyboardInput.readLine();
         if
                   (calcBalance[2] > 0.1 )
                   System.out.println("\n\n             7 Years\t            15 Years\t\t    30 Years");     
                   System.out.println("Pmnt\tInterest/Balance\tInterest/Balance\tInterest/Balance");
                   System.out.println("===========================================================================");
         // This checks to see if an interruption
         // has occured in the count sequence.
         //The braces are empty because we will
         //not have any other code call for an interruption.
         //catch (InterruptedException e) { }
         iCount = iCount-1;//counter
    }//end if
    }//end if
    }//end loop
    }//end main
    }//end class

    Have you ever heard of methods? How about Objects? How about Classes?
    Your solution looks better suited for basic or qbasic.
    I for one am not even going to look at your spagetti code to try to figure out where your counter went astray.....
    http://java.sun.com/docs/books/tutorial/getStarted/index.html
    http://java.sun.com/docs/books/tutorial/java/nutsandbolts/index.html
    http://java.sun.com/docs/books/tutorial/java/index.html
    You should study before you do..
    Im sorry if I'm blunt, I dont mean to be disrespectful, but in the short time I have been a member in these forums, this truely qualifies as the wosrt code I have ever seen. You dont even make an attempt at being object oriented.
    I highly suggest you do some of the tutorials, at a minimum cover the language basics, object basics, methods, and classes. Then really think about the the problem you are trying to solve, describing the objects involved.
    Good luck.
    JJ

  • Need help with VBScript Urgent

    Hi, I am working on a specific project which requires a file to be updated on all users machine before deployment. I have tried a script which is not working and does not give any error either. Please check this for me urgently as I am running short of time. 
    Requirement: Script should force copy a file located on a common file share to a folder in users machine. I am not deploying this script via any GP or SCCM due to certain reason. I will be sending mail to users with a hyperlink which should trigger the script
    and perform the action. I would be delighted if there is a way if users can get a pop up window stating "Successfully Copied" or some sort. 
    Here is my incomplete script.
    Set objFso=createObject("scripting.fileSystemObject")
    set objWShell=wScript.createObject("WScript.Shell")
    usrName=objWShell.expandEnvironmentStrings("%USERNAME%")
    strFileToCopy="\\ja-rfzitd\INSTDIR\000 Sephora - UAT\Foundation\test.fcf"
    strFolder="C:\Users\%USERNAME%\AppData\Roaming\Test\"
    if objFso.folderExists(strFolder) then
    objFso.copyFile strFileToCopy,strFolder&"\",true
    end if

    Try changing this line:
    strFolder="C:\Users\%USERNAME%\AppData\Roaming\Test\"
    to this:
    strFolder="C:\Users\" & usrName & "\AppData\Roaming\Test"
    Environment variable expansion is not automatic in VBScript strings (evidenced by the fact that you had to call the ExpandEnvironmentStrings method of the WshShell object on the previous line). I also removed the trailing "\" from the string because
    you're already adding it when you call the CopyFile method.
    -- Bill Stewart [Bill_Stewart]

  • NEED HELP WITH BLACKBERRY Urgent!! Please

    Hey guys well when I plugged in my blackberry into my desktop manager it told me to update the device software and I did and it started installing it. But then towards the end its just stopped all of a sudden and said fatal error and my phone was left like this.  I didn't touch it all while it was installing it please help!!
    [IMG]http://i296.photobucket.com/albums/mm173/elsantaclause/DSCN0474.jpg[/IMG]
    [IMG]http://i296.photobucket.com/albums/mm173/elsantaclause/DSCN0474.jpg[/IMG]

    Hi and Welcome to the Forums!
    Wow -- I've never seen that screen. Not at all sure what it even means. But, here's a process that I once found for recovering a bricked device...I've never had to use it, so I can't vouch for it's correctness...but at this point, what have you got to lose?
    http://adlen45.activeboard.com/index.spark?forumID=123568&p=3&topicID=18834966
    Hope it helps.
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Help with Count function

    Post Author: RJPiekos
    CA Forum: Desktop Intelligence Reporting
    I am trying to use the count function to count the number of unique PO numbers in a column. The program returns a value of "1" even when there are no PO's to be counted. Is there some system setting that i am missing.
    The universe that i am using is a free-hand SQL query to to an MS Access .mdb file. (if that makes a difference)
    Desktop IntelligenceBO 11.5
    Rick

    Post Author: RJPiekos
    CA Forum: Desktop Intelligence Reporting
    Found my problem - 'empty' values in the PO column were not NULL.

  • Help with mysql URGENT!!

    i get the error....
    warning: supplied argument is not a valid MySQL result resource in /var/www/html/php/db1.php on line 18
    line 18 being....
    while ($row = mysql_fetch_row($resultID)
    code for printing data is here
    none of my data prints
    PLEASE HELP ME, THANKS IN ADVANCE FOR YOUR HELP.
    htnaks,
    ELVIS

    are you sure this is your code?
    while ($row = mysql_fetch_row($resultID)
    code for printing data is here
    It misses a right ) at the first line.
    PC

  • Need help with Installing Canon LBP 2900B on Macbook Pro OSX 10.6.8

    I know this is going to sound silly, but really need help with this, URGENTLY!!!
    Bought a Canon LBP2900B printer more than a year ago, and was using it on my MacBook Pro with OSX Snow Leopard (10.6.8) very well. My hard disk recently crashed and now I cannot reinstall the printer, nor can I find the driver for it anywhere for the Mac.
    Have searched all the forums and followed all discussion threads on the Apple Communities as well, but none of the solutions seem to work. Even went back to @Dexter's solution with trying to download the file from the link http://boolet.free.fr/CAPT.zip (this is what I had done when I bought the printer, and it worked perfectly) but the link doesn't exist anymore.
    Extremely grateful if anyone can put up a solution to this, or alternatively, IF ANYONE HAS THE OLD CAPT.ZIP FILE AND CAN UPLOAD IT.
    Thanks in advance. Look forward to your solutions.
    Cheers

    Depends on how the partitons are arranged. If they're exactly as quoted, then yes.
    Open Disk Utility and select the partition tab.
    In the diagram, the top partition needs to be the one you're booted from, and partition 2 the middle one.
    Select Partiton 2 so that it's highlighted, and click the '-' button below the diagram.
    Drag the bottom right corner of partition 1 down to meet partition 3.

  • Help with looping and counting

    i am in a CS 1 class and need help with this loop
    /*Write a program that will allow the user to enter a character
              until the capital letter Z is entered
         The program should count the number of letters entered
              and print the total after the loop is completed*/
    here is what i have it doesn't end nor does it count and i don't know hwo to make it count also i suck at do..while loops hehe
    char b,Z=0;
              Scanner a = new Scanner(System.in);
         do
                   System.out.print("Enter a letter: "+"\n");
                   b=a.next().charAt(0);
              while (b !=Z);
    i know that its not even close to being right just help me out here
    Edited by: purplesmurf on Nov 14, 2008 7:25 PM

    The following program will count the number of chacters entered until Z is enetered.
    import java.io.*;
    class count
         public static void main(String[] args)throws IOException
              char ch;
              int cnt=0;
              DataInputStream br=new DataInputStream(System.in);
              do
              System.out.print("Enter a character:");
              ch=(char)br.read();
              if(ch!='Z')
                   cnt++;
              else
                   break;
              }while((ch=(char)br.read())!='Z');
              System.out.println("The Number of entered characters are:"+cnt);
    }

Maybe you are looking for

  • How to use Remote key for linking two repository

    Hi, I have a challenge like not to repeate common tables like Company_code,Currency,Vendor name,customer name across all repositories. Is there any way I can use 'Remote key' to link different repository. I can create a Main table with all common att

  • Problem in making Marketing Attribute set Default

    Hi Experts, I am facing some issue while making selection of marketting attribute set during BP creation I was able to make a default set in individual account but there is some other set for corporate account which i need to default while making the

  • How do am I supposed to use the iPhone 3g?

    The phone is a piece of crap, I can't update to iOS 4.2 to make it faster. Worst of all most of the time most apps like messages or Safari crash on the first time opening them, I have to open them multiple times. I want some support or something fast

  • Pc sync does not handle foreign characters in cont...

    i have lots of contacts with accents or umlauts in their names. After synching with my pc's contact book however, those names will show up twice or up to six times in my phone contact list. This also happens with any other details such as the street

  • Is there Any difference Between OBPM 10g And AlBPM 6.0

    Hello Friends I would like know is There any difference between the Oracle BPM 10g and ALBPM 6.0 . ?? The second one is Difference between AlBPM5.7 and ALBPM 6.0 Thanks In Advance with Regards Sandeep Edited by: user12036530 on Oct 18, 2009 9:08 PM