Integer numElements is read from input and represents: • The number of elements in each array. • The number of pairs of integers read from input. Declare two integer arrays, houselds and serviceCosts. Then, read each pair of integers from input. For each pair read, store the first integer into houselds and the second integer into serviceCosts. Ex: If the input is: 4 3 29 9 12 8 18 5 46 then the output is: House id: 3, Costs: $29 House id: 9, Costs: $12 House id: 8, Costs: $18 House id: 5, Costs: $46 1 import java.util.Scanner; 2 3 public class CashRecords { 4 5 6 7 8 9 10 11 12 13 14 15 16 17 } public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int numElements; int i; numElements scnr .nextInt(); * Your code goes here */ for (i = 0; i < numElements; ++i) { System.out.println("House id: "+ houseIds [i] +", Costs: $" + serviceCosts [i]); } }

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter7: Arrays
Section7.1: One-dimensional Arrays
Problem 10E: (Electrical eng.) Write a program that specifies three one-dimensional arrays named current,...
icon
Related questions
Question
Integer numElements is read from input and represents:
• The number of elements in each array.
The number of pairs of integers read from input.
Declare two integer arrays, houselds and serviceCosts. Then, read each pair of integers from input. For each pair read, store the
first integer into houselds and the second integer into serviceCosts.
Ex: If the input is:
4
3 29 9 12 8 18 5 46
then the output is:
House id: 3, Costs: $29
House id: 9, Costs: $12
House id: 8, Costs: $18
House id: 5, Costs: $46
1 import java.util.Scanner;
2
3 public class CashRecords {
4
5
16780 O
9
public static void main(String[] args) {
Scanner scnr= new Scanner (System.in);
int numElements;
int i;
numElements scnr. nextInt ();
/* Your code goes here */
for (i = 0; i< numElements; ++i) {
System.out.println("House id: + houseIds[i] + ", Costs: $" + serviceCosts [i]);
10
11
12
13
14
15
16 }
17 }
}
Transcribed Image Text:Integer numElements is read from input and represents: • The number of elements in each array. The number of pairs of integers read from input. Declare two integer arrays, houselds and serviceCosts. Then, read each pair of integers from input. For each pair read, store the first integer into houselds and the second integer into serviceCosts. Ex: If the input is: 4 3 29 9 12 8 18 5 46 then the output is: House id: 3, Costs: $29 House id: 9, Costs: $12 House id: 8, Costs: $18 House id: 5, Costs: $46 1 import java.util.Scanner; 2 3 public class CashRecords { 4 5 16780 O 9 public static void main(String[] args) { Scanner scnr= new Scanner (System.in); int numElements; int i; numElements scnr. nextInt (); /* Your code goes here */ for (i = 0; i< numElements; ++i) { System.out.println("House id: + houseIds[i] + ", Costs: $" + serviceCosts [i]); 10 11 12 13 14 15 16 } 17 } }
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 2 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,