Answered step by step
Verified Expert Solution
Question
1 Approved Answer
CSE100 Principles of Provamming with C++ Lab 6:: 5 pts. You may work in pairs (that is, as a group of two) with a partner
CSE100 Principles of Provamming with C++ Lab 6:: 5 pts. You may work in pairs (that is, as a group of two) with a partner on this lab project you wish or you may work lone. If you work with a partner, only submit one lab project with both of your names in the source code file to Blackboard for grading, you will each earn the same number of points. What to hand in, and by when, is discussed in Section 5, read it now. After completing this assignment the student should be able to Complete all of the objectives of the peevious lab projects. write function definitiotas, call functions, pass parameters, define local variables, return a value from a function. Open a text file for reading/writing and read write from/to the text file. 3 Prelab Exercises 3.1 Prelab Exercise 3: Read software Requirements Read of this lab project document, which decribes what lab project peogram will do, ie, the software require ments. Then oome back here and complete the remaining prelab exercises. 3.2 Prelab Exercise 1: create Code: Blocks Project and Add Labo6 cpp to the Project Create a new Coder: Blocks project named Lalos Remove the automatically created main epp file from the project. Dowm load the template file Laboo epp from the course website and add Labo6.epp to your project. Leso6 cpp is the only source code file for this project. Exit the howder comment bock, see H.1, so the AUTHOR section contains your name and your email address, and if you work with a partner your partner's name and email address. 3.3 Prelab Exercise Create Test Input File coeffs.txt The program shall read input from a text file named coeffstot. The format of the file is in H Using the Code Bkoks text editor, create this file using the ooeflicients a 25, 67, and c m -3. Save this file in the same folder as your labo6. souroe oode file 3,4 Prelab Exercise 4: Study the Software Design The program shall comist of the following six fumetions. int maino -opens coeffs.txt for rowding. Calls road cor00 three times to read the coefficients a and c from the in- e is read. Calls cale root0 and oole roots0 to determine the two roots of the put file. Ckoas the file after the coefficient equatioe. Then calls outpat0 to send the re ults to an output file named roots txt. double read coeff(ifstreamt fin) Callod from main0 three times with the input file stream object defined in maim0 the argument. During each functioe call, reads the next coefficient from the input file and returns it as a double. double calc root 1 (double a, double b, double c) Called from maand) to calculate the first toot of the equation, the formula for roots in H. double cauc root2(double a, double b, double c) callod from main0 to calculate the second root of the equation, son the formula for rood, in 54. discriminant (double a, double b double co-callod from cole rootID and rale roots0 to calculate and return the value of the discriminant. tputo opens roots ext for wri and write the quadratic ovation and the two roots to the output per the format as documented in 54. The structure chart is oo the next page CSE100 Principles of Provamming with C++ Lab 6:: 5 pts. You may work in pairs (that is, as a group of two) with a partner on this lab project you wish or you may work lone. If you work with a partner, only submit one lab project with both of your names in the source code file to Blackboard for grading, you will each earn the same number of points. What to hand in, and by when, is discussed in Section 5, read it now. After completing this assignment the student should be able to Complete all of the objectives of the peevious lab projects. write function definitiotas, call functions, pass parameters, define local variables, return a value from a function. Open a text file for reading/writing and read write from/to the text file. 3 Prelab Exercises 3.1 Prelab Exercise 3: Read software Requirements Read of this lab project document, which decribes what lab project peogram will do, ie, the software require ments. Then oome back here and complete the remaining prelab exercises. 3.2 Prelab Exercise 1: create Code: Blocks Project and Add Labo6 cpp to the Project Create a new Coder: Blocks project named Lalos Remove the automatically created main epp file from the project. Dowm load the template file Laboo epp from the course website and add Labo6.epp to your project. Leso6 cpp is the only source code file for this project. Exit the howder comment bock, see H.1, so the AUTHOR section contains your name and your email address, and if you work with a partner your partner's name and email address. 3.3 Prelab Exercise Create Test Input File coeffs.txt The program shall read input from a text file named coeffstot. The format of the file is in H Using the Code Bkoks text editor, create this file using the ooeflicients a 25, 67, and c m -3. Save this file in the same folder as your labo6. souroe oode file 3,4 Prelab Exercise 4: Study the Software Design The program shall comist of the following six fumetions. int maino -opens coeffs.txt for rowding. Calls road cor00 three times to read the coefficients a and c from the in- e is read. Calls cale root0 and oole roots0 to determine the two roots of the put file. Ckoas the file after the coefficient equatioe. Then calls outpat0 to send the re ults to an output file named roots txt. double read coeff(ifstreamt fin) Callod from main0 three times with the input file stream object defined in maim0 the argument. During each functioe call, reads the next coefficient from the input file and returns it as a double. double calc root 1 (double a, double b, double c) Called from maand) to calculate the first toot of the equation, the formula for roots in H. double cauc root2(double a, double b, double c) callod from main0 to calculate the second root of the equation, son the formula for rood, in 54. discriminant (double a, double b double co-callod from cole rootID and rale roots0 to calculate and return the value of the discriminant. tputo opens roots ext for wri and write the quadratic ovation and the two roots to the output per the format as documented in 54. The structure chart is oo the next page
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