November 9, 2014 · Public
Here are the requirements to make a program, I don't even know where to start. can someone help???
Design Problem A
A programmer has been assigned to write a line pair classification program. The program shall determine the relationship between two lines. The equation of a line in standard form is: Ax +By= C where both a and b be cannot be 0, and a, b, and c are real numbers. The program shall: Read in the real numbers needed to define two lines Determine the slopes of the two lines Determine if the two lines are equal Determine if the two lines are parallel Determine if the two lines are perpendicular If two lines are not parallel, find the point of intersection Important facts: A line is determined by it’s coefficients: a, b, and c Invalid a,b,c triplets shall be rejected by the program, as not every triplet of
real numbers determines a line Two lines are equal if: a1 = a2, b1 = b2, c1 = c2; or a1 =k*a2, b1 = k*b2, and c1=k*c2 for some real number k Write a pseudocode design for the line classifying program to read in a pair of lines and satisfy the requirements above. Include enough detail in your design so the programmer can begin coding immediately, without asking questions about how the program should work. Finally, if other important facts (about lines) are needed for the design document, you are to research them yourself.
Lines Specification Modifications 1. The program should be capable of handing multiple sets of line compares
with the user selecting when they are ready to quit. 2. Allow for interactive use or read input data from an input file
a. The file would contain the number of line sets in the file followed by that many sets of coefficients for each pair of lines. b. An input file will allow you to thoroughly test all possible combinations of line types and relationships buy supplying lines in the file and running the program once.
3. Generate a complete summary output file
a. An output file containing each set of lines processed and all information on each line and each pair. The file should represent the lines in standard form (ax + by = c) and clearly describe all information presented.
4. Allow for generation of a selected summary output file also
a. Allow the user to select the line relationship they wish to have summarized
i. i.e. parallel lines, vertical lines, etc… 5. The program will need to be modularized into multiple functions.
a. No global variables are to be used.
ii. You will use pass by value and pass by reference parameters.
5. Additional enhancements encouraged! All of the Tier 0 and Tier 1 programs are good to work on except skip Tier 1_5 for now (this involves arrays which you don’t need to master for this program). You should also be reading/working on: • Formatted output (chapter 3.7 – iomanip) • If, if/else, switch (chapter 4) • For loops, while loops, do while loops (Chapter 5) • File I/O (Chapter 5) • Functions (chapter 6)
o Do not use global variable so you will use
§ Pass by value § Pass by reference
o Section 6.15 Stubs and Drivers – function stubs are a great way to set up the structure for your program to incrementally implement and debug it in phases. Remember: There are multiple esample programs and practice problems available at the AES site (accessible from the Modules area) – Task 2 .X – resources… Do not use: Global variables, continue, break(other than as needed in a switch), goto, exit.