i want to write a 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.

i started off with this codes in Java .But the thing is if i can do it in java i can do it in C and C++

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( name) i created
pls help me

Exactly what are you trying to do???

i want to write a a program that will accept student name and grades and output it.using an array data structure in the implementation this program

import java.util.Scanner;
public class Main {
public static int n;
//public 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++ ){
      System.out.printf( "%5d%8d\n", Da, name[Da] );
    }
      //String names;
      System.out.println("Enter the names of the student");
     String names=in.nextLine()
for (; Da < name.length; Da++ ){
      System.out.printf( "%5d%8d\n", Da, name[Da] );
    }
   }

}

1 i need a loop to cycle (n) times and ask for a name each time.
2.the i can not input the names into the array( name)created

Edited 3 Years Ago by mike_2000_17: Fixed formatting

This article has been dead for over six months. Start a new discussion instead.