Imagine that a meteorologist is collecting an amount of rainfall on a given day. The…
- User
Imagine that a meteorologist is collecting an amount of rainfall on a given day. The rain gathering equipment reports an amount for that day. We need to write a program to (1) capture the rainfall measurement as an integer (total amount of millimeters, mm), (2) calculate a fractional number that denotes the measurement in centimeters, and (3) print out the rainfall amount at the end in the format shown below.import java.util.Scanner;
public class CodeDebuggingExercise1_02 { public static void main(String[] args){ Scanner kb =new Scanner(System.in); double cm = kb.nextDouble(); int mm = kb.nextInt(); final String OUTPUT = "Rainfall (cm, mm):%.2f, %d";
codeSystem.out.printf(OUTPUT, cm, mm); }}
- Assistant
import java.util.Scanner;
public class CodeDebuggingExercise1_02 { public static void main(String[] args){ Scanner kb = new Scanner(System.in);
codeint mm = kb.nextInt(); double cm = mm / 10.0; final String OUTPUT = "Rainfall (cm, mm): %.2f, %d"; System.out.printf(OUTPUT, cm, mm); }}