Use of max in MATH

I am trying to find the max value of two floating point numbers. Please see code. I am not sure why I get the error(symbol : method max (float,float)) do I have to call this in its own method? Thank you for the help, drumz.
import java.awt.Graphics;
import javax.swing.*;
public class Lab3_7 extends JApplet{
     float largest;                //variable for largest answer
     public void init(){
          String firstNumber;     //first string entered by user
          String secondNumber; //second string entered by user
          float number1;               //variable for conversion of user input
          float number2;               //variable for conversion of user input
          // get numbers from user
          firstNumber = JOptionPane.showInputDialog("Please enter first floating point number");
          secondNumber = JOptionPane.showInputDialog("Please enter second floating point number");
          //Convert numbers to floating point variables for calculations
          number1 = Float.parseFloat (firstNumber);
          number2 = Float.parseFloat (secondNumber);
          //Calculate either the largest number or that both numbers are equal.
          largest = Object max(number1,number2);
     public void paint( Graphics g ){
          super.paint( g );
          g.drawString ( "largest number is" + largest, 25, 25 );
}          

import java.awt.Graphics;
import javax.swing.*;
public class Lab3_7 extends JApplet{
float largest; //variable for largest answer
public void init(){
String firstNumber; //first string entered by user
String secondNumber; //second string entered by user
float number1; //variable for conversion of user input
float number2; //variable for conversion of user input
// get numbers from user
firstNumber = JOptionPane.showInputDialog("Please enter first floating point number");
secondNumber = JOptionPane.showInputDialog("Please enter second floating point number");
//Convert numbers to floating point variables for calculations
number1 = Float.parseFloat (firstNumber);
number2 = Float.parseFloat (secondNumber);
//Calculate either the largest number or that both numbers are equal.
largest = Math.max(number1,number2);
public void paint( Graphics g ){
super.paint( g );
g.drawString ( "largest number is" + largest, 25, 25 );
}

Similar Messages

  • How to get cm:search to use the max attribute when creating the SQL query?

    When we use the max attribute in the cm:search tag, it does not seem to honor the max attribute when creating the SQL query. However, the result returned from the tag is limited to the number specified by the max attribute. Then the tag seems to work as intended, but the performance will be sub optimal when the SQL query returns unnecessary rows to the application.
    We use the cm:search tag to list the latest news (ordered by date), and with the current implementation we have to expect a decrease in performance over time as more news is published. But we can’t live with that. We need to do the constraint in the SQL query, not in the application.
    The sortBy attribute of cm:search is translated to “order by” in the SQL query, as expected.
    Is it possible to get cm:search to generate the SQL query with an addition of “where rownum <= maxRows”?

    Hi Erik,
    The behavior of a repository in regards to the search tag's max results parameter is dependent on the underlying repository's implementation. That said, the OOTB repository in WLP does augment the generated SQL to limit the number of rows returned from the database. This is done in the parsing logic. This behavior may differ with other repository implementations.
    -Ryan

  • SharePoint - Error_1_Error occurred in deployment step 'Add Solution': Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was rea

    Hi,
    I am Shanmugavel, SharePoint developer, 
    I am facing the below SharePoint 2013 deployment issue while deploying using VS2012.
    If i will deploy the same wsp or existing wsp
    (last build) using direct powershell deployment, the solution adding properly, but the same timeout exception coming while activation the features.  Please find the below error.
    I tried the below activists:
    1. Restarted my dev server, DB server. 
    2. tried the same solution id different server
    3. tried existing wsp file (last build version)
    4. Deactivated all the features, including project Active deployment configuration.... but still i am facing the same issue.
    I hope this is not coding level issue, because still my code is not start running, before that some problem coming.
    Please help me any one.....  Last two days i am struck because of this...

    What you need to understand is the installation of a WSP does not do much. It just makes sure that you relevant solution files are deployed to the SharePoint farm.
    Next comes the point when you activate the features. It is when the code which you have written to "Activate" certain features for your custom solution.
    Regarding the error you are getting, it typically means that you have more connections (default is I guess 100) open for a SQL database then you are allowed to.
    If you have a custom database and you are opening a connection, make sure you close it as well.
    Look at the similar discussion here:
    The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool
    size was reached[^]
    I would suggest further to look at the
    ULS logs[^] to get better insight.
    Manas Bhardwaj's Stream : www.manasbhardwaj.net

  • Use of max stock level w/o lot size HB

    hello champs..
    need  a help on below functionality
    Can I have the functionlity of max stock level without using "lot size - HB" in material master.
    my requirement..tht system should not create any procurement proposal if stock reachs at max level..
    but with this i am using min lot size also..and this functionality got vanish if I use "lot size=HB" ..system dont see min or max lot size..it just create the proc proposal for the qty upto max stock level..
    my requirement
    for a material max stock level -100
    min lot size - 50  , max lot size 80
    and if my stock is 30 ,and my reuirement is for 80..system should not cross the max stock level and should create the prc proposal for 70 only..
    pl share your thoughts on this..I'll appriciate wih necessary reward points..
    Br
    Sumit

    Hi
    thanks for reply..but i am not sure whther w/o using HB max stock level will be considered or not..
    i yet have to test the same but as per SAP , if you want t maintain themax stock level in the plant , lot size should be EX
    is this undertsnding is okie..
    thx in advance
    BR
    Sumit

  • Use of MAX function in Query Designer

    Dear all,
    i want to create a report that gives ONE line per period that holds the MAX of several lines per period. So NO addition of the KF but just one line item.
    I tried to use the MAX function and/or MAX drop-down boxes via properties on KF,
    but they all provide the wrong result (mostly the MAX after summaction of the KF).
    Any ideas ??
    Greetz,
    Herman

    Hi Herman
        Please check the KF infoobject property which might have been set to Summation.  You need to change the property of the KF to MAX if you wish to have MAX value. 
        Hope this might be helpful to you
    Thanks
    Kishore Kusupati

  • Can I use Count, Max function in PLSQL BLOCK.

    Can U help me to use count, max function in PLSQL BLOCK.
    Because it is giving me error "It is a SQL function"

    SELECT COUNT(*)
    INTO l_variable
    FROM dual;
    Will work inside PL/SQL

  • Using SELECT MAX to default to certain days

    Gurus,
    Right now, I use SELECT MAX("File Date"."Date")FROM "Subject Area" to pull the most recent date available. I'd like for this to pull the last two or three days of data available. Any suggestions?
    I have this set under a report filter for the analysis. Thanks in advance!

    Try this
    SELECT File Date.Date saw_0, TOPN(File Date.Date, 3) saw_1, Facts."#Sales" saw_2 FROM "Subject Area" ORDER BY saw_0
    Let me know updates
    Edited by: Srini VEERAVALLI on May 6, 2013 5:10 PM
    Your initial post talks about logical query from OBIEE, so I've logical query. try to put that in answers instead of running in Toad or sql developer etc..
    Edited by: Srini VEERAVALLI on May 6, 2013 8:20 PM

  • How do I use sqrt() and pow() math functions?

    I tried starting with import java.lang.Math.*; and using sqrt() and pow(), but I get an error response in compilation.
    //** 1/pi calculation program using Ramanujan's forumula **//
    //** by n=2 iteration, double precision value for 1/pi repeats **//
    import java.lang.Math.*;
    import java.io.*;
    public class CalcInversePiRamanujan {
      public static void main(String args[]) {
        double n=0, term, four_n_factorial=1, n_factorial=1, inverse_pi=0;
        inverse_pi = four_n_factorial * 1103 * 2 * sqrt(2) / 9801; //** initial value for n=0 **//
        System.out.println(inverse_pi);
        for (n=1, four_n_factorial=1, n_factorial=1; n<=3; n++) {
            four_n_factorial *= (4 * n);
            four_n_factorial *= (4*n-1);
            four_n_factorial *= (4*n-2);
            four_n_factorial *= (4*n-3);
            term = four_n_factorial;
            n_factorial *= n;
            term /= pow(n_factorial, 4);
            term *= 1103 + 26390 * n;
            term /= pow(396, 4 * n);
            term *= 2 * sqrt(2);
            term /= 9801;
            inverse_pi += term;
            System.out.println(n, term, inverse_pi);
        System.exit(0);
    }

    all methods in math class are static so you have to call them as
    Math.pow() and Math.sqrt() you dont have to import any additional packages as Math is a class available in java.lang package
    you have to change your
    System.out.println(n, term, inverse_pi); to
    System.out.println(n+ term+ inverse_pi);
    math class also provides the value of Pi you can access it using Math.PI

  • How to use Function MAX in xsl

    Hi ,
    iam facing a unique issue
    i want to print maximum postion by using the function MAX
    My style sheet is working fine in Jdev but same XSL sheet is giving error when i run it in oracle Applications.
    below is xsl logic
    <xsl:template name="ttpgds" match="ARXEURSL" mode="temp2">
    <xsl:variable name="x">     
    <xsl:for-each-group select="G_ROW[INTRA_EU_TRX_CODE =('GOOD')]" group-by="concat(VAT_TAX_NO,BILL_CUST_NAME,INTRA_EU_TRX_CODE)">
    <CHKPST><xsl:value-of select="position()"/></CHKPST><xsl:text>
    </xsl:text>
    </xsl:for-each-group>
    </xsl:variable>
    <xsl:for-each select="$x">
    <xsl:variable name="jCount" select="max(CHKPST)"/>
    <xsl:value-of select="ceiling($jCount)"/>
    </xsl:for-each>
    </xsl:template>in oracle applications iam getting below error:
    Caused by: oracle.xdo.parser.v2.XPathException: Expected ')' instead of 'CHKPST'.
    may i know how i can use the function MAX in XSl ??
    Any suggestions?
    Thanks
    Anil

    Hi,
    Hope the following helps..
    1)
    LOOP AT IT_OUTPUT.
    Call the function module to get the tracking number and store the output in the
    variable V_TRACKINGNO.
      IT_OUTPUT-TRACKING_NO = V_TRACKINGNO.
      MODIFY IT_OUTPUT TRANSPORTING TRACKING_NO.
    ENDLOOP.
    2) Date conversion
    DATA: V_CHAR(10) VALUE '2006.11.17'.
    DATA: V_DATE       TYPE SYDATUM.
    CONCATENATE V_CHAR(4) V_CHAR5(2) V_CHAR8(2) INTO V_DATE.
    WRITE: V_DATE TO V_CHAR MM/DD/YYYY.
    WRITE: / 'MM/DD/YYY Format - ',  V_CHAR.
    Please make sure to reward points for helpful answers..
    Thanks,
    Naren

  • Use of MAX function

    Hi,
    I am using parent-child hierarchy and in my reports I want to show Max(hierarchy_level). When I use the function MAX directly in the report it works fine in every way. But I want to have this kind of column in the BI Server presentation catalog so the user does not need to add MAX in Analysis/Answers (this is 11g). Normally this would imply a Max(hierarchy_level) as a logical function, but in the BI Server it is not allowed with MAX function in the logical function so it does not work.
    The hierarchy level is just a column from a dimension table and creating it as a fact column is not a very good solution. I also tried to solve this in many different ways, but only the MAX funtion in Analysis/Answers allways give the correct result. Used in combination with other dimensions etc. I want the exact same behaviour as I get when using MAX in analysis.
    Any good ideas to solve this? Is there another function in the BI Server that works the same way as MAX ?

    Very often, about a primary key, see for example our italian accounting application (our VAT invoices:fatture IVA) ), where the holes might be a problem.
    Yes Rosario, of course I know that, and that's why I said "in this scenario" : if primary key is the only purpose, I don't think holes could be a problem.
    Buona giornata anche a te.

  • How to use min-max functions for date in transformation in bpel?

    Hi,
    I have a requirement where i need to map earliest date of a Source field among all the dates to a target field in a transformation file in BPEL. There are functions called max-value-among-nodeset and min-value-among-nodeset in mathematical functions but they can be used only for numbers and strings.How to do these with dates?
    Thanks,
    Prasanna

    I exactly have the same requirement.Are you able to solve this?
    Its very urgent.Please help me.

  • How to use the MAX DATE condition in WHERE CLAUSE FILEDS

    Hi,
    I am trying to fetch the result for getting maximun date but when i try to execute the query i am getting the error as follows.
    CONDITION : trunc(max(RD.DATERECEIVED)) BETWEEN TO_DATE('01/08/2011','DD/MM/YYYY') AND TO_DATE('01/08/2011','DD/MM/YYYY')
    ERROR: Group function is not allowed here.
    CHEERS,
    PRABU AMMAIAPPAN

    I see a couple of problems here.
    First, what you posted below is not a syntactically valid query. It seems to be part of a larger query, specifically, this looks to be only the GROUP BY clause of a query.
    Prabu ammaiappan wrote:
    Hi,
    I Have a group function in the Query. Below is the Query i have used it,
    GROUP BY S.FREIGHTCLASS,
    R.CONTAINERKEY,
    S.SKU,
    S.DESCR ||S.DESCRIPTION2,
    S.PVTYPE,
    RD.LOTTABLE06,
    R.WAREHOUSEREFERENCE,
    RD.TOLOC,
    R.ADDWHO,
    R.TYPE,
    S.CWFLAG,
    S.STDNETWGT,
    S.ORDERUOM,
    R.ADDDATE,
    C.DESCRIPTION,
    (CASE WHEN P.POKEY LIKE '%PUR%' THEN 'NULL' ELSE to_char(P.PODATE,'dd/mm/yyyy') END),
    NVL((CASE WHEN R.ADDWHO='BOOMI' THEN RDD.SUPPLIERNAME END),SS.COMPANY),
    RDD.BRAND,
    S.NAPA,
    RD.RECEIPTKEY,
    R.SUSR4,
    P.POKEY,
    RDD.SUSR1,
    r.STATUS, DECODE(RDD.SUSR2,' ',0,'',0,RDD.SUSR2),
    rd.SUSR3Second, the answer to your primary question, "How do I add a predicate with with a MAX() function to my where clause?" is that you don't. As you discovered, if you attempt to do so, you'll find it doesn't work. If you stop and think about how SQL is processed, it should make sense to you why the SQL is not valid.
    If you want to apply a filter condition such as:
    trunc(max(RD.DATERECEIVED)) BETWEEN TO_DATE('01/08/2011','DD/MM/YYYY') AND TO_DATE('01/08/2011','DD/MM/YYYY')you should do it in a HAVING clause, not a where clause:
    select ....
      from ....
    where ....
    group by ....
    having max(some_date) between this_date and that_date;Hope that helps,
    -Mark

  • Using ALEKS with Mac (math class review for college)

    Hi. I'm taking a math review class for college, and it's online. They want me to do it through something called ALEKS. Has anyone used this before? I've paid for the class, and tried downloading what they wanted me to download, but I got this error message:
    An error occurred during installation.
    This installer is not allowed to write files in your Java Plug-in lib/ext directory.
    When I clicked the error link, it said:
    mework/Versions/1.5.0/Home/lib/ext/test.tmp (Permission denied)
    Error #12: Error UseS_IP : 2, java.lang.Exception: sudo return 1
    Error #13: Error UseS_P_IP : 0, java.lang.Exception: Password null
    Info
    I've sent email to my professor, and to the ALEKS company about it, and I'm sure they'll respond. I just wanted to try asking here, in case anyone had done this before and knew what to do.
    Thanks.
    Hope everyone had a good Easter/Spring Break/etc..
    Penelope

    Did you follow the instructions here?

  • Use of Max. stack factor in EWM

    Dear Experts,
    We have these 2 fileds - Max.StackFactor &  Rem.Vol after Nesting under units of measurement tab in EWM product master.
    can you please give some hint on what is the purpose of these 2 fields?
    We have arequirement restrict stacking of HUs based on maximum height (i.e stacking of multiple HUs on a TU shouldnot exceed 2 Meter).
    Is it possible to acheive this in EWM usning above 2 fields?
    Appreciate any suggestions.
    Regards,
    Shashidhar

    Hi,
    this field is used in product specific parameters for Means of Transport, where you can enter consumption of transportation capacity for a given stack factor.
    Petr

  • Using RIGHT MAX CHARINDEX to get value

    declare @lotTech varchar(64)
    declare @lontNum varchar(64)SELECT @lotTech = RIGHT(MAX(l.lotID),CHARINDEX(' ','TECH'))
    FROM lots l
    if (@lotTech = '')
    SET @lotNum = 'TECH 1';
    else
    SET @lotNum = 'TECH' + SPACE(1) + @lotTech + 1;
    Can't get this to find if there is a null value or max value and 1 to concatnated data? 

    @productID as bigint,
    @lotNum as varchar(64),
    @manufactureDate as datetime,
    @expirationDate as datetime = null,
    @gradeDesc as varchar(64)
    as
    BEGIN
    declare @lotcheck varchar(64)
    declare @lotTech varchar(64)
    SELECT @lotcheck = lotid FROM Lots WHERE lotid = @lotNum
    if (@expirationDate is null)
    begin
    SELECT @expirationDate = dateadd(day, ch.expiration, @manufactureDate)
    FROM products p
    INNER JOIN chemicals ch on p.chemicalID = ch.chemicalID
    WHERE p.productID = @productID
    end
    if (@gradeDesc = 'TECH GRADE')
    begin
    SELECT @lotTech = RIGHT(MAX(l.lotID),CHARINDEX(' ','TECH'))
    FROM lots l
    if (@lotTech = '')
    SET @lotNum = 'TECH 1';
    else
    SET @lotNum = 'TECH' + SPACE(1) + @lotTech + 1;
    end
    if (@lotcheck is null)
    begin
    INSERT INTO Lots(lotID, chemicalID, expirationDate, manufactureDate, confirmed, productID)
    SELECT @lotNum as lotID, p.chemicalID, @expirationDate as expirationDate, @manufactureDate as manufactureDate, 0 as confirmed, p.productID
    FROM products p
    INNER JOIN chemicals ch on p.chemicalID = ch.chemicalID
    WHERE p.productID = @productID
    end
    else
    begin
    UPDATE Lots
    SET manufactureDate = @manufactureDate,
    expirationDate = @expirationDate,
    productID = @productID
    WHERE lotID = @lotNum
    end
    return
    END
    I'm showing more of the TSQL which works fine but the part I'm not understanding is the use of essentially parsing the data that is TECH and the number which has to be the maximum number for TECH.
    The output should be an ascending value concatnated with the word 'TECH' and a space.  Initially there is nothing in the lotNum column.  I need to get the MAX number out of the lots table for the paticular grade descripton -  'TECH GRADE'
    and then add 1 to that retrived number for the insert of the record. 
    So the first record to be inserted after the MAX number is found to be not present is
    TECH 1
    Following queries have to find the MAX number in the whole table and then add 1  and insert when 'TECH GRADE' description so
    TECH 2
    TECH 3

Maybe you are looking for

  • Message app not found on tablet.

    On my S5, if have an app that says Message, with a white envelope with a yellow paper sticking out of it. I can not figure out where the app came from. But it is not on my tablet, and I can't seem to find it in any app store. The only message app I g

  • Why wont my finished movie upload to youtube

    why wont my movie upload to youtube it just says its uploading and when its finished i check youtube and its not there!

  • How to set a anchor point alignment character in table??

    PLs help i am a new in javasprit. i have no idea how to do that>< 1. select the (align the decimal point) 2. 48mm 3. alignment character my script: var myDoc=app.activeDocument;     var    myParagraphStyle = myDoc.paragraphStyles.item("Table");      

  • [SOLVED] XDM question

    So I managed to get XDM running and working, but everytime I boot my machine, a login prompt on tty1 before XDM shows up (I'm pretty sure XDM is on tty2?). Is this normal, and if so, is there any way I can get rid of this? It's mildly annoying. Thank

  • Calculating price with qty in query

    Hi , I have requirement like this . User enter material price in the selection screen of my report and then i need to calculate the value in $ by multiply qty with price(which was enterd in selection screen) . Please can any body help to resolve this