Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use C++ SIMPLE language, main function with arrays, function, if, and loop statements You will write a program for our local power company (LIPA). A

Use C++ SIMPLE language, main function with arrays, function, if, and loop statements

You will write a program for our local power company (LIPA). A storm has devastated our community. Attached is a real data file collected in the aftermath of the storm. The data file contains information on the outage status of each city in Long Island. You job is to write a program that reads this data file and allows users to query and create reports.

Here are the features of your program: 1- Query City: Given a city name, provide the corresponding information -- number of customers without power and total number of customers in that city. 2- City With Most Outage: Return the city with the most percentage of customers without power. That is the customers without power divided by total number of customers. 0- Exit Make sure that you create a class called City. This class will have three fields: Name, NumOfOutages, TotalCust. You will read the whole data file at the very beginning of the program into an array of type City. You may name this array Data. Based on this Data array, you will write two functions QueryCity() and CityWithMostOutage(). These functions will be called from the main() function based on user's choice.

Below is the data that you could check your output:

ATLANTICBEACH 2412 2022 BALDWIN 1509 8740 BALDWINHARBOR 60 2817 BELLEROSE 99 1266 BELLMORE 504 6342 CEDARHURST 493 3175 EASTMEADOW 2826 13026 EASTROCKAWAY 447 4494 ELMONT 1582 9639 FRANKLINSQUARE 2318 10502 GARDENCITY 1836 8448 GARDENCITYSOUTH 273 1611 HEMPSTEAD 1065 17041 HEWLETT 132 3016 HEWLETTBAYPARK 0 444 HEWLETTHARBOR 17 577 HEWLETTNECK 20 168 INWOOD 152 3485 ISLANDPARK 451 3572 LAKEVIEW 259 1503 LAWRENCE 309 2557 LEVITTOWN 4338 17370 LIDOBEACH 1 3037 LONGBEACH 0 15283 LYNBROOK 78 8780 MALVERNE 613 3748 MERRICK 1034 8168 NORTHBELLMORE 922 6918 NORTHMERRICK 497 4170 NORTHVALLEYSTREAM 561 5034 NORTHWANTAGH 607 4210 OCEANSIDE 1097 12672 ROCKVILLECENTRE 0 0 ROOSEVELT 578 4457 SALISBURY 1118 4305 SEAFORD 575 5521 SOUTHFLORALPARK 26 430 SOUTHHEMPSTEAD 68 1087 SOUTHVALLEYSTREAM 124 2484 STEWARTMANOR 181 795 UNIONDALE 1305 6602 VALLEYSTREAM 878 13461 WANTAGH 1178 6670 WESTHEMPSTEAD 988 6774 WOODMERE 492 5677 WOODSBURGH 20 302 ALBERTSON 316 2118 BAXTERESTATES 35 553 CARLEPLACE 328 2371 EASTHILLS 1176 2527 EASTWILLISTON 141 1035 FLORALPARK 909 6375 FLOWERHILL 585 1199 GARDENCITYPARK 99 2749 GREATNECK 611 3961 GREATNECKESTATES 433 1346 GREATNECKPLAZA 59 3396 HERRICKS 196 1921 KENSINGTON 129 944 KINGSPOINT 352 1555 LAKESUCCESS 264 937 MANHASSET 833 3246 MANHASSETHILLS 154 738 MANORHAVEN 131 2698 MINEOLA 508 8935 MUNSEYPARK 397 908 NEWCASSEL 376 3652 NEWHYDEPARK 499 3751 NORTHHILLS 399 2889 NORTHNEWHYDEPARK 857 5440 OLDWESTBURY 289 1333 PLANDOME 223 612 PLANDOMEHEIGHTS 40 408 PLANDOMEMANOR 1 114 PORTWASHINGTON 1293 6700 PORTWASHINGTONNORTH 359 1511 ROSLYN 227 1367 ROSLYNESTATES 301 456 ROSLYNHARBOR 579 725 ROSLYNHEIGHTS 1105 2181 RUSSELLGARDENS 81 1012 SADDLEROCK 275 861 SANDSPOINT 907 1564 SEARINGTOWN 266 1632 THOMASTON 495 1423 UNIVERSITYGARDENS 450 2059 WESTBURY 1667 6861 WILLISTONPARK 110 2925 BAYVILLE 4 2941 BETHPAGE 1007 5917 BROOKVILLE 196 852 CENTREISLAND 0 257 COVENECK 14 235 EASTMASSAPEQUA 488 7097 EASTNORWICH 72 1216 FARMINGDALE 135 3013 GLENCOVE 1013 11361 GLENHEAD 435 2013 GLENWOODLANDING 353 1387 HICKSVILLE 2881 15280 JERICHO 1965 5202 LATTINGTOWN 190 1697 LAURELHOLLOW 306 591 LOCUSTVALLEY 0 212 MASSAPEQUA 2527 7936 MASSAPEQUAPARK 335 5969 MATINECOCK 229 420 MILLNECK 107 862 MUTTONTOWN 116 1359 NORTHMASSAPEQUA 791 6583 OLDBETHPAGE 730 2759 OLDBROOKVILLE 371 1068 OYSTERBAY 76 2736 OYSTERBAYCOVE 26 718 PLAINEDGE 996 3452 PLAINVIEW 4700 9848 SEACLIFF 75 2302 SOUTHFARMINGDALE 348 4957 SYOSSET 1610 7135 UPPERBROOKVILLE 159 1236 WOODBURY 685 3814 ROCKAWAYBEACH/FARROCKAWAY 31382 33671 AMITYVILLE 489 3758 BABYLON 248 4186 COPIAGUE 406 9063 DEERPARK 828 11300 EASTFARMINGDALE 603 4774 JONES/GILGO/OAK/CAPTREEBEACH 294 461 LINDENHURST 468 9693 NORTHAMITYVILLE 200 5832 NORTHBABYLON 218 8063 NORTHLINDENHURST 208 4393 WESTBABYLON 1435 15832 WYANDANCH 243 4884 BELLETERRE 11 295 BELLPORT 23 1334 BLUEPOINT 27 2192 BROOKHAVEN 11 1343 CENTERMORICHES 110 4802 CENTEREACH 599 9411 CORAM 318 15799 EASTMORICHES 14 3301 EASTPATCHOGUE 70 9087 EASTSHOREHAM 48 2285 FARMINGVILLE 373 5410 FIREISLAND 4674 4629 HOLTSVILLE 287 6706 LAKEGROVE 1050 4336 LAKERONKONKOMA 637 7619 MANORVILLE 30 5968 MASTIC 36 5541 MASTICBEACH 552 4917 MEDFORD 258 9039 MIDDLEISLAND 176 6171 MILLERPLACE 78 4412 MOUNTSINAI 27 4729 NORTHBELLPORT 93 4081 NORTHPATCHOGUE 10 3104 OLDFIELD 17 407 PATCHOGUE 29 6134 POQUOTT 1 414 PORTJEFFERSON 102 4065 PORTJEFFERSONSTATION 53 3426 RIDGE 64 6378 ROCKYPOINT 153 4810 SELDEN 345 7248 SETAUKET-EASTSETAUKET 269 6277 SHIRLEY 46 9126 SHOREHAM 2 254 SOUNDBEACH 60 3763 STONYBROOK 1349 5518 TERRYVILLE 388 4239 YAPHANK 84 2349 AMAGANSETT 24 2850 EASTHAMPTON 109 5468 MONTAUK 27 5875 NORTHWESTHARBOR 11 3521 SPRINGS 113 4613 WAINSCOTT 9 1307 ASHAROKEN 56 255 CENTERPORT 11 2344 COLDSPRINGHARBOR 264 2078 COMMACK 1715 13174 DIXHILLS 857 8885 EASTNORTHPORT 1069 7122 EATONSNECK 12 596 ELWOOD 636 4023 GREENLAWN 1020 5085 HALESITE 87 1102 HUNTINGTON 711 8350 HUNTINGTONBAY 105 994 HUNTINGTONSTATION 1008 11098 LLOYDHARBOR 90 1430 MELVILLE 358 8070 NORTHPORT 270 3790 SOUTHHUNTINGTON 969 3939 WESTHILLS 681 2251 BAYSHORE 1229 10254 BAYPORT 24 3191 BAYWOOD 120 2610 BOHEMIA 0 5525 BRENTWOOD 2199 13359 BRIGHTWATERS 53 1325 CENTRALISLIP 607 9906 EASTISLIP 91 5903 HOLBROOK 116 9947 ISLANDIA 226 1719 ISLIP 50 7404 ISLIPTERRACE 63 2047 NORTHBAYSHORE 192 3891 NORTHGREATRIVER 14 1235 OAKDALE 46 3581 RONKONKOMA 632 8291 SAYVILLE 191 7445 WESTBAYSHORE 161 2077 WESTISLIP 478 9463 WESTSAYVILLE 14 2047 AQUEBOGUE 9 1329 CALVERTON 37 5175 JAMESPORT 13 1358 NORTHVILLE 2 941 RIVERHEAD 33 6849 WADINGRIVER 159 3540 DERINGHARBOR 0 43 SHELTERISLAND 4 1316 SHELTERISLANDHEIGHTS 181 1736 FORTSALONGA 451 3819 HAUPPAUGE 1026 8914 HEADOFTHEHARBOR 140 603 KINGSPARK 222 6130 NESCONSET 591 5180 NISSEQUOGUE 170 684 SMITHTOWN 841 9989 ST.JAMES 599 5499 VILLAGEOFTHEBRANCH 1 810 BRIDGEHAMPTON 7 2515 EASTQUOGUE 7 3836 FLANDERS 7 1765 HAMPTONBAYS 23 7096 NORTHHAVEN 36 767 NORTHSEA 13 2955 NOYACK 10 2590 PINEVALLEY 4 418 QUOGUE 26 2396 REMSENBURG-SPEONK 76 2121 RIVERSIDE 1 879 SAGHARBOR 0 2473 SAGAPONACK 23 769 SHINNECOCKHILLS 155 3167 SOUTHAMPTON 49 5344 WATERMILL 16 3198 WESTHAMPTON 7 2273 WESTHAMPTONBEACH 139 3393 CUTCHOGUE 44 2465 GREENPORT 0 0 GREENPORTWEST 17 1200 LAUREL 5 910 MATTITUCK 54 2906 ORIENTPOINT 41 1783 PECONIC 17 850 SOUTHOLD 47 4567

image text in transcribed

data.txt - Notepad City #ofoutages File Edit Fo View Hel ATLANTICBEACH 2412 2022 BALDWIN 1509 8740 BALDWINHARBOR 60 2817 BELLEROSE 99 1266 BELLMORE 504 6342 CEDARHURST 493 31 EASTMEADOW 2826 13 EASTROCKAWAY 447 4494 ELMONT 1582 9639 FRANKLINSQUARE 2318 10502 GARDENCITY 1836 8448 GARDENCITYSOUTH 273 1611 HEMPSTEAD 1065 17041 HEWLETT 132 3016 HEWLETTBAYPARK 0 444 HEWLETTHARBOR 1/ 577

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

Flash XML Applications Use AS2 And AS3 To Create Photo Galleries Menus And Databases

Authors: Joachim Schnier

1st Edition

0240809173, 978-0240809175

More Books

Students also viewed these Databases questions