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]); } }
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,...
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 }
}](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F9e6fa127-a003-469d-9a51-b1d4610918ed%2Fb9ceccef-59af-4436-9f94-06e62bf5b41e%2F04dka5_processed.png&w=3840&q=75)
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
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 5 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
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
Recommended textbooks for you
![C++ for Engineers and Scientists](https://www.bartleby.com/isbn_cover_images/9781133187844/9781133187844_smallCoverImage.gif)
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
![C++ for Engineers and Scientists](https://www.bartleby.com/isbn_cover_images/9781133187844/9781133187844_smallCoverImage.gif)
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
![Programming with Microsoft Visual Basic 2017](https://www.bartleby.com/isbn_cover_images/9781337102124/9781337102124_smallCoverImage.gif)
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,