Hey guys, whats up? I'm ieldra's friend and I need help with the following question (I'm in first year of college btw.): FLOWCHARTS Given the equation: z = 3x2 – 2xy + y3, with the following constraints: -3 <= x <= 5 and -2 <= y <=4. Print the largest value of z and the corresponding values of x and y, taking into consideration that Δx = 0.1 and Δy = 0.2. (Draw a flowchart for this)

You have to check each value of z for the values of x and y within the given domain, using the Δx and Δy given. i.e. (get a value of x, then use all the values of y) z when x = -3, y = -2 z when x = -3, y = -1.98 ... (get the next value of x, then use all the values of y again) z when x = -2.99, y = -2 z when x = -2.99, y = -1.98 ... z when x = 5, y = -2 z when x = 5, y = -1.98 .... z when x = 5, y = 3.98 z when x = 5, y = 4 (until you finish x and y) You need to compare the newly calculated value of z to the previous maximum value of z and update if required. In pseudo code, some parts deliberately vague. Code: //initial conditions, we need an initial 'lowest' value of z to compare to //I've chosen when x = -3 and y = -2 zMax = (z when x = -3, y = -2) xValAtZMax = -3 yValAtZMax = -2 for (xLoop = -3 to 5 (inclusive), incrementing by 0.1) { for (yLoop = -2 to 4 (inclusive), incrementing by 0.2) { //calculate the 'current' value of z (using 'xLoop' and 'yLoop') //compare the 'current z' to 'zMax' //If larger than, then we have a new zMax, xValAtZMax and yValAtZMax //otherwise move on } } [I]output [/I]zMax, xValAtZMax, yValAtZMax //end Ideally you would have a few more constants in there (xMin, xMax, xInc, yMin... etc) so there aren't any magic numbers, even in the flowchart. You could also skip when x = -3 and y = -2 since you already have that z value. I'm probably cheating a bit by going to code then converting to a flowchart, but I think better like this.

Making code works with small programs, but you need some basic idea how to do that before start typing... Perhaps if you do simple functions and just name those and tell what those are supposed to do (include zero code), then it's easier to start making flowchart from it. Anyways, I dont know what kind of flowcharts you are supposed to make, can those include any code or just the basic idea how those are supposed to work ? Are you going to use that flowchart to convert it to code using some code generator (Insoft Prosa for exmaple) or just leave it to flowchart level. Are you supposed to include variables there or not ? What program are you going to use ? Microsoft Office Viso 2007 or just pencil and paper ?

I was bored so I wrote a Java program that solves that equation for any value of x and y. Also tells you if x and y are within the constraints. I'm not leet enough to do the max value thing though, if anyone want to mess with the code below please do so cause I'm curious. You can crash it easily, just try to enter any character A-Z lol.

er thats not whats needed it should calculate it itself This is whats needed , i got bored too and as i was editing a work junit test i just added another( note tabs dont show )