hi to all programmer...
i have a problem about this program ..
an error exist ..

import java.io.*;
import java.awt.Graphics;
import java.util.Random;
import javax.swing.*;

public class midquiz 2{ // "{" expected
public static void main (String [] args) throws IOExeption{
BufferedReader 9new InputStreamreader (System.in));
 String name,pass,ans; String pass1="pOLOtAn"; int len;

do{
 for (inta=0;a<=0;a--)
      {
 s.o.p ("Enter Username:");
 name = IN.readLine();
 len = name.length();
 if (len>= 8 && len<=15)
      {
 for (int b=0;b<3;b++)
      {
 s.o.p ("Enter Password:");
 pass=IN.readLine();
 if(pass.equals(pass1))
      {s.o.p ("Alphabetical Order of your name is:");
 for (int c=0;c<len;c++)
      {
 len [c]=name.charAt (c);
      }
 for(int c=0;c<len;c++)
      {
 if (let[c]>let [d])
      {
 char temp=let [c];
 let[c]=let[d];
 let[d]= temp;
      }
    }
  }
 for (int c=0;c<len;c++)
      {
 s.o.p (let [c]+"");
      }
      }
 if (b==2)
      {
 s.o.pIn ("ILLEGAL USER! GOODBYE....");
 System.exit (0);
      }
 else
      {
 s.o.pIn ("INVALID PASSWORD!");
      }
     }
 break;
      }
 s.o.pIn ("Username must be 8 to 15 character only.");
      }
 s.o.p ("\n Try Again? [Yes/No]:";
 ans=IN.readLine();
      } while (ans.equals Ignore Case ("Yes"));
      }}

the output i want to be is this:

// Enter Name: Simplicio
1 Capital constant letter/s
4 lower case consonant letter/s
0 capital Vowel letter/s
4 lower case Vowel letter/s
Try Again? //

please help me.. thanks

Recommended Answers

All 21 Replies

I guess you wanted to name the class midquiz 2
You can't have a blank in a class name.
ps By convention, class names begin with a capital letter

i change it now..
but still error exist:

import java.io.*;
import java.awt.Graphics;
import java.util.Random;
import javax.swing.*;

public class Meow
{
private static BufferedReader stdin =  new BufferedReader( new InputStreamReader( System.in ));
public static void main (String [] args) throws IOExeption
{

 String name,pass,ans; String pass1="pOLOtAn"; int len;

do{
 for (inta=0;a<=0;a--)
      {
 s.o.p ("Enter Username:");
 name = IN.readLine();
 len = name.length();
 if (len>= 8 && len<=15)
      {
 for (int b=0;b<3;b++)
      {
 s.o.p ("Enter Password:");
 pass=IN.readLine();
 if(pass.equals(pass1))
      {s.o.p ("Alphabetical Order of your name is:");
 for (int c=0;c<len;c++)
      {
 len [c]=name.charAt (c);
      }
 for(int c=0;c<len;c++)
      {
 if (let[c]>let [d])
      {
 char temp=let [c];
 let[c]=let[d];
 let[d]= temp;
      }
    }
  }
 for (int c=0;c<len;c++)
      {
 s.o.p (let [c]+"");
      }
      }
 if (b==2)
      {
 s.o.pIn ("ILLEGAL USER! GOODBYE....");
 System.exit (0);
      }
 else
      {
 s.o.pIn ("INVALID PASSWORD!");
      }
     }
 break;
      }
 s.o.pIn ("Username must be 8 to 15 character only.");
      }
while
 s.o.p ("\n Try Again? [Yes/No]:"); // "(" expected , illegal start of expression

 ans=IN.readLine();
while (ans.equals Ignore Case ("Yes")); // ")" expected
}  
} 	
} // "class" or "interface" expected, class or "interface" expected

please help me .. its making me dizzy T_T

help me.. thanks ...

Are you sure that whatever you've written is a java code? :)
kidding.
I can see a lot of compilation issues in your code. Check the first for loop. it sould be for(int a=o;...).

