Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 29th, 2008, 9:31 AM   #11
Freaky Chris
Hobbyist Programmer
 
Freaky Chris's Avatar
 
Join Date: Dec 2007
Location: England
Posts: 169
Rep Power: 1 Freaky Chris is on a distinguished road
Send a message via MSN to Freaky Chris
Re: Snytax error

Quote:
Originally Posted by Shamsi
(Toggle Plain Text)
String Option0=JOptionPane.showInputDialog("Enter Number to Exit from The Programme");
int z=Integer.parseInt(Option0);
if (z == 0){// 0 is the number of exiting for the programme
break;
}// to stop the programme from running String Option0=JOptionPane.showInputDialog("Enter Number to Exit from The Programme");
int z=Integer.parseInt(Option0);
if (z == 0){// 0 is the number of exiting for the programme
break;
}// to stop the programme from running
the error says"breaks outside switch or loop"
You havn't got any loops shown for you to break out of with the break statement within your if statement, so as far as i can see your trying to break out of nothing.

Chris
__________________
Who said i couldn't program
sarcasm = raw_input('Type in a sarcastic remark: ')
print sarcasm
Freaky Chris is offline   Reply With Quote
Old Apr 29th, 2008, 9:45 AM   #12
A.K.Al Shamsi
Programmer
 
A.K.Al Shamsi's Avatar
 
Join Date: Mar 2008
Posts: 35
Rep Power: 0 A.K.Al Shamsi is on a distinguished road
Re: Snytax error

what do you mean?? i didn't get what you are trying to explain..
A.K.Al Shamsi is offline   Reply With Quote
Old Apr 29th, 2008, 9:53 AM   #13
Freaky Chris
Hobbyist Programmer
 
Freaky Chris's Avatar
 
Join Date: Dec 2007
Location: England
Posts: 169
Rep Power: 1 Freaky Chris is on a distinguished road
Send a message via MSN to Freaky Chris
Re: Snytax error

break; attempts to break out of a loop, you have no loop to break out of. Any better?
__________________
Who said i couldn't program
sarcasm = raw_input('Type in a sarcastic remark: ')
print sarcasm
Freaky Chris is offline   Reply With Quote
Old Apr 29th, 2008, 9:54 AM   #14
A.K.Al Shamsi
Programmer
 
A.K.Al Shamsi's Avatar
 
Join Date: Mar 2008
Posts: 35
Rep Power: 0 A.K.Al Shamsi is on a distinguished road
Re: Snytax error

you mean there is no loops so that why it is giving me an error so it needs a loop to break it.... is that what are you trying to say?
A.K.Al Shamsi is offline   Reply With Quote
Old Apr 29th, 2008, 9:58 AM   #15
Freaky Chris
Hobbyist Programmer
 
Freaky Chris's Avatar
 
Join Date: Dec 2007
Location: England
Posts: 169
Rep Power: 1 Freaky Chris is on a distinguished road
Send a message via MSN to Freaky Chris
Re: Snytax error

yes pretty much lol, sorry im at college in the middle of a basic ICT lesson so its kinda hard to answer.
__________________
Who said i couldn't program
sarcasm = raw_input('Type in a sarcastic remark: ')
print sarcasm
Freaky Chris is offline   Reply With Quote
Old Apr 29th, 2008, 1:03 PM   #16
A.K.Al Shamsi
Programmer
 
A.K.Al Shamsi's Avatar
 
Join Date: Mar 2008
Posts: 35
Rep Power: 0 A.K.Al Shamsi is on a distinguished road
Re: Snytax error

loool... i am specialising in programming now.... college student just like you loool.... but it seems that you have a great foundation in programming...
A.K.Al Shamsi is offline   Reply With Quote
Old Apr 29th, 2008, 2:49 PM   #17
Freaky Chris
Hobbyist Programmer
 
Freaky Chris's Avatar
 
Join Date: Dec 2007
Location: England
Posts: 169
Rep Power: 1 Freaky Chris is on a distinguished road
Send a message via MSN to Freaky Chris
Re: Snytax error

Quote:
Originally Posted by A.K.Al Shamsi View Post
loool... i am specialising in programming now.... college student just like you loool.... but it seems that you have a great foundation in programming...
College student i may be, my college doesn't offer programming courses. Unfortunatly, however i do hope to progress into Uni and study it. What i kow is from my own interest in the area.

Have you resolved the problem?

Chris
__________________
Who said i couldn't program
sarcasm = raw_input('Type in a sarcastic remark: ')
print sarcasm
Freaky Chris is offline   Reply With Quote
Old Apr 29th, 2008, 6:40 PM   #18
A.K.Al Shamsi
Programmer
 
A.K.Al Shamsi's Avatar
 
Join Date: Mar 2008
Posts: 35
Rep Power: 0 A.K.Al Shamsi is on a distinguished road
Re: Snytax error

yea i did... thanks
A.K.Al Shamsi is offline   Reply With Quote
Old Apr 30th, 2008, 1:23 AM   #19
Freaky Chris
Hobbyist Programmer
 
Freaky Chris's Avatar
 
Join Date: Dec 2007
Location: England
Posts: 169
Rep Power: 1 Freaky Chris is on a distinguished road
Send a message via MSN to Freaky Chris
Re: Snytax error

Good Good, nice to see you worked it out.

Cheers,
Chris
__________________
Who said i couldn't program
sarcasm = raw_input('Type in a sarcastic remark: ')
print sarcasm
Freaky Chris is offline   Reply With Quote
Old Apr 30th, 2008, 3:30 AM   #20
A.K.Al Shamsi
Programmer
 
A.K.Al Shamsi's Avatar
 
Join Date: Mar 2008
Posts: 35
Rep Power: 0 A.K.Al Shamsi is on a distinguished road
Re: Snytax error

i added into

        int z=Integer.parseInt(Option0);
            if (z == 0){// 0 is the number of exiting for the programme
                   break;

it shows unreachable statement in here:
        while(true){// while true starts for looping
        String menu="Enter your Option:\n " ;
        // the menu starts and converting ways of minute, hour, day, year, month, week and year
        String Option1= "1- Convert from Minute to Hour                  2- Convert from Hour to Minute \n";
        String Option2= " 3- Convert from Day to Hour                        4- Convert from Hour to Day \n";
        String Option3= " 5- Convert from Days to Week                    6- Convert from Week to Days \n";
        String Option4= " 7- Convert from Year to Weeks                   8- Convert from Weeks to Year \n";
        String Option5= " 9- Convert from Months to Year                  0- Exit";
        String choose= JOptionPane.showInputDialog(menu + Option1 + Option2+ Option3+ Option4+Option5);
        // to dispaly the menu in input dialog so the user can enter any number from above
        int num = Integer.parseInt(choose);}


so what is the solution??
A.K.Al Shamsi is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Basic Socket Programming Error in Linux.. Pls help boraciner C++ 18 Sep 12th, 2007 1:17 AM
C# corruption!!! Kilo C++ 32 May 21st, 2006 8:44 PM
Masm rsnd Assembly 4 May 20th, 2006 9:05 PM
libraries matko C 1 Jan 22nd, 2006 2:12 PM
String error in if statement Blighttdm C 12 Nov 18th, 2005 6:34 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:28 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC