hello, i have a code below and i dont know how to make a string input for me to input hte name of the student...kindly check it out...

import java.io.*;
public class io
{
public static InputStreamReader reader = new InputStreamReader(System.in);	
public static BufferedReader input= new BufferedReader(reader);
public static void main (String[]args)throws Exception {
	
double grade1,grade2,grade3,grade4,average;
String name;
		
System.out.println("Enter Student's Name: ");
		
// HOW DO I INTEGRATE THE CODE TO INPUT STUDENTS NAME?
		
System.out.println("Enter First Grading: ");
grade1=Double.parseDouble(input.readLine());
System.out.println("Enter Second Grading: ");
grade2=Double.parseDouble(input.readLine());
System.out.println("Enter Third Grading: ");
grade3=Double.parseDouble(input.readLine());
System.out.println("Enter Fourth Grading: ");
grade4=Double.parseDouble(input.readLine());
average=(grade1 + grade2 + grade3 + grade4)/4;
System.out.println("The avegrage is: "+ average);

}
	
}

hi lloydsbackyard,
it is just simple... the readline method will return the string

there you have to give
name=input.readLine();

without the parsing to the double...

hi lloydsbackyard,
it is just simple... the readline method will return the string

there you have to give
name=input.readLine();

without the parsing to the double...

THANK YOU VERY MUCH! ITS NOW RUNNING!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.