Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The file, Sales.txt , shown in Figure 1 contains the product# and four quarterly sales for several products. Figure 1 : Sales.txt 1 0 3

The file, Sales.txt, shown in Figure 1 contains the product# and four quarterly sales for several products.
Figure 1: Sales.txt
1033,16,32,23,40
1009,144,182,169,205
1014,54,49,72,63
1005,38,62,55,77
1001,7,9,8,15
The following code is intended to read the product# and quarterly sales from each row in Sales.txt file and store them in a 2-dimenstiona array named sales:
string[,] sales = new string[5,5]; //Declare a 2-D array
private void TwoDimArray_Load(object sender, EventArgs e)
{
string currentLine;
string[] fields;
int row =0;
StreamReader SalesReader = new StreamReader("Sales.txt");
while (SalesReader.EndOfStream == false)
{
currentLine = SalesReader.ReadLine();
fields = currentLine.Split(',');
for (int column =0; column <=4; column++)
XXXXX; // missing statement
row = row +1;
}
}
In the above code, XXXXX represents the missing statement that stores the data in sales array. The appropriate statement to store the data in sales array is:
Question 10 options:
a)
sales[5, column]= fields[column];
b)
sales[row, column]= fields[row];
c)
sales[row,5]= fields[column];
d)
sales[row, column]= fields[column];

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

Intelligent Information And Database Systems 6th Asian Conference Aciids 2014 Bangkok Thailand April 7 9 2014 Proceedings Part I 9 2014 Proceedings Part 1 Lnai 8397

Authors: Ngoc-Thanh Nguyen ,Boonwat Attachoo ,Bogdan Trawinski ,Kulwadee Somboonviwat

2014th Edition

3319054759, 978-3319054759

More Books

Students also viewed these Databases questions