Question: Given the integer array yearlyMiles with the size of NUM _ INPUTS, write a for loop to output the integers in the first half of

Given the integer array yearlyMiles with the size of NUM_INPUTS, write a for loop to output the integers in the first half of yearlyMiles. Separate the integers with a dash surrounded by spaces ("-").
Ex: If the input is 11977937397896211610346, then the output is:
119-77-93-73-97 public class MileData {
public static void main(String[] args){
Scanner scnr = new Scanner(System.in);
final int NUM_INPUTS =10;
int[] yearlyMiles = new int[NUM_INPUTS];
int i;
for (i =0; i < yearlyMiles.length; ++i){
yearlyMiles[i]= scnr.nextInt();
}
for (your code here){
your code here
}
}
System.out.println();
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!