You are on page 1of 10

Sir, Since you told that you are not able to understand some parts in the project description,

I have once again elaborated all the steps in the project and I have also give a simple example, since you told that taking values from runtime is more difficult. So please go through the full details given below so that you will be able to proceed well.

STEP I:The first step in the project is to give any Java program as input. For this we have to select the needed java program from the list of program / documents available in our system. We have to create a GUI for selecting the java program. After selecting the java program which is to be processed, the next step is to list or display the variables present in the program. The GUI should have a button which when clicked will display the variables present in the particular program. There will be different types of variables such as integer, float, real, Boolean etc. List all the variables present in the selected java program. If the variable values are declared like int number=10, then this also should be displayed. For example consider the program code given below:main( ) { int i, j; float a, b=12.3 real c; } Here all the variables should be displayed and the result is given below. i, j a, b=12.3 c

STEP II:After displaying the variables in the program we have to go to the next step. The next step is step II. In step II, we have to specify the condition initially. Here the condition includes the statement number and the variable. So the GUI for process I should include a column where we can enter the condition. The condition will have two parameters or arguments. The first parameter is the statement number and the second one is the variable. The variable can be selected by the user. This is why we are displaying the variables initially in the previous GUI. Process I is explained below with an example .Consider the program code given below. 1. main( ) 2. { 3. float basic= 1500, total, da, rent;

4. if (basic < 1000) 5. { 6. rent= 700; 7. da= basic * 93 / 100; 8.} 9. else 10. { 11. rent= basic * 12 /100; 12. da= basic * 85 / 100; 13.} 14. total =basic + rent + da; 15. System .out. println (total = + total); 16.} We are giving the condition in the label/ space provided in GUI. Let the condition be (15, total) This means that we have to display all the statements in the program which will affect the value of the variable total in statement number 15. This means that we have to see or display the statements on which the value of the variable total depends on. Here we have to check the dependent statements of statement 15. If we check the program then we can see that statement 14 will affect the value of variable total in statement 15 and again if we check then we can see that statement 14 is dependent on statements 12, 11, 9, 7, 6, 4, 3. The statements 14, 12, 11, 9, 7, 6, 4, 3 will affect the value of variable total in statement 15. Therefore the output of condition (15, total) is given below Output of condition (15, total) 3. float basic= 1500, total, da, rent; 4. if (basic < 1000) 6. rent= 700; 7. da= basic * 93 / 100; 9. else 11. rent= basic * 12 /100; 12. da= basic * 85 / 100; 14. total =basic + rent + da;

The GUI will have a button which will display the result for each condition. When we enter the condition and click the button, then these statements should be displayed. There can be several conditions in a program. These conditions are manually given by the programmer by checking the list of variables in the program and the variable position or statement number. For example, another condition is given as (14, basic). This means we have to check which all statements affect the value of variable basic in statement number 14. We can see that the value of variable basic is only dependent on statement number 3.Therefore the output of condition (14, basic) is 3. float basic=1500; Similarly the output of condition (14, rent) is: 3. float basic= 1500, total, da, rent; 4. if (basic < 1000) 6. rent= 700; 9. else 11. rent= basic * 12 /100

STEP III:In this step we are processing the output statement obtained in step II for various conditions. Here also we have a GUI. In the GUI we will have a space/ or label to enter the condition. In this step also we have to specify the condition first. Here the condition will have 3 parameters or arguments. The first one will be the input value of any variable (This will be declared in the program already), the second parameter is the statement number and the third parameter is the variable name. 3 parameters of condition in step II are: 1. Input value 2. Statement number 3. Variable name I will explain Step III with an example. Here we are considering the output statements of step II. For example, let us take the output statements for condition (15, total) as the input statement for the step III This means Output statements of condition (15, total) is given as input for Step III. So if the programmer wants to give the output of condition (15, total) as input for step III, then you should record or store the output of condition (15, total) as a file or text document. If you are not able to store the out as a separate document, then the only way to give input for step III is to manually enter all the output statements by the programmer. For example the output of condition (15, total) is given below:3. float basic= 1500, total, da, rent; 4. if (basic < 1000) 6. rent= 700; 7. da= basic * 93 / 100;

