Java Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJava Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 16th, 2006, 09:30 PM
unclebuck unclebuck is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2005
Posts: 6 unclebuck User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 45 m 59 sec
Reputation Power: 0
Angry I am a beginner and Im having trouble with this Java Lab. I think its almost done!

// Ive been banging my head on the wall trying to get this pgm to work for a couple days now.

// Can any one help me?


// Write a program that asks the user's name, and then greets the user by name.
// Before outputting the user's name, convert it to upper case letters.
// For example, if the user's name is Fred, then the program should respond
// "Hello, FRED, nice to meet you!".


import java.io.*;

public class ques1 {

public static void main(String[] args) {

String userName; // userName, as entered by the user
String upperCaseName; // usersName, converted to uppercase letters.


try{

BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

System.out.println("Please enter your name: ");

userName = reader.readLine( );

userName = userName.toUpperCase();

upperCaseName = userName;

System.out.println("Hello, " + upperCaseName + ", nice to meet you!");

} catch (IO exception io){}

// end main()

} // end class

Reply With Quote
  #2  
Old January 16th, 2006, 10:52 PM
destin destin is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Posts: 18 destin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 9 h 6 m 19 sec
Reputation Power: 0
Send a message via AIM to destin
Change
Java Code:
Original - Java Code
  1. catch (IO exception e) {}

to
Java Code:
Original - Java Code
  1. catch (IOException e) {}


Also, it looks like you're missing the main() closing bracket.

Reply With Quote
  #3  
Old January 28th, 2006, 10:02 PM
proghelper proghelper is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 12 proghelper User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 46 m 21 sec
Reputation Power: 0
One comment.

As a beginner, it is always good if you lern to indent the code. This helps you when it comes to finding errors.

Programming (Assignment/Project) Help

Reply With Quote
  #4  
Old January 29th, 2006, 02:32 PM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
The forum strips white space if you don't wrap your code with [code][/code] tags when posting.
Indenting, and pasting in the forum, makes reading the code easier.
__________________
Daryl's Homepage | My Blogroll | My Profile | Firefox supporter!
DevArticles Forum Moderator

"The net is a waste of time, and that's exactly what's right about it." -- William Gibson

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJava Development > I am a beginner and Im having trouble with this Java Lab. I think its almost done!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway