Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Writing a program using gedit. It cant contain global variables or arrays. It using input files that are provided and explained in the photo. Spring

Writing a program using gedit. It cant contain global variables or arrays. It using input files that are provided and explained in the photo. image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Spring 2019 CPE211 Project Assignment Project #06 (40 points): Basic C++ math, file Inputoutput, IF statements, while loops Submit Your Solution Using Canvas by 10PM on Tuesday, 02/19/19 (late submissions will be accepted from 10PM to 11:59PM on 2/19/19) Sample Solution for Project 62 Project 6 Run the provided sample solution to see what information needs to be output by the program. You may RUN the sample solution Project 06 solution by typing the following at a command prompt in a terminal window that has a current working directory of -ICPE211 SPR18/Project 06(where represents your home directory) and that the sample input files are present in that directory. (Note, the input file must be in the directory from which the command below is run) Sample Solution path Provided sample input files are zipped in the file P6 in.zip output files(see page 4) Comparison Script Path home/work/cpe211/Executables/Project 06/Project 06 solution in.txt out.txt When running this solution you must provide command line arguments for the input and /homelwork/cpe211data/Project 06/CompareSolution.bash Project 06.cpp For a valid input fle, the information written to the output fle looks like the following: Test scores for section 02: The sum of the scores is The average of the scores is: 78.25 Letter grade equivalent: The variance of the scores is: 52.92 The standard deviation is Statistics 85 76 83 313.00 69 7.27 Project 6 Restrictions Only material from Chapters 1 through 7 and any extra code in this handout is allowed. You cannot use any C++ techniques that are covered in Chapters 8 and higher No global variables and No arrays are allowed. You are not allowed to use any global variables, Global variables are declared above the int main0 line in a program. All variables should be declared in main(0 Project 6 Directions: Open a terminal window and change into your CPE211 SPR18/Project_ 06 directory. Download all needed files from Canvas into this directory. Using your favorite text editor (i.e. gedit), open the existing Project 06.cpp file (this is the header file created in Project 2) and add code to it to complete this project. Once you have finished with the program and it compiles without syntax errors, run the executable and verity that the output for your program matches the output from the provided solution executable - Project_06_solution. Page 1 of 4 Spring 2019 CPE211 Project Assignment Project 6 Once you are satisfied with your solution, submit Project 06.cpp via Canvas. NOTE: make sure that you do not change the order in which the information is entered. An automatic script is used to process all lab submissions, and if the order of the input information is modified, the script will not work properly with your program. Project 6 Description This program requires the utilization of concepts in Chapter 4, 5 and 6. Information regarding the test scores for a class is stored in an input file. The test scores and some supporting information is read from the input file. This information is then processed and written to an output file (see the sample output shown above) Using command line arguments for an input file and output file name (see command line argument slides and page 3). print out the command line input file name (see the sample solution for the output to use) and open the input file provided. Verity that the file opened successfully (file stream is valid). If it did not open successfully, enter a while loop that outputs an error message, resets the input file stream being opened and prompts the user to enter another input file name. This file name is read, echo printed and opened The loop continues until the input file is successfully opened. See project 5 for the error message information the while loop is the exact same (without the return 1;) -just replace if with while If the input file is successfully opened, print out the command line output file name and open the output file provided. Verify that the output file opened successfully. If it did not open successfully, enter a while loop that outputs an error message, resets the output file stream being opened and prompts the user to enter another output file name. This file name is read, echo printed and opened. The loop continues until the output file is successfully opened. Use the filename "Bad/file" to cause the open function to fail for the output file The input file contains three lines. The first line is a header line containing the name of the person line is an information line that is to be used when writing to the output file. This information line is a phrase submitting the grades. The second line consists of 4 integer grades separated by white space. The last similar to "Test scores for section 01:". See the sample input files for further information When reading the data from the file, the first line is ignored (no information is required from it). Then the stream is tested to verity that it is still valid. If the input stream is in the fail state mode, an appropriate If the input stream is valid, the scores are tested to ensure that they have positive values. If any score is four scores are read and stored in integer variables. After reading the scores, the status of the input error message is printed to the terminal AND the output file, and the program is terminated. less than 0, then the program prints out a message and the scores read to the terminal AND to the output file. The program is then terminated. If all scores read are greater than or equal to 0 and the input stream is still valid, the scores read are analyzed to determine their sum, average, letter grade for the average, variance and standard deviation. Formulas for performing these math functions are shown on the next page. The cmath header file may be needed for some of the math functions in the formulas. The letter grade for the average is based on the following scale for the average Average 90 : 80 : 70 : 60 Be sure to look at the command line argument slides For this program, instead of int main0 use: int main(int argc, char argv]) To run your program, type the following at the command line: IProject 06 input file_name output file_name In your program, assign argv1] to a string variable (inFileName-argv[1]:) that is to hold the input file name and argv[2] to a string variable(outFileName- argv[2]) that is to hold the output file name. Use these string variables in the open function when opening the files. When running the sample solution (not the comparison script), you must provide the input and output file names as command line arguments. Be sure to test for the correct number of command line arguments in your program - see project!5 A makefile has been provided that you can use to compile your program. For information on makefiles look at the makefile slides and look at material in Project 04. Page 4 of 4 Spring 2019 CPE211 Project Assignment Project #06 (40 points): Basic C++ math, file Inputoutput, IF statements, while loops Submit Your Solution Using Canvas by 10PM on Tuesday, 02/19/19 (late submissions will be accepted from 10PM to 11:59PM on 2/19/19) Sample Solution for Project 62 Project 6 Run the provided sample solution to see what information needs to be output by the program. You may RUN the sample solution Project 06 solution by typing the following at a command prompt in a terminal window that has a current working directory of -ICPE211 SPR18/Project 06(where represents your home directory) and that the sample input files are present in that directory. (Note, the input file must be in the directory from which the command below is run) Sample Solution path Provided sample input files are zipped in the file P6 in.zip output files(see page 4) Comparison Script Path home/work/cpe211/Executables/Project 06/Project 06 solution in.txt out.txt When running this solution you must provide command line arguments for the input and /homelwork/cpe211data/Project 06/CompareSolution.bash Project 06.cpp For a valid input fle, the information written to the output fle looks like the following: Test scores for section 02: The sum of the scores is The average of the scores is: 78.25 Letter grade equivalent: The variance of the scores is: 52.92 The standard deviation is Statistics 85 76 83 313.00 69 7.27 Project 6 Restrictions Only material from Chapters 1 through 7 and any extra code in this handout is allowed. You cannot use any C++ techniques that are covered in Chapters 8 and higher No global variables and No arrays are allowed. You are not allowed to use any global variables, Global variables are declared above the int main0 line in a program. All variables should be declared in main(0 Project 6 Directions: Open a terminal window and change into your CPE211 SPR18/Project_ 06 directory. Download all needed files from Canvas into this directory. Using your favorite text editor (i.e. gedit), open the existing Project 06.cpp file (this is the header file created in Project 2) and add code to it to complete this project. Once you have finished with the program and it compiles without syntax errors, run the executable and verity that the output for your program matches the output from the provided solution executable - Project_06_solution. Page 1 of 4 Spring 2019 CPE211 Project Assignment Project 6 Once you are satisfied with your solution, submit Project 06.cpp via Canvas. NOTE: make sure that you do not change the order in which the information is entered. An automatic script is used to process all lab submissions, and if the order of the input information is modified, the script will not work properly with your program. Project 6 Description This program requires the utilization of concepts in Chapter 4, 5 and 6. Information regarding the test scores for a class is stored in an input file. The test scores and some supporting information is read from the input file. This information is then processed and written to an output file (see the sample output shown above) Using command line arguments for an input file and output file name (see command line argument slides and page 3). print out the command line input file name (see the sample solution for the output to use) and open the input file provided. Verity that the file opened successfully (file stream is valid). If it did not open successfully, enter a while loop that outputs an error message, resets the input file stream being opened and prompts the user to enter another input file name. This file name is read, echo printed and opened The loop continues until the input file is successfully opened. See project 5 for the error message information the while loop is the exact same (without the return 1;) -just replace if with while If the input file is successfully opened, print out the command line output file name and open the output file provided. Verify that the output file opened successfully. If it did not open successfully, enter a while loop that outputs an error message, resets the output file stream being opened and prompts the user to enter another output file name. This file name is read, echo printed and opened. The loop continues until the output file is successfully opened. Use the filename "Bad/file" to cause the open function to fail for the output file The input file contains three lines. The first line is a header line containing the name of the person line is an information line that is to be used when writing to the output file. This information line is a phrase submitting the grades. The second line consists of 4 integer grades separated by white space. The last similar to "Test scores for section 01:". See the sample input files for further information When reading the data from the file, the first line is ignored (no information is required from it). Then the stream is tested to verity that it is still valid. If the input stream is in the fail state mode, an appropriate If the input stream is valid, the scores are tested to ensure that they have positive values. If any score is four scores are read and stored in integer variables. After reading the scores, the status of the input error message is printed to the terminal AND the output file, and the program is terminated. less than 0, then the program prints out a message and the scores read to the terminal AND to the output file. The program is then terminated. If all scores read are greater than or equal to 0 and the input stream is still valid, the scores read are analyzed to determine their sum, average, letter grade for the average, variance and standard deviation. Formulas for performing these math functions are shown on the next page. The cmath header file may be needed for some of the math functions in the formulas. The letter grade for the average is based on the following scale for the average Average 90 : 80 : 70 : 60 Be sure to look at the command line argument slides For this program, instead of int main0 use: int main(int argc, char argv]) To run your program, type the following at the command line: IProject 06 input file_name output file_name In your program, assign argv1] to a string variable (inFileName-argv[1]:) that is to hold the input file name and argv[2] to a string variable(outFileName- argv[2]) that is to hold the output file name. Use these string variables in the open function when opening the files. When running the sample solution (not the comparison script), you must provide the input and output file names as command line arguments. Be sure to test for the correct number of command line arguments in your program - see project!5 A makefile has been provided that you can use to compile your program. For information on makefiles look at the makefile slides and look at material in Project 04. Page 4 of 4

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

1285427106, 978-1285427102

More Books

Students also viewed these Databases questions

Question

Where is the position?

Answered: 1 week ago

Question

What is your least favorite U.S. dialect? Why?

Answered: 1 week ago