Find Min,Max?

Please take a look at my code:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.text.DecimalFormat;
import java.text.NumberFormat;
public class StatisticGui extends JApplet
private JButton push;
private JButton calc;
private JTextField tf;
private JTextArea ta;
int push1,push2;
int sum=0,value,sum1=0;
int min,max,range,again;
double average;
double stad,stad1,pass;
public void init()
push1=0;
push=new JButton("Enter Num");
push.addActionListener(new button1());
calc=new JButton("Calc Stats");
calc.addActionListener(new button2());
tf=new JTextField(10);
ta=new JTextArea(16,20);
Container cp=getContentPane();
cp.setBackground(Color.gray);
cp.setLayout(new FlowLayout());
cp.add(tf,BorderLayout.WEST);
cp.add(push,BorderLayout.CENTER);
cp.add(calc,BorderLayout.CENTER);
cp.add(ta,BorderLayout.CENTER);
setSize (400,300);
private class button1 implements ActionListener
public void actionPerformed(ActionEvent event)
String text=tf.getText();
value=Integer.parseInt(text);
min=max=value;
if(value>=0)
push1++;
sum+=value;
sum1+=Math.pow(value,2);
if(value>=50)
push2++;
max = Math.max(max, value);
min = Math.min(min, value);
if(value<0)
do
again=JOptionPane.showConfirmDialog(null,"Invalid Number,Please enter again!");
while(again==JOptionPane.NO_OPTION);
average=(double)sum/push1;
pass= (double)push2 / push1;
stad = sum1/push1 - Math.pow(average,2);
stad1=Math.sqrt(stad);
range=max-min;
private class button2 implements ActionListener
public void actionPerformed(ActionEvent event)
DecimalFormat fmt=new DecimalFormat("0.##");
NumberFormat percent=NumberFormat.getPercentInstance();
ta.append("\nMean:" + fmt.format(average));
ta.append("\nStandDev:" + fmt.format(stad1));
ta.append("\nRange:" +min);
ta.append("\nPercentPass:" + percent.format(pass));
not thing wrong with my code but, i can not find the value of min and max, please help!

String text=tf.getText();
value=Integer.parseInt(text);
min=max=value;So your ''max' and 'min' will be set to 'value' ...
>
if(value>=0)
push1++;
sum+=value;
sum1+=Math.pow(value,2);
if(value>=50)
push2++;
max = Math.max(max, value);
min = Math.min(min, value);And now 'min' and 'max' are calcuelated from in effect
max = Math.max(value, value);
min = Math.min(value, value);
because you have previously set 'min' and 'max' to 'value'.
not thing wrong with my code but, i can not find the
value of min and max, please help!I agree, there is nothing wrong with your code (if you want 'min' and 'max' to be the last values you supplied)!

