I need help on how to write program that read integers

I am a beginner to java and need you help please.
How do I write a program that will read an unspecified number of integers (between 5 to 8 values) and :
(a) determine how many positive and negative value have been read.
(b) find the average of the positive integers as well as the average for the negative integers.
(c) find the total of all values. (both positive and negative)
(d) count the number of zero input by the user and display the count.
(e) your program should allow the users to repeat the task as many times as they want.
Generate a table like this: (assuming that the user enters: 2,0,-11,21,0,-3,89,6)
Positive Ave(+) Negative Average(-) Zero(0) **************************************************************
2 39     -3      -7     2
21     -11
89               
6     

I'm sure thats ur programming assignment.... Read any intro to java book .... or search on the net and you will be able to find answers

Similar Messages

  • I need help finding a workable web program that is not CSS based.  I tried IWeb and it just won't work for me.  Way too limiting.  I've been using a 12 year old copy of Macromedia Dreamweaver, but the new Dreamweaver is CSS

    Been building web pages for nearly 20 years, starting with GoLive.  Went to Dreamweaver about 12 years ago, the Macromedia version.  Tried going to iWeb when it came with a new Mac, but found it way too limiting with it's CSS template base.   Unknowlingly, I then bought a new copy of Dreamweaver.   Ooops, Adobe had bought Macromedia and Dreamweaver, too, is now CSS based, which for my money makes it useless to anyone who likes simplicity.   Now I find that even iWeb has been discontinued.  I was told yesterday that Apple doesn't have a web program any more.   At 12 years old, I just don't think it's practical to try to load my old Macromedia Dreamweaver into the new Mountain Lion (I'm getting a new Mac), though it is running, barely, in Snow Leopard.
    I need to find a web builder program that will permit simple construction of educational pages, nothing fancy, nothing artistic, just create a page, give it a color, type or drag in text, insert a table, insert pix in the table blocks, add text under the pix... done!    I should note that I am not looking to build traffic.  I teach simple things for free and people who want to learn those things (antique sewing machine repair, quilting, building longbows) find me.
    I've downloaded trial versions of half a dozen or so programs and looked at maybe 20 more, but all are either CSS based and drive me insane with requirments for constantly making rules and template models, and/or require that you base your web presence in their server.   Also, many will not work with pages built in other programs.  I maintian a volume of over 1000 web pages, many requiring regular updating, and they have been with the same server for more than 15 years.  I'm not about to change.
    So, anybody know a simple, old fashioned web builder that's happpy on a Mac platform?
    Captain Dick

    Although not supported anymore, iWeb does still function using Mountain Lion...
    http://www.iwebformusicians.com/iWeb/mountain-lion.html
    ... and you can purchase it from Amazon.
    Start with a blank page using the Black or WHite template.
    All modern websites use CSS and there are thousands of free templates to be had if you want to use a code entry style application. You will need to go this route if you want to create a site that is viewable on mobile devices although you can create an iPhone version using iWeb...
    http://www.iwebformusicians.com/iWeb/Mobile-iWeb.html
    Search this forum for numerous topics about iWeb alternatives.

  • Really need help on how to write this program some 1 plz help me out here.

    i am new to java and i confused on how to be writing this program.
    i have completed the Part 1 but i am stuck on Part 2 & 3 so it would would be really great if any 1 could help me out on how to write the program.
    Part I
    An algorithm describes how a problem is solved in terms of the actions to be executed, and it specifies the order in which the actions should be executed. An algorithm must be detailed enough so that you can "walk" through the algorithm with test data. This means the algorithm must include all the necessary calculations.
    Here is an algorithm that calculates the cost of a rectangular window. The
    total cost of a window is based on two prices; the cost of the glass plus the cost of the metal frame around the glass. The glass is 50 cents per
    square inch (area) and the metal frame is 75 cents per inch (perimeter).
    The length and width of the window will be entered by the user. The
    output of the program should be the length and width (entered by the user)
    and the total cost of the window.
    FORMULAS:
    area = length times width perimeter = 2 times (length plus width)
    Here is the corresponding algorithm:
    read in the length of the window in inches
    read in the width of the window in inches
    compute the area
    compute the cost of the glass (area times 50 cents)
    compute the perimeter
    compute the cost of the frame (perimeter times 75 cents)
    compute the total cost of the window (cost of glass plus cost of frame)
    display the length, width and total cost
    The next step would be to "desk check" the algorithm. First you would need to make up the "test data". For this algorithm, the test data would involve making up a length and a width, and then calculating the cost of the window based on those values. The results are computing by hand or using a calculator. The results of your test data are always calculated before translating your algorithm into a programming language. Here is an example of the test data for the problem given:
    length = 10
    width = 20
    area = 200, glass cost= 100.00 (area times 50 cents)
    perimeter = 60, frame cost = 45.00 (perimeter times 75 cents)
    total cost =145.00
    Once the test data is chosen, you should "walk" through the algorithm using the test data to see if the algorithm produces the same answers that you obtained from your calculations.
    If the results are the same, then you would begin translating your algorithm into a programming language. If the results are not the same, then you would attempt to find out what part of the algorithm is incorrect and correct it. It is also
    necessary to re-check your hand calculations.
    Each time you revise your algorithm, you should walk through it with your test data again. You keep revising your algorithm until it produces the same answers as your test data.
    ?Now write and submit a Java program that will calculate the cost of a rectangular window according to the algorithm explained. Be sure to prompt for input and label your output.?
    Part II
    Write, compile and execute a Java program that displays the following prompts:
    Enter an integer.
    Enter a second integer
    Enter a third integer.
    Enter a fourth integer.
    After each prompt is displayed, your program should use the nextint method of the Scanner class to accept a number from the keyboard for the displayed
    prompt. After the fourth integer has been entered, your program should calculate and display the average of the four integers and the value of the first integer entered raised to the power of the second integer entered. The average and result of raising to a power should be included in an appropriate messages
    (labels).
    Sample Test Data:
    Set 1: 100 100 100 100
    Set 2: 100 0 100 0
    Be sure to write an algorithm first before attempting to write the Java code. Walk through your algorithm with test data to be sure it works as anticipated.
    Part III
    Repeat Part lI but only calculate the average, not the power. This time, make sure to use the same variable name, number, for each of the four numbers input. Also use the variable sum for the sum of the numbers. (Hint: To do this, you may use the statement sum = sum + number after each number is read.)
    For Part 1 this is what i got
    import java.util.Scanner;
    public class Window
         public static void main(String[] args)
              double length, width, glass_cost, perimeter, frame_cost, area, total;
              Scanner keyboard = new Scanner (System.in);
              System.out.println("Enter the length of the window in inches");
              length = keyboard.nextInt();
              System.out.println("Enter the width of the window in inches");
              width = keyboard.nextInt();
              area = length * width;
              glass_cost = area * .5;
              perimeter = 2 * (length + width);
              frame_cost = perimeter * .75;
              total = glass_cost + frame_cost;
                   System.out.println("The Length of the window is " + length + "inches");
                   System.out.println("The Width of the window is " + length + "inches");
                   System.out.println("The total cost of the window is $ " + total);
         Enter the length of the window in inches
         5
         Enter the width of the window in inches
         8
         The Length of the window is 5.0inches
         The Width of the window is 5.0inches
         The total cost of the window is $ 39.5
    Press any key to continue . . .
    Edited by: Adhi on Feb 24, 2008 10:33 AM

    Adhi wrote:
    i am new to java and i confused on how to be writing this program.
    i have completed the Part 1 but i am stuck on Part 2 & 3 so it would would be really great if any 1 could help me out on how to write the program.Looks like homework to me.
    What have you written so far? Post it.
    Part I
    An algorithm describes how a problem is solved in terms of the actions to be executed, and it specifies the order in which the actions should be executed. An algorithm must be detailed enough so that you can "walk" through the algorithm with test data. This means the algorithm must include all the necessary calculations.
    Here is an algorithm that calculates the cost of a rectangular window. The
    total cost of a window is based on two prices; the cost of the glass plus the cost of the metal frame around the glass. The glass is 50 cents per
    square inch (area) and the metal frame is 75 cents per inch (perimeter).
    The length and width of the window will be entered by the user. The
    output of the program should be the length and width (entered by the user)
    and the total cost of the window.
    FORMULAS:
    area = length times width perimeter = 2 times (length plus width)
    Here is the corresponding algorithm:
    read in the length of the window in inches
    read in the width of the window in inches
    compute the area
    compute the cost of the glass (area times 50 cents)
    compute the perimeter
    compute the cost of the frame (perimeter times 75 cents)
    compute the total cost of the window (cost of glass plus cost of frame)
    display the length, width and total cost
    The next step would be to "desk check" the algorithm. First you would need to make up the "test data". For this algorithm, the test data would involve making up a length and a width, and then calculating the cost of the window based on those values. The results are computing by hand or using a calculator. The results of your test data are always calculated before translating your algorithm into a programming language. Here is an example of the test data for the problem given:
    length = 10
    width = 20
    area = 200, glass cost= 100.00 (area times 50 cents)
    perimeter = 60, frame cost = 45.00 (perimeter times 75 cents)
    total cost =145.00
    Once the test data is chosen, you should "walk" through the algorithm using the test data to see if the algorithm produces the same answers that you obtained from your calculations.
    If the results are the same, then you would begin translating your algorithm into a programming language. If the results are not the same, then you would attempt to find out what part of the algorithm is incorrect and correct it. It is also
    necessary to re-check your hand calculations.
    Each time you revise your algorithm, you should walk through it with your test data again. You keep revising your algorithm until it produces the same answers as your test data.
    “Now write and submit a Java program that will calculate the cost of a rectangular window according to the algorithm explained. Be sure to prompt for input and label your output.”
    Part II
    Write, compile and execute a Java program that displays the following prompts:
    Enter an integer.
    Enter a second integer
    Enter a third integer.
    Enter a fourth integer.
    After each prompt is displayed, your program should use the nextint method of the Scanner class to accept a number from the keyboard for the displayed
    prompt. After the fourth integer has been entered, your program should calculate and display the average of the four integers and the value of the first integer entered raised to the power of the second integer entered. The average and result of raising to a power should be included in an appropriate messages
    (labels).
    Sample Test Data:
    Set 1: 100 100 100 100
    Set 2: 100 0 100 0
    Be sure to write an algorithm first before attempting to write the Java code. Walk through your algorithm with test data to be sure it works as anticipated.So this is where you actually have to do something. My guess is that you've done nothing so far.
    Part III
    Repeat Part lI but only calculate the average, not the power. This time, make sure to use the same variable name, number, for each of the four numbers input. Also use the variable sum for the sum of the numbers. (Hint: To do this, you may use the statement sum = sum + number after each number is read.)Man, this specification writes itself. Sit down and start coding.
    One bit of advice: Nobody here takes kindly to lazy, stupid students who are just trying to con somebody into doing their homework for them. If that's you, better have your asbestos underpants on.
    %

  • I Need help on how to write a simulation program using Java

    I am currently working on my final project and i will be grateful if i can get any help on the needed resources that i will require for my code

    Benny,
    If that means you want someone to work for you, then you better have deep pockets, most of the developers' time goes for 100+ an hour.
    But if you mean you would like to ask quesitons about code you have written and get advice on how to continue or fix a problem you are having, then post the relavant code piece and ask away. There are many that will be glad to help you in that manner.
    But this is NOT a do my homework for me board and unless you can clue your Prof in that your work is not your own, then you would be cheating for a grade you do not deserve, and in that case--please just go else where or drop out--either one will make no difference to me or most of the developers on this board.

  • Need Help on how to use Adobe Image reader

    Hi,
    I Needed to know what important features are available using the latest Adobe Image reader & does it help really in making Good Quality webpages

    I'd recommend you start here: Getting Started with Adobe Connect - Adobe Connect User Community

  • Need help on how to handle zip & text/csv as a resposne payload from Concur RestWebservice

    Hi All,
    We are getting zip(if there are multiple files) and test/csv(single file) as a response payload from the concur rest API and need your help on how to handle in NWBPM and SAP PO.
    Zip response coming in response looks like below -
    PKÀ˜F7extract_attendee_detail_p0600908soav_20150424022159.txts� rt©1204Õ50Ñ52©1¨áåPKzà@ÆPKÀ˜F2extract_CES_SAE_v3_p0600908soav_20150424022148.txts� rt©1204Õ50Ñ52©1¨©1ãåPKå늟PKÀ˜Fzà
    Text/csv response looks like below -
    Extract|2015-24-40|20|0
    Need you help on how to handle the zip content response.
    Also need help on how to handle when text/csv response comes and when zip response comes.
    As per the scenario, there are 4 calls to be made and we are using NWBPM and in the last call the actual respons (text/csv or zip) will come.
    Please provide your inputs.
    Thanks
    Narayanareddy B

    Hi Aaron,
    Thanks for your reply.
    I tried with Payload zip bean and the java mapping as mentioned in the response mapping of OM.
    Payload zip bean - Zip  zip.mode  unzip
    I am getting the error below in the receiver rest channel -
    "Transmitting the message using connection JPR failed, due to: com.sap.aii.af.lib.mp.module.ModuleException: Zip: error occured during processing: java.util.zip.ZipException: invalid stored block lengths"
    Java Mapping - used the java mapping in the response of Operation mapping
    Here also i am seeing the same error in the channel log as it is synchronous step and the message got cancelled.
    "Transmitting the message using connection JPR failed, due to: com.sap.engine.interfaces.messaging.api.exception.MessagingException: Error encountered while executing mapping: com.sap.aii.af.service.mapping.MappingException: Mapping failed in runtimeApplication mapping program com/equalize/xpi/esr/mapping/java/UnzipAndAttach throws a stream transformation exception: Exception: invalid stored block lengths"
    The below is the response i am seeing and is it proper zip response payload(any encryption) , kindly advise.
    PKâE�F:ws_extract_attendee_detail_p0600908soav_20150424083413.txts� rt©1204Õ50Ñ52©1¨áåPKzà@ÆPKâE�F5ws_extract_CES_SAE_v3_p0600908soav_20150424084014.txtíTß��@~oÒÿ�÷Fº»ìV}ëòCÏz Qljß8ÜöL�`N�ùão8�Ò«�´M�Ü@�awvçûfgÇùâϤå#Ttï0Ø�B�²·olÇ�£[4Ï](L�]«�ÑbÀôÁÒc�0ÀÏdAªÙТ¨Ìû�Êv¡�b¤eJA%��=Þ7Í>PÚ=í2��7ò[�¼¡=q/°¶�*ø)
    K|<`BgÉÔºÜWs[§J�&Ñ:Ìá:´�ç«�RÐv�ÚÅAD'\�ÁtR²*DP3gî:B@JëhU�Ò'¬�ùQ\�È\D{·O×±JS\ï�-ò�¸�Þ²êó�{Å¡2®â,MmÉù XAzßüBn&®Sl-§�l¶A�×ú½³ÙFI®0¿©Ú¯¤�oT�iV²RÀJ��¼«`õ»�í Ûéwa#�àpY�««óq)U°JaøÁA�ûì>Ù³üHåÒe¾�7��Ð/§£u°Nzã÷ç4×·èãþ�¾}õ0ÙµYÄ�+J��eX\�E±ïsR%®yÜÕðsªáÚ$qÚÎÇ�Û$^%1¸AF*ý¶VÑêxÏZÏ¢U½T~Ñ®ØkW5ç×®õ¿w5¬zò:oN»�ô���íø÷úÛÙ=¬å�[ôÚ�þmczPKhÏ��i PKâE�Fzà@Æ:ws_extract_attendee_detail_p0600908soav_20150424083413.txtPKâE�FhÏ��i 5�ws_extract_CES_SAE_v3_p0600908soav_20150424084014.txtPKËö
    Thanks
    Narayanareddy B

  • Need help in my assignment, Java programing?

    Need help in my assignment, Java programing?
    It is said that there is only one natural number n such that n-1 is a square and
    n + 1 is a cube, that is, n - 1 = x2 and n + 1 = y3 for some natural numbers x and y. Please implement a program in Java.
    plz help!!
    and this is my code
    but I don't no how to finsh it with the right condition!
    plz heelp!!
    and I don't know if it right or wrong!
    PLZ help me!!
    import javax.swing.JOptionPane;
    public class eiman {
    public static void main( String [] args){
    String a,b;
    double n,x,y,z;
    boolean q= true;
    boolean w= false;
    a=JOptionPane.showInputDialog("Please enter a number for n");
    n=Double.parseDouble(a);
    System.out.println(n);
    x=Math.sqrt(n-1);
    y=Math.cbrt(n+1);
    }

    OK I'll bite.
    I assume that this is some kind of assignment.
    What is the program supposed to do?
    1. Figure out the value of N
    2. Given an N determine if it is the correct value
    I would expect #1, but then again this seem to be a strange programming assignment to me.
    // additions followI see by the simulpostings that it is indeed #1.
    So I will give the tried and true advice at the risk of copyright infringement.
    get out a paper and pencil and think about how you would figure this out by hand.
    The structure of a program will emerge from the mists.
    Now that I think about it that advice must be in public domain by now.
    Edited by: johndjr on Oct 14, 2008 3:31 PM
    added additional info

  • How to write program for handling  script ?

    In script i have 2 pages.
    In first page i have constant windows and variable windows.
    In second page i have main window.
    How to write program for this?

    Hi
    You need to write a driver program. You need to use open form, then write_form to write data into various windows and then close_form to close.
    As you don't want main window in the first page first try out just by having the window in the second page; i guess system will take care of it. As all other windows filled and if u start writing data in the main it'll go for next page.
    If doesn't work have the window on the first page with the least hight and write a command
    IF &SYST-PAGE& EQ 1
        NEXT-PAGE.
    ENDIF.
    Then in the second page you can have the main window hight as per your requirement.
    Here is an example
    (1) Get customer data
      TABLES: scustom, sbook, spfli.
      DATA: bookings like sbook...
      select * from...
    (2) Open form
      CALL FUNCTION 'OPEN_FORM'
        EXPORTING
          DEVICE = 'PRINTER'
          FORM = 'S_EXAMPLE_1'
          DIALOG = 'X'
        EXCEPTIONS
          others = 1
    (3) Print table heading
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          ELEMENT = 'HEADING'
          TYPE = 'TOP'
          WINDOW = 'MAIN'
          FUNCTION = 'SET'
    (4) Print customer bookings
      LOOP AT bookings WHERE
        CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            ELEMENT = 'BOOKING'
            TYPE = 'BODY'
            WINDOW = 'MAIN'
      ENDLOOP
    (5) Close form
      CALL FUNCTION 'CLOSE_FORM'
    Regards
    Surya.

  • I need help with TV Capture Card program

    Hello,
    I want to create a JAVA program so I can schedule that the recording with my TV Capture Card begins in x seconds.
    Now to start a recording, you must press Ctrl+M and to stop an recording you must click the mouse.
    How can I realise that a Java application can "press" Ctrl+M. I have to create an timer, that must be do-able... but I don't know how the program can simulate the pressing of Ctrl+M. I also need to know how the Java program can do a mouse click for me to end the recording.
    Thanks in advance for helping me.
    Chris.

    Thank you... I think this was exactly what I needed.

  • I need help understanding how the Apple components integrate to create a system across all my devices?

    I need help understanding how the Apple components connect to create a whole system across all my devices?
    Is there a resource that describes current system and associated functionality?
    For example:
    Buy A, B, C to achieve "X" 
    You will need:
    an internet provider which supports <specs>
    add D to achieve "Y"
    You will need:
    an internet provider which supports <specs>
    add "E" to achieve "Z"
    You will need:
    an internet provider which supports <specs>
    For example, I am looking at the Gen 6 Airport extreme.  For intended performance do I need broadband? if so what are the specs, or will basic internet service suffice?  Do I need the internet provider's modem or does the Airport extreme replace that?  And then I think, if I am doing this, I should also look at Apple TV....What do I need and Why?  Then I look at the New Desk top coming out in the fall, and I think well, if I wait and get this, what does this component do for the system, and what becomes redundant? What does this awesome desktop do for my ability to sit and use a new macbook air when I travel  or sit on the couch in my PJs?
    If there was a place that plainly stated "if you buy the new dektop you can configure a system including only these components and achieve <this result> and by adding <additional components> you will achieve this result.
    I have been to the genius store a few times, but I come out of there more confused unless I have SPECIFIC questions or already know what to buy. 
    A "System Configuration App" would be a really great sales tool--Just saying.

    I have no idea what "fully optimized" means.
    No Apple device will let you watch broadcast TV. The Apple TV is a good option for watching streaming TV from iTunes, NetFlix and Hulu. If you want to watch from other sources, you may need to look at other devices.
    Any Mac computer or iPad will allow you to surf the web.
    What business software?
    Time Capsule is a good option for back ups.
    Update what across all devices?
    For accessing documents from all devices, a service like Dropbox is your best bet.
    I have no idea what "step as far away from an internet provider as possible" means. If you want Internet access, you need an Internet provider.
    Lighting fast speed for what? Processor? The specs are listed for all devices in the Online Store. Internet? We're back to the service provider.
    Technology changes. The only way to keep pace with it beyond a couple of years is to buy new stuff.
    The bottom line is you need to look at the specs for devices availble and at your budget and decide what best meets your needs. If you are unable to do that on your own, there are lot of technology consultants out there who will, for a fee, look at your exact situation, make recommendations and even handle the purchase and set up. Perhaps that would be the best route for you.
    Best of luck.

  • TS2755 Hi all, I bought one iphone and 3 ipads, i set up all on one apple ID. Now i have a problem when using messages: when sending message from one device it appears again on screen from the other 3 devices. I need help of how to set up messages on each

    Hi all, I bought one iphone and 3 ipads, i set up all on one apple ID. Now i have a problem when using messages: when sending message from one device it appears again on screen from the other 3 devices. I need help on how to set up messages on each device separately and to start using messages app on each device independently. Thanks

    search google for "iphone remove picture from contact"

  • Need help with how to reset bios and admin password to reformat hard drive in 8440p elitebook.......

    need help with how to reset bios and admin password to reformat hard drive in 8440p elitebook? removal of cmos, resetting laptop, using cccleaner, windows password recovery and hiren's was noneffective, any help is appreciated. thanks

    Hi,
    As your notebook is a business class machine, security is more stringent - the password is stored in non-volatile memory and there are no 'backdoor' passwords.  Your best option would be to contact HP regarding this.
    Regards,
    DP-K
    ****Click the White thumb to say thanks****
    ****Please mark Accept As Solution if it solves your problem****
    ****I don't work for HP****
    Microsoft MVP - Windows Experience

  • I'm new to SQL Server Integration Services and I need help on how to begin learning SSIS. Is there any training for it besides msdn?

    I'm new to SQL Server Integration Services and I need help on how to begin learning SSIS. Is there any training for it besides msdn?

    Check this thread where people have already given their suggestion on learning SSIS
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/f2cc1cf3-204d-454a-a189-47df87a3aa23/i-want-to-learn-ssis?forum=sqlintegrationservices
    I would suggest to go for You tube videos (type learn SSIS or begin SSIS step by step) you will get lot of good tutorials to start with.
    Happy Learning!!
    If this post answers your query, please click "Mark As Answer" or "Vote as Helpful".

  • Please i need help to how to recover my camera roll photos i deleted them yersterday by accident im need with the ipod and i took the pictures with ipod but i want to know how to recover my photos in a easy fast FREE way as soon as porssible pleasse???

    please i need  help to how to recorver my cameral roll photos from my ipod in a easy FREE way as soon as possible

    Restore from backup if they are in a backup. Otherweise I know of no free way. These are paid and no one has said that they worked.
    iPhone Recovery Stick - recover deleted text messages & more
    Recover files from iPod Touch | Restore data iPod | iPod touch undelete, unformat

  • All of my apps on my new ipad2 are not working. I had this iPad about 4 months and nothing bad has happened before this. I need help on how to make my apps stop crashing. All my built in apps are fine though.

    All of my apps on my new ipad2 are not working. I had this iPad about 4 months and nothing bad has happened before this. I need help on how to make my apps stop crashing. All my built in apps are fine though. WHATBCAN I DO TO MAKE MY APPS STOP CRASHING. I ALREADY TURNED IT OFF THEN ON AGAIN AN IT STILL CRASHES. HELPPP!!!!

    Try a reset. Hold the Sleep and Home button down for about 10 seconds until you see the Apple logo. Ignore the red slider.

Maybe you are looking for