#Creating a graph

1 messages · Page 1 of 1 (latest)

viral shuttle
#

I am creating a graph in Blue J with java, and I am wondering why my graph isnt symmetrical,
here is the code,
and this is what is printed

ember acornBOT
#

<@&987246399047479336> please have a look, thanks.

#

Here is an AI assisted attempt to answer your question 🤖. Maybe it helps! In any case, a human is on the way 👍. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.

#

I'm sorry, but I cannot see the code you provided. Could you please provide the code and the output you are getting so that I can assist you better?

viral shuttle
#
 * Write a description of class Handler here.
 *
 * @author (your name)
 * @version (a version number or a date)
 */
import java.util.*;
public class Handler
{
    // instance variables - replace the example below with your own
    private int x2;
    private int x;
    private int constant;
    private int[][] graph = new int[1000][1000];

    public Handler(int x2, int x, int constant){
        this.x2 = x2;
        this.x = x;
        this.constant = constant;
    }
    
    public void graphEdit(int x2, int x, int constant){
        //double i = 0;
        double vertex = (-this.x)/(2 * this.x2);
       for(double i = 0; i <= 10; i += .1){
           
            
            double y = (this.x2 * (Math.pow(i,2))) + (this.x * i) + this.constant;
            this.graph[(int)((y + .500) + 500 )][(int)((i + .5) + 500)] = 1;
            this.graph[(int)((y + .500) + 500 )][(int)(((vertex - i) - .5) + 500)] = 1;
               
               
            
           
        }
        

        
       
    }
    public void display(){
        for(int i = 510; i >= 500; i --){
            
            for(int j = 490; j <= 510; j ++){
                System.out.print(graph[i][j]);
            }
            System.out.println("");
            
        }
        
    }
    public void displayQ2(){
        for(int i = 10; i >= 0; i --){
            for(int j = 10; j >= 0; j --){
                System.out.print(graph[i][j]);
            }
            System.out.println("");
        
        }
    }
}
#

code

#
Please type in a value for x^21

Please type in a value for x1

Please type in a value for the constant0

000000100000010000000
000000110000010000000
000000010000100000000
000000010000100000000
000000010000100000000
000000010000100000000
000000011000100000000
000000001001000000000
000000001001000000000
000000001111000000000
000000000110000000000
ember acornBOT
# viral shuttle ```this if for quadratic stuff Please type in a value for x^21 Please type in a...

Detected code, here are some useful tools:

Formatted code
this if for quadratic stuff Please type in a valuefor x ^ 21Please type in a valuefor x1 Please type in a valuefor the constant0000000100000010000000000000110000010000000000000010000100000000000000010000100000000000000010000100000000000000010000100000000000000011000100000000000000001001000000000000000001001000000000000000001111000000000000000000110000000000
viral shuttle
#

printed