0

We are suppose to create a registration form but it is not running! can you please help me and teach me what is wrong and what i am suppose to put! thank you! here is my code....

import java.io.*;

public class regform
{
	public static void main(String args[])throws IOException
	{
		BufferedReader br= new BufferedReader (new InputStreamReader (System.in));
		String name,course,days,subject,section,time;
		int unit,ID;
		int ctr=0;

		for(ctr=0;ctr<3;ctr++)
		{

			System.out.print("\n Enter name: ");
			name=br.readLine();
			System.out.print("\n Enter ID: ");
			ID=Integer.parseInt(br.readLine());
			System.out.print("\n Enter course: ");
			course=br.readLine();
			System.out.print("\n Enter section: ");
			section=br.readLine();

			for(ctr=0;ctr<5;ctr++)
			{

				System.out.print("\n Enter subject: ");
				subject=br.readLine();
				System.out.print("\n Enter days: ");
				days=br.readLine();
				System.out.print("\n Enter time: ");
				time=br.readLine();
				System.out.print("\n Enter unit: ");
				unit=Integer.parseInt(br.readLine());

			}
		}


		for(ctr=0;ctr<3;ctr++)
		{

			System.out.print("\n " + name);
			System.out.print("\n " + ID);
			System.out.print("\n " + course);
			System.out.print("\n " + section);


			for(ctr=0;ctr<5;ctr++)
			{

				System.out.print("\n " + subject);
				System.out.print("\n " + days);
				System.out.print("\n " + time);
				System.out.print("\n " + unit);
			}

		}


	}
}

Edited by peter_budo: Removed colour formatting

4
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by NormR1
0

Stop abusing colour formatting every time you post something it will not get your question solved faster. Instead post what error messages you get when you tried to compile or run this thing.

Edited by peter_budo: n/a

0
import java.io.*;
     
    public class regform
    {
    public static void main(String args[])throws IOException
    {
    BufferedReader br= new BufferedReader (new InputStreamReader (System.in));
    String name = null,course = null,days = null,subject = null,section = null,time = null;
    int unit = 0,ID = 0;
    int ctr=0;
     
    for(ctr=0;ctr<3;ctr++)
    {
     
    System.out.print("\n Enter name: ");
    name=br.readLine();
    System.out.print("\n Enter ID: ");
    ID=Integer.parseInt(br.readLine());
    System.out.print("\n Enter course: ");
    course=br.readLine();
    System.out.print("\n Enter section: ");
    section=br.readLine();
     
    for(ctr=0;ctr<5;ctr++)
    {
     
    System.out.print("\n Enter subject: ");
    subject=br.readLine();
    System.out.print("\n Enter days: ");
    days=br.readLine();
    System.out.print("\n Enter time: ");
    time=br.readLine();
    System.out.print("\n Enter unit: ");
    unit=Integer.parseInt(br.readLine());
     
    }
    }
     
     
    for(ctr=0;ctr<3;ctr++)
    {
     
    System.out.print("\n " + name);
    System.out.print("\n " + ID);
    System.out.print("\n " + course);
    System.out.print("\n " + section);
     
     
    for(ctr=0;ctr<5;ctr++)
    {
     
    System.out.print("\n " + subject);
    System.out.print("\n " + days);
    System.out.print("\n " + time);
    System.out.print("\n " + unit);
    }
     
    }
     
     
    }

You Forget to intialize String var to null.

0

create a registration form but it is not running

Please explain what you want your code to do in more detail.
Show what it does now and add comments describing how the output is incorrect and what you want the output to look like.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.