CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 3 of 3 FirstFirst 123
Results 31 to 42 of 42
  1. #31
    Join Date
    Dec 2012
    Posts
    21

    Re: i need help writing a program using array. ASAP!

    yup both the errors are at that place!

  2. #32
    Join Date
    Dec 2012
    Posts
    21

    Re: i need help writing a program using array. ASAP!

    i dont mean to be a pain.. but there is very less time left to submit my assignment..

  3. #33
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: i need help writing a program using array. ASAP!

    And you're still not using code tags. Please do so, it makes the code much easier to read.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  4. #34
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: i need help writing a program using array. ASAP!

    i dont mean to be a pain.. but there is very less time left to submit my assignment
    Unfortunately that's not my problem.

    If you did what I have suggested you do without me having to repeat myself and having to keep asking for error messages and the latest code you would be a lot closer to finishing.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  5. #35
    Join Date
    Dec 2012
    Posts
    21

    Re: i need help writing a program using array. ASAP!

    i am sorry but i am unfamiliar with code tags... how do i use them here?

  6. #36
    Join Date
    Dec 2012
    Posts
    21

    Re: i need help writing a program using array. ASAP!

    i am so sorry i did in no way mean to offend you.... it just my first time doing this... and my nerves are getting the best of me!! but srsly thank you for being so patient with me! u have been nothing short of great help!

  7. #37
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: i need help writing a program using array. ASAP!

    At the bottom of every one of my post in blue writing it shows to use them. You can either type them in or highlight your code and click on the code tags button ('#').
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  8. #38
    Join Date
    Dec 2012
    Posts
    21

    Re: i need help writing a program using array. ASAP!

    okay thank you so much for sticking with me all through this....i think this will be all now... wish me lcuk for my assignement....and i wish u the best luck!! hope i was'nt to much of a nuisance!

  9. #39
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: i need help writing a program using array. ASAP!

    I definitely wish you luck. Do you have it working now?
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  10. #40
    Join Date
    Dec 2012
    Posts
    5

    Re: i need help writing a program using array. ASAP!

    [code]
    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    import java.util.Scanner;

    public class MyHomework {

    public static void main(String[] args){
    int num = 0;
    int excellentstudent;
    excellentstudent = 0;
    double percentage = 0;
    Scanner scanner = new Scanner(System.in);


    BufferedReader bufferRead = new BufferedReader(new InputStreamReader(System.in));
    String s = scanner.nextLine(); // bufferRead.readLine();

    System.out.println(s);

    num = scanner.nextInt();

    int[] studentarray;
    studentarray = new int[num];
    int sum = 0;

    for (int i = 0; i < studentarray.length; i++ ){
    sum = sum + studentarray[num];
    }
    int gradecount = 0;
    if (sum >= 90 ){

    gradecount ++;
    //Sorry i dont understand this
    percentage = count * 100 / num;

    System.out.printf("The percentage f excellent student is : %.1f", + percentage);
    }
    }
    [code]

  11. #41
    Join Date
    Dec 2012
    Posts
    5

    Re: i need help writing a program using array. ASAP!

    Code:
    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    import java.util.Scanner;
    
    public class MyHomework {
    
    public static void main(String[] args){
    int num = 0;
    int excellentstudent;
    excellentstudent = 0;
    double percentage = 0;
    Scanner scanner = new Scanner(System.in);
    
    
    BufferedReader bufferRead = new BufferedReader(new InputStreamReader(System.in));
    String s = scanner.nextLine(); // bufferRead.readLine();
    
    System.out.println(s);
    
    num = scanner.nextInt();
    
    int[] studentarray;
    studentarray = new int[num];
    int sum = 0; 
    
    for (int i = 0; i < studentarray.length; i++ ){
    sum = sum + studentarray[num];
    }
    int gradecount = 0;
    if (sum >= 90 ){
    
    gradecount ++;	
    //Sorry i dont understand this
    percentage = count * 100 / num;
    
    System.out.printf("The percentage f excellent student is : %.1f", + percentage);
    }
    }

  12. #42
    Join Date
    Dec 2012
    Posts
    5

    Re: i need help writing a program using array. ASAP!

    Sorry for triple post. Anyway that is the program, after i fixed error. Just ask if you dont under stand. I think you need to read more books because you need to know how to make a "function"(or called "method" in java) and "declare variable".

Page 3 of 3 FirstFirst 123

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured