This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Input a char from keyboard ?

 
ADNAN KHAN
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assalam-o-Alakum:-
I have a little problem, my teacher give me an assignment. The question are;;;;;
Q.1:- write a program that allows the user to convert either from degree celsius to farenheit or degrees fahrenheit to celsius. Prompt the user to enter a temperature and either a 'c' for celsius and 'f' for farenheit. and if user input 'c' then convert the temperature in farenheit and it user input 'f' then convert temperature in celsius.
Q.2:- Write a program to read a list of exams score and check by category which it belong ?
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to use System.in to get the console input. However you need to run it through a BufferedReader if you want to take in more than 1 char.

Use typeIn to decide how to process tempIn.
For the exam scores you probably need to set up a case statement.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic