Create one more version of the majors scripts. The new addition to this version will be a new option. We will also add extra error checking.
When the user uses the "-doubles" option, print just the names of the students who graduated with double options. You figured out how to do that in the previous assignment. Note, this means you need to use the lastest data file to test this new script.
As usual, no datafile should cause an error. Unknown options should also cause an error. No options, or the default, should print just the counts. The one option of -names should print the names with the counts. The new option of -doubles should print the names of the double majors. Providing more than one option should be an error.
Here is some sample runs:
> majors
Error: Usage: majors [option] file
> majors -hello lab19.txt
Error: unknown option
> majors -doubles -names lab19.txt
Error: only one option allowed
> majors2 lab19.txt
CSCI 2
CIFS 1
ACCT 23
ENTR 5
MGMT 20
MKTG 22
> majors -doubles lab19.txt
Anderson, Ian
Carpenter, Timothy
Killebrew, Douglas Dennis
Nelson, Laura Anne
> majors -names lab19.txt
******************************
CSCI 2
Dickson, Anthony James
Downs, Christopher Paul
******************************
CIFS 1
Anderson, Ian
******************************
ACCT 23
Alexander, Amy Elizabeth
Ayers, Brittany Nicole
Brown, Lyeshea Semondre S
Calloway, Logan Mackenzie
Childers, Jamie Leigh
Flick, Heather Wrenee
Foster, Rodney Tyrone
Gallman, Antonio James
Jackson, Miesha Dekezia
Killebrew, Douglas Dennis
Massey, Barbara LaTasha
Nguyen, Julie Yen
Patel, Hardik Rajendrakum
Patterson, Natalie Michel
Raley-Ramos, Chelsea
Robinson, Megan Elizabeth
yadda
yadda
yadda
|