Question: Try to use switch statement thanks ENGR 40 PROGRAMMING ASSIGNMENT FILE READING: ORDER NUMBER DATA This program will search a data file to find the

Try to use switch statement
thanks  Try to use switch statement thanks ENGR 40 PROGRAMMING ASSIGNMENT FILE

ENGR 40 PROGRAMMING ASSIGNMENT FILE READING: ORDER NUMBER DATA This program will search a data file to find the dollar amount associated with a userinputted order number. The program will have to be able to work with three different types of data files: (1) A sentinel type data file - the data file will consist of rows of order numbers and their associated dollar amounts, the last of which will be -9999 for the order number and -9999 for the order amount (indicating the end of data). (2) A prenum type data file - the data file will start with an integer which equals the number of order data records to follow. Following this initial integer will be that same number of rows of order numbers and corresponding amounts. (3) An EOF data file - The data file will consist of rows of order numbers and their associated dollar amounts. Your program must determine when to stop reading in data from the file using the .peek ( input stream function. (Examples of each type of data file are at the end of the assignment.) You will need to pre-build the two data files, one of each type. Your program should do the following: 1. Ask the user to choose a data file type to be searched (sentinel, prenum, or EOF) 2. Based on the user's choice in the above step, open the appropriate data file. 3. Ask the user to input an order number. 4. Search the open data file for the user's inputted order number. 5. If the order number is found in the data file, output to the screen the order number and the corresponding dollar amount. 6. If the order number is not found in the data file, output to the screen an appropriate message about the user's order number not being found in the data file. Submit just your source code. For this assignment you do not need to include output from your own sample runs (though you should have thoroughly tested your program). I will test it with data files of each type that 1 build. You may also show me your working code on each data file type in lab. ENGR 40 PROGRAMMING ASSIGNMENT FILE READING: ORDER NUMBER DATA This program will search a data file to find the dollar amount associated with a userinputted order number. The program will have to be able to work with three different types of data files: (1) A sentinel type data file - the data file will consist of rows of order numbers and their associated dollar amounts, the last of which will be -9999 for the order number and -9999 for the order amount (indicating the end of data). (2) A prenum type data file - the data file will start with an integer which equals the number of order data records to follow. Following this initial integer will be that same number of rows of order numbers and corresponding amounts. (3) An EOF data file - The data file will consist of rows of order numbers and their associated dollar amounts. Your program must determine when to stop reading in data from the file using the .peek ( input stream function. (Examples of each type of data file are at the end of the assignment.) You will need to pre-build the two data files, one of each type. Your program should do the following: 1. Ask the user to choose a data file type to be searched (sentinel, prenum, or EOF) 2. Based on the user's choice in the above step, open the appropriate data file. 3. Ask the user to input an order number. 4. Search the open data file for the user's inputted order number. 5. If the order number is found in the data file, output to the screen the order number and the corresponding dollar amount. 6. If the order number is not found in the data file, output to the screen an appropriate message about the user's order number not being found in the data file. Submit just your source code. For this assignment you do not need to include output from your own sample runs (though you should have thoroughly tested your program). I will test it with data files of each type that 1 build. You may also show me your working code on each data file type in lab

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!