Java program for calculate weather of a city
Answers
Answered by
23
Answer
............
note : - this is in farhenite
import java.util.
*; class Fahrenhe
ToCelsius
{
********public static ********
void main
(String[] args)
{
float temperatue;
Scanner in = new Scanner
(System.in);
System.
out.println(
"Enter temperatue in Fahrenheit");
temperatue = in.nextInt();
temperatue = ((temperatue - 32)*5)/9;
System.out.println("Temperatue in Celsius = " + temperatue); } }
............
note : - this is in farhenite
import java.util.
*; class Fahrenhe
ToCelsius
{
********public static ********
void main
(String[] args)
{
float temperatue;
Scanner in = new Scanner
(System.in);
System.
out.println(
"Enter temperatue in Fahrenheit");
temperatue = in.nextInt();
temperatue = ((temperatue - 32)*5)/9;
System.out.println("Temperatue in Celsius = " + temperatue); } }
Answered by
10
I have written the following code
Map:
import java.io.IOException; import java.util.StringTokenizer; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Mapper; public class Map extends Mapper<LongWritable, Text, Text, IntWritable>{ private IntWritable max = new IntWritable(); private Text word = new Text(); @Override protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { StringTokenizer line = new StringTokenizer(value.toString(),",\t"); word.set(line.nextToken()); max.set(Integer.parseInt(line.nextToken())); context.write(word,max); } }
Similar questions