Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package temperature;
- import out.*;
- public class TemperatureConverter {
- public void convertTemp
- (int temperature, char convertTo){
- if (convertTo=='F'){
- Print.print(temperature+" F");
- }else if (convertTo=='C'){
- Print.print(temperature+" C");
- }else if (convertTo=='K'){
- if (temperature<0){
- Print.print("no");
- }else {
- Print.print(temperature+" K");}
- }else {
- Print.print("ne FCK");
- }
- }
- public static void main(String[] args){
- TemperatureConverter temp = new TemperatureConverter();
- temp.convertTemp(-1, 'K');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment