Question: CHALLENGE ACTIVITY 3 . 2 . 2 : Output formatting. 5 2 2 5 6 2 3 5 7 8 1 9 4 q 3
CHALLENGE
ACTIVITY
: Output formatting.
qy
Jump to level
Integer distanceRan and double distanceTraveled are read from input. Output the following:
distanceRan with a sign and a minimum of characters.
distanceTraveled leftaligned, a minimum of characters, and digits following the decimal point.
End each output with a newline.
Ex If the input is then the output is:
import java.util.Scanner;
public class OutputFormatter
public static void mainString args
Scanner scnr new Scanner
System.in;
int distanceRan;
double distanceTraveled;
distanceRan scnr nextInt ;
distanceTraveled scnr nextDouble;
Your code goes here
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
