Notes on Computer Project #2 ---------------------------- Comments about the project and responses to frequently asked questions will be added to this file as necessary. ***** comments added on 01/17/12 ***** 1) Please note the following statement from the project handout: The deliverables for this assignment are the following files: proj02.problem1.cpp -- your C++ source code for Problem #1 proj02.problem2.cpp -- your C++ source code for Problem #2 Be sure to use the specified file names, and to submit your files for grading via the "handin" system. Please note the "handin" system will not accept any file name which does not fit the specified pattern. Please note that it is possible to submit a particular file multiple times: the last version of the file that you submit will be graded. 2) The coding standard for CSE 232 computer projects is published in the coursepack (pages 6-7) and is available under the "General" directory on the course website. The first three examples in the coursepack (pages 19-21) meet the coding standard, but some of the "demo" programs do not (for example, the source code on page 22 does not use mnemonic identifiers and does not include appropriate comments). 3) To access "adriatic" remotely, I would recommend using the SSH network protocol. Many personal computers already have a "ssh" package installed (Linux and Mac OS systems), or you can download and install a free package for Windows systems from the CSE Facilities web pages: http://www.cse.msu.edu/facility/software/ The CSE Facilities web pages also have a brief tutorial about using "ssh": http://www.cse.msu.edu/facility/howto/ssh/ Additional comments about accessing the CSE system are available on the course website: http://www.cse.msu.edu/~cse232/General/system.hints There are other methods for remotely accessing "adriatic", but "ssh" is one of the most convenient. 4) You'll use an editor to create and modify your source code files. Two popular editors in the Linux environment are "vim" and "emacs". Page 10 of the coursepack has a brief overview of "emacs" (that document is also available on the course website). To learn more about "emacs", you might wish to complete to review the following document: http://www.gnu.org/software/emacs/tour/ Page 11 of the coursepack has a brief overview of "vim" (that document is also available on the course website). 5) Please recall that C++ is a strongly typed language, and that every data object must be given a type when it is declared. Also, please recall that the type of an intermediate expression depends on the type of the data objects being used in the expression, and that there are specific rules for mixed-type expressions and type conversions. 6) As noted on the handout, you are not required to check any of the input values for user errors. That is, you may assume that the user enters a valid value in response to all prompts. Thus, you only need to use sequential execution to solve the problems in this project (you don't need to use selective or repetitive execution). 7) Please note that page 18 of the coursepack provides an overview of the math library, which contains functions such as "cos" and "acos". More information about those library functions is available in the Appendix C of the Nyhoff textbook and on-line via the "man" utility. For example, "man cos" produces the following: SYNOPSIS #include double cos(double x); DESCRIPTION The cos() function returns the cosine of x, where x is given in radians. RETURN VALUE The cos() function returns a value between -1 and 1. Note that the trigonometric functions work with angles measured in radians. 8) Please note that you must control the number of fractional digits which are displayed in Problem #2. The following statement will cause floating point values inserted into the output stream to be displayed in fixed point notation with two decimal places of accuracy: cout << setiosflags(ios::fixed) << setprecision(2); That statement should appear before any other operations on the output stream. 9) The instructional staff will use input redirection to test your solutions to Project #2 (it would be impractical to have a human repeatedly type the same input values for each student's solutions). That is, we'll translate and execute your solution to Problem #1 using something similar to the following: g++ proj02.problem1.cpp a.out < test1 a.out < test2 a.out < test3 a.out < test4 Each of the "test" files will contain a different set of input values. You may wish to test your solutions in a similar way so that you can be sure that your output has a reasonable appearance, regardless of whether the input comes from the keyboard or is redirected from a file. One note: input typed at the keyboard is automatically "echo printed", but input redirected from a file is not. You may wish to insert newlines after each input operation and to echo print all input values. For example: cout << "Please enter an integer: "; cin >> N; cout << endl; cout << "The value entered for N: << N << endl; The third line prints a blank line after the input operation, and the fourth line echo prints the input value. --M. McCullen