Programming Forums
User Name Password Register
 

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

Reply
 
Thread Tools Display Modes
Old Jun 11th, 2005, 5:50 PM   #31
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
My suggestion for your next step would be to enhance the user interface. Have the user enter a number followed by (or appended with) the appropriate letter. For example, 100C or 100 C would be converted to the appropriate fahrenheit value. One thing to remember with users is that they are careless, make typos, go to sleep with their head on the keyboard, or maliciously try to break your program. Input validation is therefore very important for robust programming.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Jun 12th, 2005, 2:09 AM   #32
shangnyun
Programmer
 
shangnyun's Avatar
 
Join Date: Jun 2005
Posts: 34
Rep Power: 0 shangnyun is on a distinguished road
Quote:
Originally Posted by DaWei
My suggestion for your next step would be to enhance the user interface. Have the user enter a number followed by (or appended with) the appropriate letter. For example, 100C or 100 C would be converted to the appropriate fahrenheit value. One thing to remember with users is that they are careless, make typos, go to sleep with their head on the keyboard, or maliciously try to break your program. Input validation is therefore very important for robust programming.
Thanks for the suggestion, but this app is done. I mean, I'll keep it around for possible future testing of other Java features and whatnot, but assignment-wise, this is completed.
It's true that the temperature and the letter for either Fahrenheit or Celsius conversion should be entered on the same line. Well, it should be possible to enter the number and the letter on the same line. I'm not sure how I could accomplish that but I'll see what I can do.

Thanks
shangnyun is offline   Reply With Quote
Old Jun 12th, 2005, 8:31 AM   #33
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 8 Ooble is on a distinguished road
I suggest you try it out - if you can accomplish it, you'll have learnt a lot. Basically, what you need to do is read the whole thing into a string, check the last character (which should be 'C' or 'F') - you can use charAt for this, and use a function that converts a string to a floating-point number to decipher the rest. I don't know Java, so I can't point you in the direction of a specific function, but someone else should be able to give you a hand.
__________________
Me :: You :: Them
Ooble 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




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

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