HOW can u calculate the average it wont calculate

import java.util.*;
public class Percentage
public static void main (String [] args)
System.out.println("Enter marks (value < 0 to stop");
int totalMarks = 0;
int numberOfMarks = 0;
Scanner input= new Scanner (System.in);
int nextMark = input.nextInt();
while (nextMark >= 0)
totalMarks += nextMark;
numberOfMarks++;
System.out.println("Next mark:");
nextMark = input.nextInt();
if ( numberOfMarks > 70)
int average = (totalMarks/numberOfMarks*100);
System.out.println (" Average is");
}

Compile error!?! You're regressing!
    public static void main(String[] args) {
        System.out.println("Enter marks (value < 0 to stop");
        int totalPassingScores = 0;
        int totalScores = 0;
        Scanner input = new Scanner(System.in);
        double nextMark = input.nextDouble();
        while (nextMark >= 0) {
            totalScores++;
            System.out.println("Next mark:");
            nextMark = input.nextDouble();
            if (nextMark > 70) {
                totalPassingScores++;
        double percentPassed = (float) totalPassingScores / (float) totalScores * 100.0;
        System.out.println("Number of passing scores: " + percentPassed);
    }

Similar Messages

  • How can i get the average graph?(DIAdem)

    hi,
    How can i get the average graph(2D-graph) of 10 measures?
    Can someone please help me?
    THX!!!

    Hello Charleen!
    If you want to do it programmatically have a look at the ChnAverage command in the help (see also StatBlockCalc for advanced calculations). Interactive you can use the statistic functions in the ANALYSIS device.
    Matthias
    Matthias Alleweldt
    Project Engineer / Projektingenieur
    Twigeater?  

  • How can I activate the average calculation with cl_salv_hierseq_table class

    Hi there,
    Iu2019m using class cl_salv_hierseq_table to display a two level hierarchy (header and item) list.
    For some reason it seams that those calculations are active by default with class cl_salv_table but not for cl_salv_hierseq_table.
    I tried every suggestion from the class documentation and SAP help and nothing seams to work, the menu calculation options are always inactive except for the total calculation.
    After the cl_salv_hierseq_table=>factory...
    And before cl_salv_hierseq_table->display( )
    I triedu2026u2026.
    cl_salv_aggregations = cl_salv_hierseq_table->get_aggregations( 1 )
    cl_salv_aggregations->add_aggregation( 'COLUMN1' )
    COLUMN1 is a currency column in header level table
    u2026u2026..
    cl_salv_aggregations = cl_salv_hierseq_table->get_aggregations( 2 )
    cl_salv_aggregations->add_aggregation( 'COLUMN2' )
    COLUMN2 is a dec column in item level table
    u2026u2026..
    cl_salv_aggregations = cl_salv_hierseq_table->get_aggregations( 2 )
    cl_salv_aggregations->add_aggregation( columnname = 'COLUMN2' aggregation = if_salv_c_aggregation=>average )
    u2026u2026..
    cl_salv_aggregations = cl_salv_hierseq_table->get_aggregations( 2 )
    cl_salv_aggregations->set_aggregation_allowed( 'COLUMN2' )
    u2026u2026..
    cl_salv_aggregations = cl_salv_hierseq_table->get_aggregations( 2 )
    cl_salv_aggregations->set_numerical_aggregation( ).
    cl_salv_aggregations->set_aggregation_allowed( 'COLUMN2' )
    cl_salv_aggregations->add_aggregation( columnname = 'COLUMN2' aggregation = if_salv_c_aggregation=>average )
    u2026u2026..
    cl_salv_aggregations = cl_salv_hierseq_table->get_aggregations( 2 )
    cl_salv_aggregations->add_aggregation( 'COLUMN2' )
    cl_salv_aggregation = cl_salv_aggregations->get_aggregation( 'COLUMN2' )
    cl_salv_aggregation->set( if_salv_c_aggregation=>average )
    Any help will be appreciated!

    Thanks Harsh Bhalla,
    Subtotals can be built (displayed) at Header Level Only, true but the values to calculate those totals can come from either header or item level, otherwise it wouldnu2019t be of much use would it?
    Anyway my question is how to activate the average calculation as well because the totals calculations is already active for either item or header level by default.
    For reference when on the display layout Iu2019m referring to the menu Edit -> Calculate -> Mean Value.

  • How do I calculate the average of ONLY the populated fields?

    I'm working on an Adobe form to streamline the process of summarizing course evaluations.  To protect the anonymity of the students, instructors with 10 or fewer students are given a typed summary of the evaluation results.  On the first half of the evaluation, the students are asked to rate a series of statements from 1-5.  Three of these are highlighted on the summary form with the average response. 
    I've already set up the form with 10 unique boxes for each question and an 11th box which calculates the average.  Each field is named according to the question number and the student's "number" (I arbitrarily gave each student a number so that each field would be unique):
    i.e. #1. Questionquestionquestion.  Q1S1  Q1S2  Q1S3  Q1S4  Q1S5  Q1S6  Q1S7  Q1S8  Q1S9  Q1S10  1AVG
    The problem, of course, is that no matter how many students were actually in the class, the AVG field will always be calculated based on a group of 10...which isn't accurate or fair to the instructor.  I thought about just changing the form and removing the unused fields from the equation each time I make up a new summary, but the point of creating a form was to make it as quick and easy as possible to bang these things out... Plus, some of my coworkers might be using the form from time to time and I'd have to explain what they have to do and if they don't have Adobe Acrobat then they can't actually make the changes and blah blah blah...it just gets ridiculous really quickly!
    So anyway, I tried reading some other posts for similar questions in an attempt to figure out a custom calculation script for myself, but I just couldn't focus on it.
    I was hoping someone could explain how to write a custom calculation script that will omit any fields which are left blank... Or, even better...is anyone willing to write it for me?  At least just an example of the first guy, cause I could probably figure out how to get all the other ones from there.
    Thanks.

    In formcalc the function Avg will calculate the average of only the fields with a value in them. So you would would put in the calcuate event of the average field:
    $ = Avg(Q1S1,Q1S2,Q1S3,Q1S4, etc)

  • How can i output the max average?

    How can i output the max of the average?
    i have this queries...
    <cfquery datasource="Intranet" name="GroupStars">
            SELECT execoffice_status, employeedept, COUNT(*) as 'totalstars'
            FROM CSEReduxResponses
            WHERE execoffice_status = 1
            GROUP BY execoffice_status, employeedept
        </cfquery>
        <cfquery dbtype="query" name="GetTotalStars">
            SELECT *
            FROM GroupStars, GetDepartments
            WHERE GroupStars.employeedept = GetDepartments.csedept_id
        </cfquery>
    <cfif GetTotalStars.RecordCount gt 0>
        <cfquery datasource="PhoneList" name="GetAllData">
            SELECT dept.csedept_id, COUNT(*) as 'totalcount'
            FROM employee, dept
            WHERE employee.dept_id = dept.dept_id
                AND employee.emp_status = 1
                AND dept.csedept_id is not null
            GROUP BY dept.csedept_id
        </cfquery>
        <cfquery dbtype="query" name="GetDepartmentTotalEmployeesCount">
            SELECT *
            FROM GetAllData, GetDepartments
            WHERE GetAllData.csedept_id = GetDepartments.csedept_id
        </cfquery>
    <cfquery name="joinQuery" dbtype="query" >
    SELECT *
    FROM GetTotalStars
    WHERE GetTotalStars.csedept_id = -1
    </cfquery>
    <cfset QueryAddRow(joinQuery)>
    <cfquery name="GetUnion" dbtype="query" >
    SELECT *
    FROM GetDepartmentTotalEmployeesCount, GetTotalStars
    WHERE GetDepartmentTotalEmployeesCount.csedept_id = GetTotalStars.csedept_id
    UNION
    SELECT GetDepartmentTotalEmployeesCount.*, joinQuery.*
    FROM GetDepartmentTotalEmployeesCount, joinQuery
    WHERE GetDepartmentTotalEmployeesCount.csedept_id NOT IN (#ValueList(GetTotalStars.csedept_id)#)
    </cfquery>
    <cfquery datasource="Intranet" name="GroupStarsGiven">
        SELECT execoffice_status, submitterdept, COUNT(*) as 'totalstarsgiven'
        FROM CSEReduxResponses
        WHERE execoffice_status = 1
        GROUP BY execoffice_status, submitterdept
    </cfquery>
    <cfquery dbtype="query" name="GetTotalStarsGiven">
        SELECT *
        FROM GroupStarsGiven, GetDepartments
        WHERE GroupStarsGiven.submitterdept = GetDepartments.csedept_id
    </cfquery>
    <cfquery name="joinQuery2" dbtype="query" >
    SELECT *
    FROM GetTotalStarsGiven
    WHERE GetTotalStarsGiven.csedept_id = -1
    </cfquery>
    <cfset QueryAddRow(joinQuery2)>
    <cfquery name="GetUnion2" dbtype="query" >
    SELECT *
    FROM GetUnion, GetTotalStarsGiven
    WHERE GetUnion.csedept_id = GetTotalStarsGiven.csedept_id
    UNION
    SELECT GetUnion.*, joinQuery2.*
    FROM GetUnion, joinQuery2
    WHERE GetUnion.csedept_id NOT IN (#ValueList(GetTotalStarsGiven.csedept_id)#)
    ORDER BY csedept_name ASC
    </cfquery>
    and this part is where i calculate the average, but i only get the average for each department, and from here i want to get the max of the average. how can i do that?
    <td><div align="right"><cfif totalstars eq ''>&ndash;<cfelse><cfset avgstars = totalstars / totalcount>#DecimalFormat(avgstars)#</cfif></div></td>
    thanks for your help

    1) What is it doing instead?
    2) Can you repost your code, but use code tags? If you repaste your formated code and place the tag &#91;code&#93; on top of your block of code and then paste &#91;/code&#93; on the bottom of your block, your posted code will retain its formating and be readable.
    Good luck

  • How do i calculate the average of runs that have variable number of samples?

    Hi
    I am trying to calculate the average trajectory from  lets say 4 runs, with varying sample size.
    That is, if the the 4 runs have 78,74,73,55 samples respectively, How do I calculate the average of (78+74+73+55)/4 , (78+74+73)/3 and (78+74)/2  and 78/1 ?
    Thank you

    I'm not sure you gave a sufficient information. Assuming that you just want to calculate a linear average of the data collected in consecutive runs, you have two simple methods :
    1/ concatenate the data before calculating the mean.
    Simple, but can occupy a huhe amount of space since all the data have to be stored in memory
    2/ store only the means Mi and the corresponding number of data points ni and calculate a balanced mean : M = sum (ni x Mi) / sum (ni) )
    The attached vi illustrate both methods.
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        
    Attachments:
    Averages.vi ‏40 KB

  • My macbook wont allow me to use the same hotmail address as i used on my other computers. How can I keep the same email and log into it on a macbook?

    my macbook wont allow me to use the same hotmail address as i used on my other computers. How can I keep the same email and log into it on a macbook?

    That indicates a hardware failure. Read here:
    http://support.apple.com/kb/ts1559
    If nothing works, you most likely have a hardware failure. Make an appointment at an Apple store to confirm.

  • How to calculate the average inventory in ABAP

    Dear All,
    Please find the below formula and this formula how to calculate the Average inventory at value.Please let me know the abap base tables and the corresponding fields.
    Formula
    Inventory Turnover = Cost of Goods Sold (COGS) / Average Inventory at value.
    Thanks
    Regards,
    Sai

    Hi Arivazhagan,
    Thanks for your quick response .
    The field MBEWH from the table is fulfill the average inventory at value.
    For Eg :I want to calculate Inventory Turnover = Cost of Goods Sold (COGS)/
    Average Inventory at value.
    so shall i take Inventory Turnover = Cost of Goods Sold (COGS)/MBEWH
    The above formula will meet my requirement to find the average inventory Turnover.
    Thanks
    Regards,
    Sai

  • How can you get the filter off if you can't remember the password? It's"pro con" and it wont even let me check out the rates for aflight.

    How can you get the filter off if you can't remember the password? It's"pro con" and it wont even let me check out the rates for aflight.

    You can check the file prefs.js in the [http://kb.mozillazine.org/Profile_folder_-_Firefox Firefox Profile Folder] and remove the line(s) related to that extension (procon.password).

  • HT4847 i have 5gb of icloud storage, used 2.5gb but it wont let me unlock the other 2.5gb of storage. How can i use the remainig 2.5gb of storage?

    i have 5gb of icloud storage, used 2.5gb but it wont let me unlock the other 2.5gb of storage. How can i use the remainig 2.5gb of storage?

    I got rid of AMDS, ASU ,QuickTime and iTunes from control ones I also found folder in Vista with D:\Users\Rick\Music\iTunes\Previous iTunes Library and there is one dated 2009-03012.itl. I moved this file up one folder and delted existing iTunes Library.itl. iTune still failed to identify my iPhone. There are other files iTunes Library Extras.itdb, iTunes Library Geniyes,itdn and iTunes Music Library,xml date dtd 06/18/2009 after upgrade except the latter which is date 06/23/2009. So something is not allowing me to pull or put everything back to when it worked.
    YES this is my only iPhone and only PC I have access to with iTunes.
    Here is what Apple gave to someone Sunday 28 June:
    http://discussions.apple.com/thread.jspa?threadID=2035950&start=75&tstart=0
    I checked these out too and they appear the same printed out nearly a week prior. I agree with Coach TO, if I had bad drivers or Vista errors it would not have shown up only when I updated to latest Version of 8.2.023. My Phone was identified on a PC with iTunes at the local AT&T store. He suggested I get phone into Recovery made while connected to iTunes and that resolves the problem 9 out of 10 time. Weak spot was he tried to get phone into Recovery without iTunes connection and thought I may have iPhone problem, then changed his mind when it worked while connected. He also stated it could take an hour. I have not tried to put my iPhone in Recovery lately, I think I did a while back and it failed to go into Recovery as error "iPhone detected by, not identified..."Has anyone tried forcing phone into Recovery? I understand you may lose all that is on phone. If iTunes still fails to identify would we not be in worse shape even if iTunes holds a recent backup which it does not for many of us? Will Apple take back or exchange phone if yours is not identitifed, AT&T today told me I had to go to Apple Store for this or anything to happen.

  • I had a trial version of Pages for 30 days and then purchased the actual software without removing the trial. Now when I try to edit documents and save them it wont because it tells me I am using a trial version.... How can I remove the trial version?

    I had a trial version of Pages for 30 days and then purchased the actual software without removing the trial. Now when I try to edit documents and save them it sometimes wont because it tells me I am using a trial version.... But sometimes it lets me!! How can I remove the trial version? I cannot tell which one I am using when I open it....

    Question asked and answered quite once a week.
    Go to my iDisk (address below)
    and download :
    For_iWork:iWork '09:uninstall iWork '09.zip
    Run it then reinstall the purchased software.
    Yvan KOENIG (VALLAURIS, France)  vendredi 2 janvier 2011 16:21:41
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
    My iDisk is : <http://public.me.com/koenigyvan>
    Please :
    Search for questions similar to your own
    before submitting them to the community

  • How do calculate the average of a group of percentages excluding percentages listed as zero on Numbers?

    Hey all
    This is driving me crazy!
    I need to calculate the average of a group of percentages excluding cells listed as '0%'.
    Please see screen print below, numbers highlighted need to be averaged, when the table is filled out correctly some will remain '0%' whilst others will have a value, I want the average to be calculated only using numbers with a value greater than '0'.
    FYI I am looking for the result to display in 'X2'
    Thanks :-)

    you can use the averageif() function. Here is a simple example to get you started:
    In this example the average if() function averages values that are non-zero
    C2=AVERAGEIF(A1:E1,"<>0",A1:E1)
    this is shorthand for select cell C2, then type (or copy and paste from here) the formula:
    =AVERAGEIF(A1:E1,"<>0",A1:E1)

  • HT4061 my phone wont turn on so how can i find the serial number

    my phone wont turn on so how can i find the serial number

    Did you read this section from the article you linked:
    If you have access to your computer, but not your device

  • HT4060 how can i replace the battery on my ipad? it wont charge all the way

    my ipad will only charge to 14% then goes down...how can i replace the battery?

    iPad Owners
    Your one-year warranty includes replacement coverage for a defective battery. You can extend your coverage to two years from the date of your iPad purchase with the AppleCare Protection Plan for iPad. During the plan’s coverage period, Apple will replace the battery if it drops below 50% of its original capacity. If it is out of warranty, Apple offers a battery replacement for $99, plus $6.95 shipping, subject to local tax. Apple disposes of your battery in an environmentally friendly manner.
    http://www.apple.com/batteries/replacements.html

  • Calculate the average value

    the data I measured changed rapidly, so i want get the average value of the data
    Do not tell me to use mean.vi , i have already know that.
    and i got an idea which is add the data into an array every time, then sum of all the data value and take the result divide by the number of elements
    but i dont know how to achieve that, anyone can build a simple vi to show me ? thank you
    i have attached my vi which is using mean.vi to calc the average value, you can delete it and using in your way ,  thank you !
    Solved!
    Go to Solution.
    Attachments:
    EN-new.vi ‏274 KB

    Hi I got a similar issue for averaging. I used the mean.vi from the math function but the average is rolling when i run it. I am trying to calculate the average for the data i read to the RT FIFO (which is around 40000 lines).I got the writing part working, however, when i am reading the data, I couldn't get it working. I thought i read the data as a 1-D array, and then pass it to the Mean.vi and then got the result. But seems like the mean is only showing the last data in the array.
    Can someone help me with this??
    Attachments:
    FPGA-vi.png ‏242 KB
    RT-vi.png ‏182 KB
    RT-2mod.vi ‏515 KB

Maybe you are looking for

  • The feature you are trying to use is on a network resource that is unavaila

    unavaailable* this is a message that pops up when ever i try to update my itunes. then under that it says "Click OK to try again, or enter alternate path to the folder containing the installation package 'itunes.msi' in the box below" then in the box

  • Is there a link to download BBOS?

    Hi All Anybody can tell me is there a link to download BlackBerry Z10 's OS? Thanks and Regards Solved! Go to Solution.

  • Sale order reflecting in production order

    Hai All, I have following scenario. I have two plants A and B.  A is depo and B is manufacturing plant. product  after manufacturing is transferred from manufacturing plant ( B) to Depo ( A) through stock transport order. Now sales order is placed on

  • Droid X spacebar freeze while texting

    After typing a word in a text message and pressing the spacebar, the keyboard hides and I then have to retouch the message area to bring up the keyboard again for the next word.  I repeat this everytime I hit the space bar. Not fun. I have the latest

  • AirPrint has stopped working since updating iPad to iOS 7.02

    Since updating our iPhones and iPads to iOS 7.02 we seem to have lost the ability to use AirPrint, nor can we connect to the scanner of our HP Photosmart 6510 using VueScan. Is there a solution available now, or coming soon?