Given a text file containing the availability of food items, write a program that reads the information from the text file and outputs the available food items. The program first reads the name of the text file from the user. The program then reads the text file, stores the information into four separate lists, and outputs the available food items in the following format: name (category) - description Assume the text file contains the category, name, description, and availability of at least one food item, separated by a tab character ("\t). Ex: If the input of the program is: food.txt and the contents of food.txt are: Sandwiches Ham sandwich Classic ham sandwich Available Sandwiches Chicken salad sandwich Chicken salad sandwich Not available Sandwiches Cheeseburger Classic cheeseburger Not available Salads Caesar salad Chunks of romaine heart lettuce dressed with lemon juice Available. Salads Asian salad Mixed greens with ginger dressing, sprinkled with sesame Not available Beverages Water 16oz bottled water Available Coca-Cola 16oz Coca-Cola Not available. Beverages Mexican food Chicken tacos Grilled chicken breast in freshly made tortillas Not available Mexican food Beef tacos Ground beef in freshly made tortillas Available. Vegetarian Avocado sandwich Sliced avocado with fruity spread Not available the output of the program is: Ham sandwich (Sandwiches) Classic ham sandwich Caesar salad (Salads) -- Chunks of romaine heart lettuce dressed with lemon juice Water (Beverages) 16oz bottled water Beef tacos (Mexican food) - Ground beef in freshly made tortillas --

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Given a text file containing the availability of food items, write a program that reads the information from the text file and outputs the
available food items. The program first reads the name of the text file from the user. The program then reads the text file, stores the
information into four separate lists, and outputs the available food items in the following format: name (category) - description
Assume the text file contains the category, name, description, and availability of at least one food item, separated by a tab character (\t).
Ex: If the input of the program is:
food.txt
and the contents of food.txt are:
Sandwiches
Ham sandwich
Classic ham sandwich Available
Sandwiches Chicken salad sandwich Chicken salad sandwich Not available
Sandwiches Cheeseburger Classic cheeseburger Not available
Salads
Caesar salad Chunks of romaine heart lettuce dressed with lemon juice Available
Salads: Asian salad Mixed greens with ginger dressing, sprinkled with sesame Not available
Beverages Water 1602 bottled water. Available
Beverages Coca-Cola 16oz Coca-Cola Not available
Mexican food. Chicken tacos Grilled chicken breast in freshly made tortillas Not available
Mexican food. Beef tacos Ground beef in freshly made tortillas. Available
Vegetarian Avocado sandwich. Sliced avocado with fruity spread Not available.
the output of the program is:
Ham sandwich (Sandwiches) -- Classic ham sandwich
Caesar salad (Salads) -- Chunks of romaine heart lettuce dressed with lemon juice
Water (Beverages) 16oz bottled water
Beef tacos (Mexican food) Ground beef in freshly made tortillas
Transcribed Image Text:Given a text file containing the availability of food items, write a program that reads the information from the text file and outputs the available food items. The program first reads the name of the text file from the user. The program then reads the text file, stores the information into four separate lists, and outputs the available food items in the following format: name (category) - description Assume the text file contains the category, name, description, and availability of at least one food item, separated by a tab character (\t). Ex: If the input of the program is: food.txt and the contents of food.txt are: Sandwiches Ham sandwich Classic ham sandwich Available Sandwiches Chicken salad sandwich Chicken salad sandwich Not available Sandwiches Cheeseburger Classic cheeseburger Not available Salads Caesar salad Chunks of romaine heart lettuce dressed with lemon juice Available Salads: Asian salad Mixed greens with ginger dressing, sprinkled with sesame Not available Beverages Water 1602 bottled water. Available Beverages Coca-Cola 16oz Coca-Cola Not available Mexican food. Chicken tacos Grilled chicken breast in freshly made tortillas Not available Mexican food. Beef tacos Ground beef in freshly made tortillas. Available Vegetarian Avocado sandwich. Sliced avocado with fruity spread Not available. the output of the program is: Ham sandwich (Sandwiches) -- Classic ham sandwich Caesar salad (Salads) -- Chunks of romaine heart lettuce dressed with lemon juice Water (Beverages) 16oz bottled water Beef tacos (Mexican food) Ground beef in freshly made tortillas
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY