Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help writing this simple code in java to read and write from the data file. The numbers below are the data from the

I need help writing this simple code in java to read and write from the data file.

image text in transcribed

The numbers below are the data from the separate file that we need to read and write into java:

Name the file of numbers = population by zip.txt

90001 57110

90002 51223

90003 66266

90004 62180

90005 37681

90006 59185

90007 40920

90008 32327

90010 3800

90011 103892

90012 31103

90013 11772

90014 7005

90015 18986

90016 47596

90017 23768

90018 49310

90019 64458

90020 38967

90021 3951

90022 67179

90023 45903

90024 47452

90025 42147

90026 67869

90027 45151

90028 28714

90029 38617

90031 39316

90032 45786

90033 48852

90034 57964

90035 28418

90036 36865

90037 62276

90038 28917

90039 28514

90040 12520

90041 27425

90042 62430

90043 44789

90044 89779

90045 39480

90046 48581

90047 48606

90048 21397

90049 35482

90056 7827

90057 44998

90058 3223

90059 40952

90061 26872

90062 32821

90063 55758

90064 25403

90065 45527

90066 55277

90067 2424

90068 22286

90069 20483

90071 15

90073 539

90077 9377

90079 0

90089 3217

90090 0

90094 5464

90095 3

90201 101279

90210 21741

90211 8434

90212 11555

90220 49328

90221 53704

90222 31869

90230 31766

90232 15149

90240 25876

90241 42399

90242 43497

90245 16654

90247 47487

90248 9947

90249 26669

90250 93193

90254 19506

90255 75066

90260 34924

90262 69745

90263 1612

90265 18116

90266 35135

90270 27372

90272 22986

90274 25209

90275 41804

90277 35293

90278 40071

90280 94396

90290 6368

90291 28341

90292 21576

90293 12132

90301 36568

90302 29415

90303 26176

90304 28210

90305 14853

90401 6722

90402 12250

90403 24525

90404 21360

90405 27186

90501 43180

90502 18010

90503 44383

90504 32102

90505 36678

90506 0

90601 31974

90602 25777

90603 20063

90604 39407

90605 40331

90606 32396

90621 35153

90623 15554

90630 47993

90631 67619

90638 49012

90640 62549

90650 105549

90660 62928

90670 14866

90701 16591

90703 49399

90704 4090

90706 76615

90710 25457

90712 31499

90713 27925

90715 20388

90716 14184

90717 21318

90720 21751

90723 54099

90731 59662

90732 21115

90740 23729

90744 53815

90745 57251

90746 25990

90747 0

90755 11074

90802 39347

90803 32031

90804 40311

90805 93524

90806 42399

90807 31481

90808 38232

90810 36735

90813 58911

90814 19131

90815 39733

90822 117

90831 0

91001 36126

91006 31715

91007 34095

91008 1391

91010 26074

91011 20280

91016 40598

91020 8415

91024 10917

91030 25616

91040 20372

91042 27585

91046 156

91101 20460

91103 27480

91104 36751

91105 11254

91106 24229

91107 32940

91108 13361

91201 22781

91202 22830

91203 13220

91204 16032

91205 37810

91206 33065

91207 10506

91208 16245

91210 328

91214 30356

91301 25488

91302 25709

91303 26855

91304 50231

91306 45061

91307 24474

91311 36557

91316 26898

91321 34882

91324 27669

91325 32417

91326 33708

91330 2702

91331 103689

91335 74363

91340 34188

91342 91725

91343 60254

91344 51747

91345 18496

91350 33348

91351 32362

91352 47807

91354 28722

91355 32605

91356 29458

91361 20438

91362 36045

91364 25851

91367 39499

91377 13811

91381 20158

91384 29855

91387 40328

91390 19786

91401 39285

91402 69817

91403 23484

91405 51145

91406 51558

91411 24628

91423 30991

91436 14372

91501 20849

91502 11371

91504 24939

91505 30778

91506 18904

91601 37180

91602 17473

91604 29034

91605 56343

91606 44958

91607 27927

91608 0

91702 59705

91706 76571

91709 74796

91710 80358

91711 35705

91722 34409

91723 18275

91724 26184

91731 29591

91732 61386

91733 43896

91740 25356

91741 25824

91744 85040

91745 54013

91746 30485

91748 45406

91750 33249

91754 32742

91755 27496

91759 476

91763 36375

91765 46457

91766 71599

91767 48068

91768 34537

91770 62097

91773 33119

91775 23988

91776 38475

91780 34332

91784 25938

91786 51165

91789 43079

91790 44907

91791 32414

91792 30854

91801 52735

91803 30322

92301 32725

92371 16763

92372 6220

92397 4894

92821 35533

92823 3613

92833 51767

93040 2031

93063 54366

93225 5077

93243 1699

93252 4176

93510 7993

93523 3074

93532 2932

93534 39341

93535 72046

93536 70918

93543 13033

93544 1259

93550 74929

93551 50798

93552 38158

93553 2138

93560 18910

93563 388

93591 7285

You are given an input file containing ZIP Codes and population data for the Los Angeles area from 2010 (download the file from Canvas). Write a program that reads the file and does two things . Write to an output file called dataSwitch.txt the same data from the input file, but switch the order of the data entries on each line. For example, if the first line of the input file is "90001 57110", the first line of the output file would be "57110 90001". Additionally, print to the screen the number of lines in the file with a label . The file had 318 lines. Things to Remember: Save the initial data file in a location that will be easy to access. Creating a "O" folder on your C: drive is recommended. Feel free to rename it if you wish Save the output file ("dataSwitch.txt" into your project folder, i.e. don't add a path to the file name. When you submit your project, this file will be included The format of each record in the file is [ZIP Code] [population]". For example, the first line in the file is: 90001 57110 You do not need to create any arrays for this assignment. Don't forget to import what you need Don't forget to close the output file Make sure your program actually counts the lines of the input file. Do not just writea print statement that includes the literal value 318 from above. The graders will check this

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

Advanced MySQL 8 Discover The Full Potential Of MySQL And Ensure High Performance Of Your Database

Authors: Eric Vanier ,Birju Shah ,Tejaswi Malepati

1st Edition

1788834445, 978-1788834445

More Books

Students also viewed these Databases questions