9. else 11. rent= basic * 12 /100; 12. da= basic * 85 / 100; 14. total =basic + rent + da; You have to store these output statement as a file or text document and then select this as the input for step III. If you are not able to do that or if the string is very difficult, then write the output statement in a paper and give this as input for step III. In step III also you have to specify the condition. Here the condition will have 3 parameters as I told before. I will explain this with an example. Condition for Step III- (basic= 1500, 3, da). Here the 1 st parameter is basic=1500. This is got by checking the output statements of the condition (15, total). The input value of basic=1500 is already defined in the initial program.. The 2nd parameter is statement number and the 3rd parameter is variable name. The meaning of condition (basic=1500, 3, da) is to display all the statement which are affected if we declare the variable rent in statement number 3. VERY IMPORTANT NOTE: - The main difference between step II and step III is that, in step II we are checking which are all the statements that affect the value of a particular variable at a specified position in the program and in step III we are checking which are all the statements that get affected if we declare a particular variable at a specified position. In step III we are checking which are the statements in a program that get affected by the particular variable defined in a particular position (check from top to bottom). So in step III, first give the output of condition (15, total) or any other condition (this can be selected by the user and the user will have to record all the condition for this (manually or as text file or document as I explained above)). In this example I am considering the output of condition (15, total). Then specify the new condition for step III. Here as I told before the condition will have 3 parameters namely the input value of any variable (This will be declared in the program already), the second parameter is the statement number and the third parameter is the variable name. So the condition for step III is ((basic= 1500, 3, da). There can be other conditions like (basic=1500, 3, rent) and some other like (basic=1500, 3, total) etc. We can consider the conditions one after the other. Initially I am considering the condition (basic=1500, 3, da). This means that from the below statements display all the statements which are affected by declaring the variable da in statement number 3 for input value of basic=1500. That is why we are giving the statement number as 3 ( 2nd parameter) in the condition 3. float basic= 1500, total, da, rent; 4. if (basic < 1000) 6. rent= 700; 7. da= basic * 93 / 100; 9. else 11. rent= basic * 12 /100; 12. da= basic * 85 / 100;

14. total =basic + rent + da; From these statements, we can see that if the value of basic=1500, then the else loop only will be executed. So here we have to consider the execution sequence of the statements for a particular input value. This means that if the value of basic=1500(already defined in program) then the ELSE LOOP of the above statements only will be executed. The programmer should be able to understand this point. For this the programmer can check or highlight the LOOPS like if---else, for, do---while) present in the above statements. Otherwise the programmer can display the loop which will be executed for a particular value of input (in this example basic =1500). Now we have the following intermediate statements (Statements 6, 7 will not be included because we are having input value of variable basic=1500 and therefore the else part only will be executed. If the value of basic=900, then the IF LOOP part only will be included. If the loops are highlighted then the programmer can easily select the intermediate statements either manually or automatically. If you are doing it manually, then note down the statements because these intermediate statements are taken for processing next.) 3. float basic= 1500, total, da, rent; 4. if (basic < 1000) 9. else 11. rent= basic * 12 /100; 12. da= basic * 85 / 100; 14. total =basic + rent + da; This is the reason why we are considering the input value as the 1st parameter in the new condition. From the above statements check which are the statements that get affected if the variable da is declared in position 3. We can see that only statement 12 and statement 13 gets affected if variable da is declared in position 3 or statement 3 for input value of basic = 1500. So while designing the GUI for step III, we should be able to select the output statements of step II (statements of any condition decided by the programmer) as input for step III. These can be manually given by the programmer or the statements should be stored as document or file. Then after selecting or giving the input for step III, then give the condition for step III which includes 3 parameters. Here the input value can be obtained from the input statements itself (already declared in the program). After this display or write done separately the intermediate statements .For identifying the intermediate statements, we are using the input value in the condition (here basic=1500). In order to identify the intermediate statements easily, please high lighten the loops present in the input statements of step III or display the loops separately. Then enter the intermediate steps in the GUI. If automatically entering the intermediate statements is not possible by programmer, then manually note the intermediate statements in a paper and then enter them in the GUI. So the GUI of step III should have space or facility to enter the intermediate statements also. Then we are checking the intermediate statements. For this we have a variable name (3rd parameter) and statement number (2nd parameter) as I explained above. Based on these we have to check each line in the intermediate statement and select the statements which are affected by the declaration of the variable at a particular / given position (Defined in the condition of step III). Here we are checking the intermediate statements from the top to bottom. From these statements finally get the output statements. So the output will be 12. da= basic * 85 / 100;