Similar Messages

  • Pivot view  - how to find min & max on a  level lower than selected..

    Hi all,
    we have a pivot view having structure.
    Year
    Dept |Count| Min | MAX |
    ABC | 87 | | |
    XYZ | 44 | | |
    Can we find out the min & max in the current year selected on quarter level & not on year and no show quarter on report. I.e the min count & max value of count in the 4 quarters.
    also for below structure.
         Year
    | Q1 | Q2 | Q3 | Q4 |
    Dept |Count| Min | MAX |Count| Min | MAX |Count| Min |MAX | Count| Min | MAX|
    ABC | | | | | | | | | | | | |
    XYZ | | | | | | | | | | | | |
    similarly find on quarter & for quarter we want the min & max on month level. i.e minimum & max in 3 months under that quarter.
    If we set the aggregation level as Min in max in pivot itself it shows the min & max same as the count as it calculates on the year level.
    Thanks,
    Dev

    Using hierarchies with exception aggregation can give strange results when aggregating to the parent nodes of the hierarchy. Recommendations:
    1) check whether the results are still wrong if you deactivate the hierarchy view
    2) build you exception aggregations globally. That is, do not define the exception aggregation in the structure of your query. Build it as a CKF on your InfoProvider.
    3) if the above steps don't work, perhaps you can use APD or get the exception aggregations calculated in the load to the InfoProvider rather than in BEx

  • Find MIN, MAX of multiple rows from multiple columns

    Hello,
    I need to figure out how to pull the MIN/MAX of multiple rows from multiple columns into one column. Even if some are NULL/blank.
    For Example: (C: Column, R: Row, N - NULL/Blank)
    C:____1____2____3____ 4____Max
    R:____20___22___13____4____*22*
    R:____N____N____32____14___*32*
    R:____N____12____N____N____*12*
    That is, it always gives a value for MIN/MAX unless there are NO values in all the rows of the columns.
    So if there is one value, it will select that for the MIN/MAX, as it's the smallest/biggest since there is nothing to compare it to.
    Here is my current code:
    CASE WHEN COLUMN 1 < COLUMN 2 THEN COLUMN 2 ELSE COLUMN 1 END

    Hi Thank you for your feedback, unfortunately, I just found out that EVALUATE Function is disabled in our environment for security reasons, so the only other way I've discovered is this:
    The problem is that none of the conditions in the case statement are met--so the column is set to null. You can add a WHEN statement (section 2 below) to catch the nulls. There are five cases to consider:
    Case 1: begin insp > bad order
    Case 2: begin insp < bad order
    Case 3: bad order only (begin insp is NULL)
    Case 4: begin insp only (bad order is NULL)
    Case 5: both begin insp is NULL and bad order is NULL
    1) If bgn-crm-insp-ob > report-bo-ob then bgn-crm-insp-ob
    (Case 1)
    CASE WHEN filter ("- Terminal Task Measures"."Task Reported DateTime (Local)" using "Task Detail"."Task Code" = 'bgn-crm-insp-ob') > filter ("- Terminal Task Measures"."Task Reported DateTime (Local)" using "Task Detail"."Task Code" = 'report-bo-ob') THEN filter ("- Terminal Task Measures"."Task Reported DateTime (Local)" using "Task Detail"."Task Code" = 'bgn-crm-insp-ob')
    2) If report-bo-ob is NULL then bgn-crm-insp-ob
    (Case 4, 5) for case 5, you will get NULL
    WHEN filter ("- Terminal Task Measures"."Task Reported DateTime (Local)" using "Task Detail"."Task Code" = 'report-bo-ob') IS NULL THEN filter ("- Terminal Task Measures"."Task Reported DateTime (Local)" using "Task Detail"."Task Code" = 'bgn-crm-insp-ob')
    3) Else report-bo-ob
    (Cases 2, 3)
    ELSE filter ("- Terminal Task Measures"."Task Reported DateTime (Local)" using "Task Detail"."Task Code" = 'report-bo-ob') END
    Hopefully this works, I'll give feedback if it does, or if you have any further suggestions please submit, again, THANK YOU SO MUCH ANYWAYS!

  • Min/max MRP and double star planned order

    Hi,
        What does setting up materials for min/max mean ? Is it just some concept r does it involve some specific settings in the material master ? I know there are minimum and maximum lot sizing procedures available. Are these to be taken into account to set materials up for min/max ?
    What does a planned order with two stars in the MD04 screen mean?
    Thanks

    Dear,
    Single *** means order is Firmed and **** means Capacity planning has been done for the  planned order.
    There is "storage location" MRP with min max levels.
    Have a look at the fields on the MRP screens in the material master and you will see the settings you can choose from.
    There should be no need for any config as long as your basic MRP config is there.
    The normal MRP run will then try to maintain the correct stock level in that storage location and you use the special procurement keys on the material master to determine where the stock should come from to replenish that storage location.
    Go to TcodeOMIA  here you will find min max for your plant.
    Regards,
    R.Brahmankar

  • How to find min and max of a field from sorted internal table

    Hi,
    I have sorted Internal Table by field f1.
    How do I find max and min value of f1.
    For min value of f1 I am using,
    READ TABLE IT1 INDEX 1.
    IT1-F1 = MIN.
    Is this correct? And how do I find the max value of f1 from this table.
    Thanks,
    CD

    Yes, that is right, and you can get the max like this.
    data: lv_lines type i.
    * get min
    READ TABLE IT1 INDEX 1.
    MIN  = IT1-F1.
    * get max
    lv_lines = lines( it1 ).
    read table it1 index lv_lines.
    MAX  = IT1-F1.
    Regards,
    Rich Heilman

  • Finding Min and Max

    I have the following data stored in java. The names are stored as a 1 dimensional array and the figures as a 2 dimensional array.
    -----------------------------Min Max
    Joe Jones 32 22 20 10 ? ?
    Jim Long 10 45 10 60 ? ?
    Tom Doon 5 10 50 70 ? ?
    What I want to do is to find the Mininum and Maximum value of each row. It would be displayed where the question ,marks are. What should my code be???

    you can use the sort method to determine which is the max/min and then return them & still keep your list as is.
    something like:
    -----------------------------Min Max
    Joe Jones 32 22 20 10 sort.getMax() sort.getMin()
    Jim Long 10 45 10 60 ? ?
    Tom Doon 5 10 50 70 ? ?
    for the getMax() method - return the last element in the sorted array
    for the getMin() method - return the first element in the sorted array

  • Help to find the max, min and the averages wages

    ok i did sum programming i got half of my program to work but i need help with the other half the program is suppose to find the highest and lowest wages and also give the average wages. here is my code
    import java.util.*;
        public class WorkerwagesQueues
          static Scanner console = new Scanner(System.in);
           public static void main (String[] args)
             Queue<String> nameQ = new LinkedList<String>();
             Queue<String> nameQ2 = new LinkedList<String>();
             Queue<Double> num = new LinkedList<Double>();
             int searchCnt = 0;
             int max, min;
             String toSearch, var;
             System.out.println("Welcome, how are you Doing today\n");
             System.out.println("Please enter the five workers names\n");
             for (int i = 0; i < 5; i++)
                nameQ.offer(console.next());
             System.out.println("Please enter the five workers salaries\n");
             for (int i = 0; i < 5; i++)
                num.offer(console.nextDouble());
            // starting right here is my problem
            /*min = num.next(0);
             max = num.get(0);
             for (int i = 0; i < num.size(); i++)
                System.out.println(num.get(i));
                if (i > 0)
                   if (min > num.get(i))
                      min = num.get(i);
                   if (max < num.get(i))
                      max = num.get(i);
             System.out.println("\nthe Lowest wage is " + num );
             System.out.println("\nthe Largest wage is " + num );
             System.out.println("please enter a name to serach the queue:");
             toSearch = console.next();      
             while (nameQ.size() > 0)
                var = nameQ.remove();
                if (var.equals(toSearch))
                {searchCnt++;}
                else
                {nameQ2.offer(var);}               
             System.out.println("This queue contains " + toSearch + " " + searchCnt + " time(s).");
             System.out.println("The second queue is:");
       }

    ok sorry if i am annoying you guys but i really want to get this working
    this is the part i am having problems with. I am trying to find the max and min of the wages the user input and i am not usre how to do it. my question is how do i do that?
    // starting right here is my problem
            /*min = num.next(0);
             max = num.get(0);
             for (int i = 0; i < num.size(); i++)
                System.out.println(num.get(i));
                if (i > 0)
                   if (min > num.get(i))
                      min = num.get(i);
                   if (max < num.get(i))
                      max = num.get(i);
             System.out.println("\nthe Lowest wage is " + num );
             System.out.println("\nthe Largest wage is " + num );
         

  • Find out the MIN & MAX of DATE QUARTERWISE

    Hi All ,
    I need to find out the MIN & MAX of DATE for QUARTEWISE by using SQL Only . How we can do it ? if anybody knows Please revert me .
    Thanx in Advance
    Bye

    SQL> select deptno,
    2  to_char(trunc(hiredate,'q'),'YYYY"Q"Q'),
    3  to_char(min(hiredate),'DD.MM') MIN,
    4  to_char(max(hiredate),'DD.MM') MAX
    5  from emp
    6  group by deptno, trunc(hiredate,'q');
        DEPTNO TO_CHA MIN   MAX
            10 1981Q2 09.06 09.06
            10 1981Q4 17.11 17.11
            10 1982Q1 23.01 23.01
            20 1980Q4 17.12 17.12
            20 1981Q2 02.04 02.04
            20 1981Q4 03.12 03.12
            20 1987Q2 19.04 23.05
            30 1981Q1 20.02 22.02
            30 1981Q2 01.05 01.05
            30 1981Q3 08.09 28.09
            30 1981Q4 03.12 03.12

  • Want to set Min Max for a material for PD MRP type

    Hi,
    I know Maximum stock level field in Material master MRP 2 view ? but where do i maintain minimum stock level? not procured?
    My client wants to set up his inventory with Min Max levels using MRP PD?
    Thanks and Apprecaites help.
    Regards,
    Siva

    Hi,
    If you want to maintain a Max and Min stock level, Maximum stock is shown straight away, you cannot find the Minimum field directly.
    if you want to use MRP type PD then go for safety stock that will be your minimum stock level
    or else use Re-order point planning, re-order point will be your minimum and Max-level as maximum.
    Thanks
    Satya

  • MRP creating cancel notices for min max purchased items

    We use min max planning for many repetitive purchased items. These same items are also set to MPS/DRP Planned as well. This is only so we can use the Planned Order report to identify material shortages to flow schedules.
    However, MRP exceptions is requesting we cancel our min max purchased items since there is no demand. Can MRP be modified to NOT include min max planning method in cancel requests?
    If not, where can I find a tool to identify material shortages for flow schedules?

    Many thanks for this.
    I can see entirely why it's designed as such, but I just find it slightly frustrating that there's no way to break the link between the order and the shipment out to the depot. Just to clarify, we're not requiring the orders to change - they will still be made and will come in - but just that the orders themselves don't specifically need to be the stock that is used for the replenishment.
    So -
    1. Min Max identifies depot needs replenishing.
    2. Central distribution does not have (enough) stock to replenish.
    3. Order is made to replenish central distributions stock.
    4. We ship whatever we've got, when we've got it, to depot to replenish.
    It's the bit where Min-Max is trying to replensih a specific depot rather than our central distribution centre that's my problem.
    I suspect that, as you say, that specific issue is not directly fixable without getting our IT contractors to do a customisation.
    I'm going to look into your Supply Date Offset suggestion now, though I'm not sure how this affects the shipping after the orders are placed. The orders themselves are approved manually after we've checked our stock position (i.e. what's in with the recycling team), but we recycle & refurb probably 60% of our maint stock so there'll always be kit turning up after the order has been made because of the long lead times.
    Thanks again.

  • Min Max Report - Eroneous Quantities in the Demand Quantity Column

    I have a min max report and I have eroneous quantities inthe demant quantity column. I would like to know where these quantities are coming from. I cannot find them anywhere in the system. There are not POs, requisitions, move orders or sales orders that can explain these quantities. It is causing issues the reorder quantity as well as the available quantity.

    Use Item supply /Demand form to match your calaculation for min max in addition to the setting that you have for min max .
    Reconsile the report with respect to the parameter that was used.
    tx,
    dr

  • Min/max temperatires for all stations on computer.

    iMac, Intel 2/2, 6mb, L2Cache_4g, 1.33ghz, 10.6.8 Snow Leopard
    I've lately become aware of the presence of a temperature report on my Dashboard and wonder where I can find the Min/Max status for all my heat situations.
    .....goldie

    Anyone able to help with this?
    Regards
    Richard

  • How to calculate Min & Max temperature with just air temperature

    Hi Gurus,
    I have a requirement in which I have to build a Bex Query in which I have to find the Min & Max temperature of a day if a specific date range is used in the query.I have checked the multiprovider and there is only one field available
    which is "Air temperature" and it's a KF. I have built a query which will give you the temperature for the day if you give a particular date range.
    My question is,is it possible for me to find the min and max temperature with just air temperature as input?
    Please let me know your thoughts.
    Thanks,
    Raj

    Hi,
    You have to create two KFs for Min and Max temperatures,
    In  Min Temp KF definition, Aggregation Tab-->Minimum--> reference char as 0calday
    In Max Temp KF definition, Aggregation tab-->Maximum-->Reference char as 0calday
    Regards,
    Suman

  • Why no min/max height?

    Since I've started creating responsive content with Edge, once thing has really bugged me - and that's the omission of a Min H and Max H alongside Min W and Max W. I've been told it's not necessary as height can be constrained to width, but I still find myself needing it.
    Two scenarios I've frequently come across:
    • An object is set to 100% width. When a window is resized to a landscape orientation, I want an object's maximum width dictated by it's height to prevent it taking up too much space in the layout. For example, in portrait layout it may be W100%, H10% - turn that to landscape and it might become W100%, H60% if I've constrained the proportions. I want to be able to cap it at say H30%, so after a certain point it's just the width that changes and not the height.
    • I have a series of square images nested within a horizontal scrollable div. I want these images to stay in proportion but always fill to H100% of the container div, regardless of its shape (portrait, landscape). It seems to simple but I just can't make it work without a min/max H functionality.
    Can anyone explain why this feature is missing?
    Thanks

    As you know, IE doesn't support min/max-height/width.
    With regard to HEIGHT, you can work around IE's lack of support for min-height since the way that IE deals with an explicit height is as if it were min-height.  For example, if you have this CSS:
    #foo { min-height:250px; }
    you can *hack* a fix for IE like this -
    #foo {
         min-height:250px;
         _height:250px;
    The "_height" style is ignored by all browsers except IE<8.  For those versions of IE that 'read' that style, they interpret it as 'height' and since IE treats an explicit height value as if it were 'min-height' you are set.  Another way (and a cleaner way in my opinion) would be to add an IE conditional comment to the page, e.g.,
    <!--[if lte IE 7]>
    <style>
    #foo {
         height:250px;
    </style>
    <![endif]-->
    That takes care of min-height.
    The solutions for max-height or min/max-width are not so simple.  Google for IE CSS calculations to see how you might approach them.

  • FF9 - can i hide window control buttons in titlebar (min, max, close) with userchrome.css?

    I use FF9. In userscript.css i hide titlebar and orange app button, but window control buttons still visible! I just can`t find working script.
    I dont need min-max-close button and wont to hide it without extension if possible.
    Here is screenshort:
    http://s018.radikal.ru/i522/1201/50/f6a6ea445507.jpg

    Try this code in userChrome.css below the default @namespace line.
    *http://kb.mozillazine.org/userChrome.css
    The customization files userChrome.css (interface) and userContent.css (websites) are located in the chrome folder in the user profile folder.
    *http://kb.mozillazine.org/Editing_configuration
    <pre><nowiki>*http://www.mozilla.org/en-US/firefox/channel/
    #titlebar-buttonbox { display:none!important; }
    </nowiki></pre>

Maybe you are looking for

  • Backup/Recovery from web application

    Hello guys, I am using Oracle 9i as DB and Oracle 9iAS for web application server. I want to provide Backup and Recovery functionality to the user via web. I don't know any thing in this regard. Is it possible that we can take backup and recovery fro

  • How to clear the recent SAVE locations menu

    When I save a new document, a menu of locations appears where I have recently saved other documents. How can I clear this menu? Clearing the Recent Items menu doesn't do it. I must have inadvertently saved a file to my backup drive once, because the

  • Help - Windows crashes after installing upgrade today....

    Hi, System:                Windows XP, 2002, Service Pack 3 (not sure how to tell if 32 bit or 64 bit?  My graphics are 64-bit, I think) Computer:          Dell Inspiron 530 Processor:           Intel Core 2 Duo CPU Graphics card:   ATI Radeon HD 260

  • BEQLSNR on VMS

    I would really appreciate any information on the low-level detail when the BEQLSNR process starts oracle.exe (when lsnr is running in "no-prespawned server" mode). On Unix, tnslsnr forks and execs oracle, which inherits an open read pipe and an open

  • Error while doing listcube on RNWCUST$T

    Hi Gurus, when doing a listcube on RNWCUST$T, we get the followin error: Error reading the data of InfoProvider RNWCUST$T Message no. DBMAN305 RNWCUST is getting it's Data from a FlatFile DataSource via DirectAccess When executing the Preview functio