Jump to content

wat will be the code for a promgram like this

- - - - -

  • Please log in to reply
5 replies to this topic

#1
atoivan

atoivan

    Learning Programmer

  • Members
  • PipPipPip
  • 61 posts
a program that will accept student name and grades and output it.use an array data structure in the implementation this program and implement the following

write method that will traverses the array and allow the user to perform the following processes

a) search for a particular student and his or her marks
b)find the average of all the student in the class
c)find all student with a mark below 50 and output them.

ps
pls help me write the codes

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
Standard first question: what do you have so far?

Standard second question: what part are you having difficulty with?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
atoivan

atoivan

    Learning Programmer

  • Members
  • PipPipPip
  • 61 posts
import java.util.Scanner;
//import java.lang.String;
public class Main {
public static int n;
//public static String names;
    //private static String[] nameS;
    //private static String[] nameS;
    /**
     * @param args the command line arguments
     */

    public static void main(String[] args/*,String[] nameS*/) {
        Scanner in=new Scanner(System.in);
        int Da=0;
      int num []=new int[n];
     //int x=0;
     

      System.out.printf("%s\n","Enter the Number of student taking This Couse");
      n=in.nextInt();
       String name[]=new String [n];
      System.out.printf("%s  %s \n", "index","value");
      for (; Da < name.length; Da++ )/*Da 4 Display array*/ {
      System.out.printf( "%5d%8d\n", Da, name[Da] );
    }
      System.out.println("Enter the names of the student");
      String names;
      names=in.nextLine();
        name[n] = new String(names);
for (; Da < name.length; Da++ ){
      System.out.printf( "%5d%8d\n", Da, name[Da] );
    }




    }
    }
i can not input the names into the array i created
pls help me

Edited by Alexander, 03 December 2010 - 06:45 PM.
( # button)


#4
atoivan

atoivan

    Learning Programmer

  • Members
  • PipPipPip
  • 61 posts
the Second is how will the traverses be done

#5
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
Well, it looks like your names input is outside the for loop.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#6
atoivan

atoivan

    Learning Programmer

  • Members
  • PipPipPip
  • 61 posts
i have corrected it thankz any way




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users