Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program in C++ using the given instructions which will read each line using getline and then, using string member functions , will output
Write a program in C++ using the given instructions which will read each line using getline and then, using string member functions, will output to a revised file the same information in standard format. Thank you!
Instructions:
Input File "oldretirement.txt" :
Matthew Alan Aberegg 1963 452,627 Adams, William Logan 1984 50,767 Siyabi, Mohamed 1951 $ 790,183 Sulaiman, Yasser 1968 696,311 Barnett, Alan Christopher 1946 83,736 Catherine P Baugher 1955 552,067 Aaron Michael Bellenoit 1954 129,188 Belville, Emily J 1947 766,403 Eric Arthur Bitikofer 1974 545,803 Bowers, Tyler Jay 1952 558,945 Thomas E Boyle 1957 671,259 Brinson, Nathan Fitzgerald 1953 707,990 Matthew D Brooks 1956 17,825 Bradley R Burris 1959 233 Buskirk, Jacob Walter 1947 201 Byus, John T 1968 $ 130,644 Kathy Chatfield 1945 489,521 Chen, Zhaojie 1973 283,815 Ryan Michael Childs 1963 452,448 Brian S Clark 1948 449,210 Anthony Edward Cogliano 1973 567,997 Tyler M Cosculluela 1947 727,905 Aaron David Cruz 1985 $ 853,965 Ryan M Cusick 1976 86,475 Vitalik R Dakhnovets 1949 577,697 Ethan Ryan Dale 1954 424,549 Alex L Day 1970 414,157 Nathan Michael Degeronimo 1946 527,711 Dylan A Denner 1956 878 Dinger, Michael Don 1954 518,752 Corbin T Dotson 1980 45,528 Eaddie, Nathaneil Matthew 1978 177,575 David, Emerson 1961 $ 489 Trey Richard Eustache 1962 546,496 Evans, Ryan Mathew 1983 $ 499 Farinaro, Tyler 1983 758,542 Corey Farnsworth 1955 825,894 Ferrell, Brock Richard 1947 365 Tyler J Fitchett 1945 88 Fitzpatrick, William Michael 1962 407,411 Roger Charles Florence 1981 475,191 Gaugler, Jarod M 1984 $ 841,892 Thomas Micheal Gaus 1946 691,195 Michael Steven Geng 1976 503,970 Kevin Michael Gentile 1959 $ 88,529 Aaron R. Gill 1981 164,681 Casey Godenswager Kevin 1984 630,322 Mark Goodhue Nathaniel 1975 591,129 Michael, Hovey Gundling 1971 643,833 Robert Hall Marissa 1949 392 Elisa Dean 1975 712,795 Hickman, Carter J 1977 $ 390,134 Cira A Hill 1978 $ 436,332 John Otto Holbrook 1980 389,807 Jacob A Holle 1978 841,022 Huang, Yingjie Philip 1980 497,432 J, Iler 1985 678,701 Griffin Jones 1982 630,420 Benjamin Robert Kaufman 1973 563,929 Kelly, Eric Scott 1973 84,634 Adam Robert Killmeyer 1982 $ 365,910 Graham Joseph Koch 1947 679,050 Kuntz, Bryan Christopher 1955 681 Joel T Levis 1961 432,650 Bohong Li 1971 579,624 Li, Mingda 1950 740,285 Nicholas Lehnerd Lobosco 1960 763,784 Lu, Frank Yao 1946 503,853 Malone, Jacob C 1978 153,235 Kristen S Masada 1964 $ 288 Patrick J McCann 1957 488 McClay, Jacob Keller 1948 $ 806,951 Gavin Isaac McGee 1978 865 Joe Meyer 1977 $ 650,337 Jackson P Morris 1961 468,479 Mosley, Justin A 1959 $ 227 Keon Patrick Mullins 1951 $ 54,236 Keon Patrick Mullins 1974 $ 609,142 Myers, Caleb Layne 1976 242,481 Brandon August Niese 1955 601,639 Favour A Ogundare 1949 $ 157,633 Kevin R Ordonez 1955 158,056 Andrew R Orsburn 1978 230,579 Padula, Marco J 1970 703,902 Palmer, Lukas N 1945 345,870 Parks, Jason Tyler 1970 $ 642,484 Peters, Brian Casey 1970 335 Plummer, Hayden Mark 1952 314,571 Podolski, Jeffrey Michael 1968 94,317 Hannah Leslie Podratz 1951 $ 660,106 Preston, Christopher Paul 1945 648,292 Luke Thomas Putz 1971 653,044 Raichur, Abhilash Aaron 1961 346 Ray, Robeson 1983 366,868 Roldan, Nathan E 1958 18,754 Schrantz, Claire Elizabeth 1983 281,338 Schrock, Zachary Adam 1974 898,677 Schumacher, Joseph M 1958 774,163 Keith Ronald Sebald 1970 $ 286,846 Sefton, Seaghan Galen 1954 267,879 Garin Michael Self 1971 302,516 Severance, Nathan Lewis 1985 465,926 Dudley Cory Shepherd 1973 586,455 Michael Lee Simpson 1947 $ 413,030 Dashaun Laquail Slaughter 1982 829,805 Sleeth, Emily N 1961 373,354 Brennen M Smallwood 1947 104,159 Snyder, Selena T 1945 84,167 David Thomas Spalding 1960 165,711 Will John Sweeney 1974 14,541 Ryan A Tamasovich 1963 3,270 Caitlin Marie Taylor 1967 $ 287,559 Telep, Jonathan T 1958 398,870 Thompson, Zachary Allen 1983 523,890 David Michael Thompson 1982 383,524 Thompson, Ryan William 1956 323,311 Thompson, Trent N 1982 49,683 Thompson, Zachary Alan 1947 324 Matthew K Underation 1965 652,544 James Michael Vangelos 1979 $ 773,641 Andrew Raymond Videmsek 1966 159,041 Wamsley, Joe Burr 1979 736,006 Dean Michael Warchak 1955 764 Aaron Nathaniel Ward 1969 117,834 John Thomas Weaver 1975 29,417 Kaylee M Weaver 1950 610,669 Ke Wen 1959 510,760 Gareth Alexander Whaley 1975 190,549 Mollie Ann Whitacre 1959 548,521 Logan A Wilkovich 1953 430,489 Winfield, Payge Nicole 1973 761,189 Wright, Joshua K 1961 536,988 Shipeng Yang 1982 654,368 Xudong Yuan 1975 30,895 Yuanhang Zhang 1980 $ 63,323Unlimited Software Limited O has just hired you to straighten out their retirement accounts which are a mess because various people have been entering the data in different formats for a number of years Some of the lines in the data file look like this Smith, Mary Johnson 1953 329, 475 While others look like this Mary Johnson Smith 1953 329, 475 The first formatis the one that they would like all of the names in the file to look like. So you decide to write a program which will read each line using getline and then, using string member functions, will output to a revised file the same information in standard format Also, at the end of certain lines the wordReady will be printed. This is being done to see which employees are "ready" for a retirement review, and might be considered as candidates to be pushed into early retirement. A person is deemed ready if they are a) 60 years old or older AND b) Their contributions to the retirement program have equaled or exceeded $300,000. You will need to find the comma, and then using the at(i) or [i], determine if the character before is a digit or a letter. If it is a letter then the name is alreadyin the correct format, else you will need to pull the name out as a series of substrings so you can rearrange it as needed If there is a comma in the middle of the dollar amount number, note that you are going to take the number in as two substrings, convert them to numbers using atoi(numsting.c str0), and then mathematically combine them into a single number for processing By the way, Mary Johnson Smith is ready for her retirement review. S the line for her will look like: Smith, Mary Johnson 1953 329, 475 Ready At the bottom of the output file you are to report how many employees are ready for retirement and the total amount of employee contributions to the retirement fund. The name of the datafile is old retirement. txt. The file that you create will be new retirment .txt Unlimited Software Limited O has just hired you to straighten out their retirement accounts which are a mess because various people have been entering the data in different formats for a number of years Some of the lines in the data file look like this Smith, Mary Johnson 1953 329, 475 While others look like this Mary Johnson Smith 1953 329, 475 The first formatis the one that they would like all of the names in the file to look like. So you decide to write a program which will read each line using getline and then, using string member functions, will output to a revised file the same information in standard format Also, at the end of certain lines the wordReady will be printed. This is being done to see which employees are "ready" for a retirement review, and might be considered as candidates to be pushed into early retirement. A person is deemed ready if they are a) 60 years old or older AND b) Their contributions to the retirement program have equaled or exceeded $300,000. You will need to find the comma, and then using the at(i) or [i], determine if the character before is a digit or a letter. If it is a letter then the name is alreadyin the correct format, else you will need to pull the name out as a series of substrings so you can rearrange it as needed If there is a comma in the middle of the dollar amount number, note that you are going to take the number in as two substrings, convert them to numbers using atoi(numsting.c str0), and then mathematically combine them into a single number for processing By the way, Mary Johnson Smith is ready for her retirement review. S the line for her will look like: Smith, Mary Johnson 1953 329, 475 Ready At the bottom of the output file you are to report how many employees are ready for retirement and the total amount of employee contributions to the retirement fund. The name of the datafile is old retirement. txt. The file that you create will be new retirment .txt
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started