Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Guide To Client Server Databases

Authors: Joe Salemi

2nd Edition

1562763105, 978-1562763107

More Books

Students also viewed these Databases questions