Your goal is to implement an application that reads a file, modify its content, and writes the modification back to the same file. The file includes 2 lines of integers. The first line indicates which integer on the second line has been selected (active). And the second line lists all the integers in the list (maximum of 10). Your application should have a menu that is constantly displayed on the screen (see the menu below). Right below the menu, the program should display list of all integers in the file (second line). Also, it should show which integer is currently selected (active) by displaying an arrow to its left. The user should be able to select a menu item by entering its associated key and pressing the Enter key on the keyboard. “Select Down” selects the next item in the list. If the item at the end of the list is selected, this option selects the first item in the list. “Select Up” selects the previous item in the list. If the first item is selected, this option selects the item at the end of the list. “Move Down” moves the selected item one position down. If the item at the end of the list is selected, moving down will not be possible. “Move Up” moves the selected item one position up. If the first item is selected, moving up will not be possible. “Insert” will insert an integer before the selected item and makes the newly inserted item active. The integer is typed by the user. If the list is full, insertion will not be possible. Do not accept incorrect values (like non-integer or characters). “Delete” deletes the active item. After deleting, the next item in the list becomes active. If the item at the end of the list is deleted, its previous item becomes active. If there is one item or no item in the list, selecting the delete option will display an arrow without any integer to its right. “Sort” sorts the list in ascending order. The active item after the sort is same as the active item before the sort. “Exit” ends the application. Make sure to use the top-down design to break your program to many simpler tasks (at least one function per task). Also create helper functions (example: function to check if the list is full or function to check if the list is empty). The functions should do one specific task only. Do not use global variables. Use one single dimension array only. Make sure to check the special cases. Example: when the list is full, when the list is empty or when the last item in the list is selected. When you start the program, the program should copy the content of the file into a variable and an array before closing the file. When the exit option is selected, the program should open the same file for output, writes back the content of the variable and the array into the file, and it closes the file before exiting the program. When you are using the program, you should modify the array and not the file. Make sure to test your program completely before submission. Do not forget to add comments. Submit your well-documented C++ program via Canvas. Menu: Select Down Select Up Move Down Move up Insert Delete Sort Exit

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

Your goal is to implement an application that reads a file, modify its content, and writes the modification back to the same file. The file includes 2 lines of integers. The first line indicates which integer on the second line has been selected (active). And the second line lists all the integers in the list (maximum of 10).


Your application should have a menu that is constantly displayed on the screen (see the menu below). Right below the menu, the program should display list of all integers in the file (second line). Also, it should show which integer is currently selected (active) by displaying an arrow to its left.


The user should be able to select a menu item by entering its associated key and pressing the Enter key on the keyboard.


“Select Down” selects the next item in the list. If the item at the end of the list is selected, this option selects the first item in the list. “Select Up” selects the previous item in the list. If the first item is selected, this option selects the item at the end of the list.


“Move Down” moves the selected item one position down. If the item at the end of the list is selected, moving down will not be possible. “Move Up” moves the selected item one position up. If the first item is selected, moving up will not be possible.


“Insert” will insert an integer before the selected item and makes the newly inserted item active. The integer is typed by the user. If the list is full, insertion will not be possible. Do not accept incorrect values (like non-integer or characters).


“Delete” deletes the active item. After deleting, the next item in the list becomes active. If the item at the end of the list is deleted, its previous item becomes active. If there is one item or no item in the list, selecting the delete option will display an arrow without any integer to its right.


“Sort” sorts the list in ascending order. The active item after the sort is same as the active item before the sort.


“Exit” ends the application.

Make sure to use the top-down design to break your program to many simpler tasks (at least one function per task). Also create helper functions (example: function to check if the list is full or function to check if the list is empty). The functions should do one specific task only. Do not use global variables. Use one single dimension array only. Make sure to check the special cases. Example: when the list is full, when the list is empty or when the last item in the list is selected.


When you start the program, the program should copy the content of the file into a variable and an array before closing the file. When the exit option is selected, the program should open the same file for output, writes back the content of the variable and the array into the file, and it closes the file before exiting the program. When you are using the program, you should modify the array and not the file.
Make sure to test your program completely before submission. Do not forget to add comments.


Submit your well-documented C++ program via Canvas.

Menu:

  • Select Down
  • Select Up
  • Move Down
  • Move up
  • Insert
  • Delete
  • Sort
  • Exit
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 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