Question
(Create a flow chart or Hierarchy chart) Review the following specifications and design and document the procedures/functions/algorithms you will use to create the following program.
(Create a flow chart or Hierarchy chart)
Review the following specifications and design and document the procedures/functions/algorithms you will use to create the following program. You may use Hierarchy Charts, Flow charts or any other modern programming tool to design the solution to this problem. Tools like Visio are an excellent choice for documenting your design choices.
Current data file being processed.
(1) Select / create data file (.txt file extension will be added automatically)
(2) Display all the numbers in the data file, along with their total and average
(3) Display all the numbers in the data file sorted from smallest to largest
(4) Search for a number in the data file and display how many times the number occurs in the file
(5) Display the largest number in the data file
(6) Append one or more random numbers to the data file
(6) Append one or more random numbers to the data file
(7) Exit the program
Prompt the user to make a selection from the menu and use input validation to ensure the user makes a valid selection (1 - 7).
Use if/elif statements to process each of the above options. Each option should call a function which carries out the required action.
When asking the user which data file they wish to process, ask the user to only enter the part of the filename preceding the .txt extension and automatically add the .txt extension for the user. Create an empty data file if the file does not already exist.
Options (2) - (6) should test whether a data file has been specified before calling the function. If a data file has not yet been specified, the option should not call the function and the display should be refreshed.
When a data file is first created it will be empty. The functions which process the data file will need to handle the special case when the file exists, but does not contain any numbers. To make the program easier to write, you may opt to ignore this special case and assume that the user will immediately add numbers to the file once it has been created.
When adding a number(s), append it to the end of the data file.
A good approach to working on this project is to write the code for the easiest menu options first.
**** Global variables are NOT allowed. ****
Show transcribed image text
CAWINDOWS py.exe urrent Data File (1) Select / create data file c.txt file extension will be added automatically) (2) Display all numbers,total and average 3) Display all numbers sorted (4) Search for a number and display how many times it occurs (5) Display the largest number (6) Append a random number(s) 7) Exit the program enu choice: 8 Press any key to continue: Menu choice: e Press any key to continue: Menu choice: 1 ame of data file: MyFile File not found, creating file Press any key to continue: ?CAWINDOWS\py.exe MENU urrent Data File: MyFile (1) Select/create data file ( txt file extension will be added automatically) (2) Display all numbers, total and average (3) Display all numbers sorted (4) Search for a number and display how many times it occurs (5) Display the largest number (6) Append a random number(s) (7) Exit the program enu choice: 2 ata file is empty ile Successfully Read Press any key to continue: CAWINDOWS py.exe urrent Data File (1) Select / create data file c.txt file extension will be added automatically) (2) Display all numbers,total and average 3) Display all numbers sorted (4) Search for a number and display how many times it occurs (5) Display the largest number (6) Append a random number(s) 7) Exit the program enu choice: 8 Press any key to continue: Menu choice: e Press any key to continue: Menu choice: 1 ame of data file: MyFile File not found, creating file Press any key to continue: ?CAWINDOWS\py.exe MENU urrent Data File: MyFile (1) Select/create data file ( txt file extension will be added automatically) (2) Display all numbers, total and average (3) Display all numbers sorted (4) Search for a number and display how many times it occurs (5) Display the largest number (6) Append a random number(s) (7) Exit the program enu choice: 2 ata file is empty ile Successfully Read Press any key to continue
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started