Section 2d

Step Two


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Systematic and Structured Programming

Step Two - Expanding the Solution


While it is true that your step one action was pretty easy, you have accomplished an important thing. Now that you have the overall flow of the program fleshed out, almost all of the remaining programming work will involve "filling in the blanks" in a kind of ever-expanding strategy that includes both a top-down and an iterative refinement process.

If you are working through this with the web page, you must create a new program file named in your Project_1 structure. This program will be named QuadProg_StepTwo. You must then copy the contents of the main function in QuadProg_StepOne into the main function of your QuadProg_StepTwo. At this point, you want to save what was stored as step one for your future review.

Consider the following items from the previous step:

Initialize the program

// initialize program

// initialize variables

// show title

Get the coefficients from the user

// get coefficients from user

// get coefficient A

// get coefficient B

// get coefficient C

Process the quadratic roots

 

Quadratic Equation

// process the quadratic roots

// calculate the discriminant

// calculate the discriminant square root

// calculate the denominator

// calculate roots

// calculate root one

// calculate root two

Display the Roots

// display roots

// display user input

// display root one

// display root two

End the program

// end program

// display program end

// return function success

The Whole Schlemiel

public static void main()
{
// initialize program

// initialize variables

// show title

// get coefficients from user

// get coefficient A

// get coefficient B

// get coefficient C

// process the quadratic roots

// calculate the discriminant

// calculate the discriminant square root

// calculate the denominator

// calculate roots

// calculate root one

// calculate root two

// display roots

// display user input

// display root one

// display root two

// end program

// display program end

// return function success
}

This again does not take very long to write, but you have expanded what the main part of your program will do now. You have prepared yourself for the next part of the programming process, which is to break the problem down into manageable problem-solving components.

Some notes:


To see the step two process in action, watch this video; then develop your step two code with or without the video as needed in your own editor.