14. total =basic + rent + da; This means that for condition (basic=1500, 3, da) the output is 12. da= basic * 85 / 100; 14. total =basic + rent + da; Similarly if the condition was (basic=1500, 3, rent) then the output will be (Check the intermediate statements and then display the statements or lines which are affected if the variable rent is declared in position or statement 3(which is already given in the program and the programmer has to just enter that statement number in the condition). The output will be as follows for (basic=1500, 3, rent) 11. rent= basic * 12 /100; 14. total =basic + rent + da; Similarly if the condition was (basic=1500, 3, total) then the output will be 14. total =basic + rent + da; Please try to store the result / output of step III in a file or as text document. If you are not able to automate that, then write down all the output statements in a paper because we need these statements for deciding the values. So the next step is to generate the values.

STEP IV:
Write down the output of step III or record the output of step III. For example some of the output statements of step III are given below. We are naming the output as Set I, Set II etc. SET I (output statements of step III for condition (basic=1500, 3, rent)) 11. rent= basic * 12 /100; 14. total =basic + rent + da; SET II (output statements of step III for condition (basic=1500, 3, da)) 12. da= basic * 85 / 100; 14. total =basic + rent + da; Now we have 2 sets of output statements (more than 2 sets can be obtained, but here I am considering only two sets). We have 2 methods to decide the value of unknown variables.

Method I- Direct substitution


Consider SET I. Here we have the following statements. We got these statements for condition (basic=1500, 3, rent). Therefore substitute the value of variable basic as 1500 (basic=1500) in statement number 11. after substitution we will get the value of variable rent as 180(rent=180) 11. rent= basic * 12 /100; ( substitute basic=1500, therefore rent=1500 * 12/100= 180)

14. total =basic + rent + da; Now consider SET II. Here we have the following statements. We got these statements for condition (basic=1500, 3, da). Therefore substitute the value of variable basic as 1500 (basic=1500) in statement number 12. After substitution we will get the value of variable da as 1275(da=1275) 12. da= basic * 85 / 100; ( substitute basic=1500, therefore da=1500 * 85/100= 1275) 14. total =basic + rent + da; Finally we got rent=180 and da=1275. Now substitute these values in statement 14. Take the value of basic as 1500 itself. 14. total= 1500 +180 + 1275= 2955 The final value of variable total is 2955 So basically the GUI of STEP IV should do the function of a CALCULATOR. The GUI should have facility to enter the equations like (rent= 1500 * 12/100 or total= 1500+180+1275) and it should display the result.The GUI should have space or column to enter the equation and the result of the equation should be displayed in a column. THIS IS THE FINAL OUTPUT

Method II- GAUSSIAN METHOD


Now the second method in setp IV is deciding values by GAUSSIAN approach ( Mathematical method of solving linear equation. The algorithm for Gaussian approach will be available from Internet or any numerical methods maths text book) So while designing the GUI for step IV , it should have 2 options. One is for Method I- Direct substitution method which I explained above. Now the next is for Method II- Gaussian approach. If we click Method I button option then the next GUI should do calculator function( as I told above). If we press Method II , then a screen or GUI should appear and it should have the facility or it should have 2 columns or space to enter equations. Suppose the output statements from Step III are as follows: 2200 =s +t 5000=1.4s +4t

Now we have to solve these equations by GAUSSIAN method (method II). If we solve these two equations then we get the value of variable s as 106 (s=106) and variable t as 2094(t=2094). So the first GUI

Direct Substitution Method

Gaussian method

If you click direct substitution method then the next GUI / screen should look like as given below. It should have a column to enter the equation and then display the result

Enter the Equation

1500 * 85/100

Result

1275

If you click the second option( Gaussian approach then , the GUI should look as follows .It should have two columns or space to enter the two equations and then a process button which when pressed should solve the given/entered two equations and then display result

Enter Equation I

s + t =2200

Enter Equation II

1.4 s + 4 t= 5000

PROCESS

RESULT: s= 106 t= 2094

THIS IS THE OVERALL DESCRIPTION OF HOW TO DO / PROCEED THE PROJECT.

You might also like