Please indent the code properly so that it becomes readable for we humans.

You have extra closing bracket.
Plus you need to change all this "s.o.p" replace with proper System calls, add statement to while loop on line 61, check use of declared variable names not just random names (line 18,25), line 15 check declaration in for loop plus I guess there will be more

Fixing syntax errors isn't hard, provided you stay cool. Start with the first error. Read the text of the message carefully, it will usually tell you exactly what's wrong. If you still can't see it, check the previous line to make sure that's terminated properly. Fix all the ones that look easy, then re-compile - many other errors may be caused by one mistake and will go away when you fix it.
Problems with extra or missing brackets, especially {}, are easier to see if you indent your code properly - in general I won't even waste time looking at unindented code.
Finally, when you've done all that and you still have one or two errors that you really can't fix, post them here.

import java.util.Scanner;


public class Meow
{
	static String authentication="pOLOtAn";
	static String choice="no";
	public static void main(String[] str)
	{
		String password=null;
		do
		{
			Scanner sc=new Scanner(System.in);
			System.out.println("Enter Your name");
			String name=sc.nextLine();
			System.out.println("**********"+name+"************");
			
			if(name.length()>=8 && name.length()<=15)
			{
				System.out.println("Enter Password");
				password=sc.nextLine();
				System.out.println("**********"+password+"************");
				
				if(!authentication.equalsIgnoreCase(password))
				{
					for(int i=0;i<2;i++)
					{
						System.out.println("The entered password is incorrect. Please try again");
						password=sc.nextLine();
						if(authentication.equalsIgnoreCase(password))
						{
							break;
						}
						if(i==1)
						{
							System.out.println("You have enetered wrong password 3 times. Bye!!!");
							System.exit(1);
						}
					}
				}
				
				else
				{
					//write all your logic here.
				}
			}
			else
			{
			
				System.out.println("User name must be 8 to 15 characters");
				System.out.println("Press Enter to continue or NO to exit");
				choice=sc.nextLine();
			}
			
			
		}
		while(!"no".equalsIgnoreCase(choice));
		
	}
}

@axeeffect2002, why you think I did not provided solution for all the errors in provided code? I wanted Monica to do it, so she learn something new. Error correction is an essential skill that you need to learn, because IDE will not do it for you.

@moderator

Please delete the post #7, where I've given the java code.

Thanks.

commented: Some +rep to start you off! +21

@moderator

Please delete the post #7, where I've given the java code.

Thanks.

axeeffect2002, don't worry about it. We know you are trying to help. Just try to keep peter_budo's post in mind in the future. Everyone has a different style and gives advice differently. It's fine to give code, just try not to post the whole program at once. Try to give advice and nudges in the right direction. Anyway, welcome!

i don't get it T_T ...

i try to change .. and put my logic in your code ..

but it full of error T_T

please ... help me.. i need it now T_T ...

Hi Monica,
We're here to help you if you only tell us where have you stuck.

i don't get it T_T ...

i try to change .. and put my logic in your code ..

but it full of error T_T

please ... help me.. i need it now T_T ...

Without seeing changes you made to your original code we cannot advice. So please post your code and we will try our best to advice you...

Without seeing changes you made to your original code we cannot advice. So please post your code and we will try our best to advice you...

import java.util.Scanner;
import java.io.*;





