- #1
s133kgtvr4
- 4
- 0
I have this program that needs to be written, but I don't know where to start. Can someone please help me with it.Thanks
*1 Problem Statement
Mrs. Deli is running the delicatessen store “Deli Deli”. Last year Mrs. Deli has decided to expand her business andbuild up an on-line store. She has hired a programmer who has implemented the on-line store.
Recently some of her new on-line customers complained about the electronic bills. The programmer had forgotten touse the plural form when reporting that an item is purchased multiple times. Unfortunately the programmer of Mrs.Deli is on holiday and now it is your task to implement this feature for Mrs. Deli. Here is a description how to make
the plural form:
1. If the word is in the list of irregular words replace it with the given plural.
2. Else if the word ends in a consonant followed by "y", replace "y" with "ies".
3. Else if the word ends in "o", "s", "ch", "sh" or "x", append "es" to the word.
4. Else append "s" to the word.
2 Inputs
Your program should accept a single file name as a command line parameter. This parameter will be the name of a filecontaining the all of the input data items, as described below. The file name may be as long as 256 characters.
Your program should not prompt the user for any input information.
The first line of the input file consists of two integers L and N (0 is less than or equal to L is less than or equal to 100, 1 is less than or equal to N is less than or equal to 1000)
The next L lines contain the description of the irregular words and their plural form. Each line consists of two wordsseparated by a space character, where the first word is the singular, the second word the plural form of some irregularword.
After the list of irregular words, the remaining N lines contain one word each, which you have to make plural. Youmay assume that each word consists of at most 20 lowercase letters from the English alphabet (’a’ to ’z’).
3 Outputs
All output should be written to the the default, standard, output device.
Print N lines of output, where the ith line of output is the plural form of the with input word
5.1.1 Sample Input
The contents of a file named sample_input.txt:
3 7
rice rice
spaghetti spaghetti
octopus octopi
rice
lobster
spaghetti
strawberry
octopus
peach
turkey
5.1.2 Sample Execution
Running the program (complied as the executable named deli) with the above sample data file will yield these
results:
rice
lobsters
spaghetti
strawberries
octopi
peaches
turkeys
*1 Problem Statement
Mrs. Deli is running the delicatessen store “Deli Deli”. Last year Mrs. Deli has decided to expand her business andbuild up an on-line store. She has hired a programmer who has implemented the on-line store.
Recently some of her new on-line customers complained about the electronic bills. The programmer had forgotten touse the plural form when reporting that an item is purchased multiple times. Unfortunately the programmer of Mrs.Deli is on holiday and now it is your task to implement this feature for Mrs. Deli. Here is a description how to make
the plural form:
1. If the word is in the list of irregular words replace it with the given plural.
2. Else if the word ends in a consonant followed by "y", replace "y" with "ies".
3. Else if the word ends in "o", "s", "ch", "sh" or "x", append "es" to the word.
4. Else append "s" to the word.
2 Inputs
Your program should accept a single file name as a command line parameter. This parameter will be the name of a filecontaining the all of the input data items, as described below. The file name may be as long as 256 characters.
Your program should not prompt the user for any input information.
The first line of the input file consists of two integers L and N (0 is less than or equal to L is less than or equal to 100, 1 is less than or equal to N is less than or equal to 1000)
The next L lines contain the description of the irregular words and their plural form. Each line consists of two wordsseparated by a space character, where the first word is the singular, the second word the plural form of some irregularword.
After the list of irregular words, the remaining N lines contain one word each, which you have to make plural. Youmay assume that each word consists of at most 20 lowercase letters from the English alphabet (’a’ to ’z’).
3 Outputs
All output should be written to the the default, standard, output device.
Print N lines of output, where the ith line of output is the plural form of the with input word
5.1.1 Sample Input
The contents of a file named sample_input.txt:
3 7
rice rice
spaghetti spaghetti
octopus octopi
rice
lobster
spaghetti
strawberry
octopus
peach
turkey
5.1.2 Sample Execution
Running the program (complied as the executable named deli) with the above sample data file will yield these
results:
rice
lobsters
spaghetti
strawberries
octopi
peaches
turkeys