A file containing information about fruits is structured as follows. Apple Green Yellow Banana The file consists of tags and data. An opening and closing tag pair, ... , define a particular data element. Each fruit has a type and a color. Notice that either may appear first within the ... tags.Your program should read a file called “fruit.txt” with the above structure. The output of your program should be the number of each type of fruit, and the total pieces of fruit. For example, the output using the lines above is:
Number of type Apple: 1
Number of type Banana: 1
Total pieces of fruit: 2
Your program should be flexible enough to handle a file containing an indeterminate number of fruit descriptions. However, you may assume that there will be no more than 100 different types of fruit.
1
Expert's answer
2012-11-14T08:14:31-0500
Unfortunately, your question requires a lot of work and cannot be done for free. Submit it with all requirements as an assignment to our control panel and we'll assist you.
Comments
Leave a comment