public class Meows
{
	static String authentication="pOLOtAn";
	static String choice="no";
	public static void main(String[] str)
	{
		String password=null;
		int len = str.length(), d, let;
		do
		{
			Scanner sc=new Scanner(System.in);
			System.out.println("Enter Your name");
			String name=sc.nextLine();
			System.out.println("**********"+name+"************");
			
			if(name.length()>=8 && name.length()<=15)
			{
				System.out.println("Enter Password");
				password=sc.nextLine();
				System.out.println("**********"+password+"************");
				
				if(!authentication.equalsIgnoreCase(password))
				{
					for(int i=0;i<2;i++)
					{
						System.out.println("The entered password is incorrect. Please try again");
						password=sc.nextLine();
						if(authentication.equalsIgnoreCase(password))
						{
							break;
						}
						if(i==1)
						{
							System.out.println("You have enetered wrong password 3 times. Bye!!!");
							System.exit(1);
						}
					}
				}
				
				else
				{
				 {System.out.print ("Alphabetical Order of your name is:");
				 for (int c=0;c<len;c++);
				 
				  
      {
 len ([c]=name.charAt (c)); // ")" expected, illegal start of expression
      }
 for(int c=0;c<len;c++);
      {
 if (let[c]>let [d]);
      {
 char temp=let [c];
 let[c]=let[d];
 let[d]= temp;
      }
    }
  }
 for (int c=0;c<len;c++);
      {
 System.out.print (let [c]+"");
      }
      }
			}
 		else
			{
			
				System.out.println("User name must be 8 to 15 characters");
				System.out.println("Press Enter to continue or NO to exit");
				choice=sc.nextLine();
			}
			
			
		}
		while(!"no".equalsIgnoreCase(choice));
		
	}
	
}

here ..

So Monica, that's the code, but what's the problem?
ps line 55 has an incorrect "(", so the compiler is looking for its matching ")"

Hi Monica,
If you try to indent your code properly, I bet you'd easily fix the missing braces or trivial syntactical errors like that by your own.

import java.io.*;
import java.awt.Graphics;
import java.util.Random;
import javax.swing.*;
import java.util.Scanner;

public class midquiz
{
    public static void main (String [] args) throws IOException
    {
        //try
        //{
        Scanner input = new Scanner(System.in);

        String name,pass,ans;
        String pass1="pOLOtAn";
        int len;
        char len1[];
        len1 = new char[20];


        do
        {

                 System.out.println ("Username must be 8 to 15 character only.");
                 System.out.print("Enter Username:");
                 name = input.nextLine();
                 len = name.length();

                 if (len>= 8 && len<=15)
                 {
                    for (int b=0;b<1;b++)
                    {
                        System.out.print("Enter Password:");
                        pass=input.nextLine();
                        if(pass.equals(pass1))
                        {
                            System.out.print("Alphabetical Order of your name is:");
                            for (int c=0;c<len;c++)
                            {
                                len1[c]=name.charAt(c);
                            }

                            //for(int d=1;d<len;d++)
                            //{
                            //  if (let[c]>let[d])
                            //     {
                            //      char temp=let[c];
                            //      let[c]=let[d];
                            //      let[d]= temp;
                            //     }
                            // }

                            for (int c=0;c<len;c++)
                            {
                                 System.out.println(len1[c]+"");
                            }
                        }
                        else
                        {
                            System.out.println("You Have Enter Wrong PassWord ");
                            System.exit(0);
                        }


                }


              }
              else
                {
                     System.out.println("ILLEGAL USER! GOODBYE....");
                     System.exit (0);
                }


         System.out.println("\n Try Again? [Yes/No]:");
         ans=input.nextLine();

      }while (ans.equalsIgnoreCase ("Yes"));

  }

}

this code does't hv any error try with this

OK, your trouble, to begin with, starts with else statement here

else{
    /*{ extra bracket*/System.out.print ("Alphabetical Order of your name is:");

There is extra opening bracket, then followed be 3 for loops with ";" between loop body and opening bracket (same applies for if statement in second for loop). First for loop also encapsulate some weird declaration or assignment attempt len ([c]=name.charAt (c)); . And to close it for now there is one extra closing bracket after 3rd for loop.

Can you please sort these problems for now?

this code does't hv any error try with this

  1. Use full sentence English.
  2. We are trying to help Monica so she learn in the process and not to give full solution so she would fail her class. Don't you think any of us could do it long ago and in more advanced and sophisticated way?
  1. Use full sentence English.
  2. We are trying to help Monica so she learn in the process and not to give full solution so she would fail her class. Don't you think any of us could do it long ago and in more advanced and sophisticated way?

ok dear i will take care of that .

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.