processing: How can make a function that's finding me the results of an quadratic formula with an array?












-1















I have an assignment to do and have no clue how to do it.



given is a quadratic equation:



y = a*x*x + b*x + c


thats my code so far:



void setup(){
println(quadratic(4, 6, 1));
}

float quadratic(float a, float b, float c){
return (-b + sqrt( b*b - 4*a*c)) / (2*a);
}


I have to write an function that's giving me the coefficients as parameters and the results as an array.



I just don't know how to make an array.



thank you so much in advance!










share|improve this question




















  • 1





    It's really hard to help with general "how do I do this" type questions. You're going to have to break your problem down into smaller steps and approach those steps one at a time. Then if you get stuck, post a Minimal, Complete, and Verifiable example along with a more specific question. Good luck.

    – Kevin Workman
    Nov 20 '18 at 19:53






  • 1





    Please see: Why is “Can someone help me?” not an actual question?

    – EJoshuaS
    Nov 20 '18 at 19:54











  • Looks like you need to encode the quadratic formula into Java.

    – Fred Larson
    Nov 20 '18 at 19:54











  • I updated my post. It would be very nice if u would help me with the array

    – nilezguy
    Nov 20 '18 at 20:11











  • Thanks for editing your post. Your question is still pretty broad, but I've posted a general answer.

    – Kevin Workman
    Nov 20 '18 at 20:46
















-1















I have an assignment to do and have no clue how to do it.



given is a quadratic equation:



y = a*x*x + b*x + c


thats my code so far:



void setup(){
println(quadratic(4, 6, 1));
}

float quadratic(float a, float b, float c){
return (-b + sqrt( b*b - 4*a*c)) / (2*a);
}


I have to write an function that's giving me the coefficients as parameters and the results as an array.



I just don't know how to make an array.



thank you so much in advance!










share|improve this question




















  • 1





    It's really hard to help with general "how do I do this" type questions. You're going to have to break your problem down into smaller steps and approach those steps one at a time. Then if you get stuck, post a Minimal, Complete, and Verifiable example along with a more specific question. Good luck.

    – Kevin Workman
    Nov 20 '18 at 19:53






  • 1





    Please see: Why is “Can someone help me?” not an actual question?

    – EJoshuaS
    Nov 20 '18 at 19:54











  • Looks like you need to encode the quadratic formula into Java.

    – Fred Larson
    Nov 20 '18 at 19:54











  • I updated my post. It would be very nice if u would help me with the array

    – nilezguy
    Nov 20 '18 at 20:11











  • Thanks for editing your post. Your question is still pretty broad, but I've posted a general answer.

    – Kevin Workman
    Nov 20 '18 at 20:46














-1












-1








-1








I have an assignment to do and have no clue how to do it.



given is a quadratic equation:



y = a*x*x + b*x + c


thats my code so far:



void setup(){
println(quadratic(4, 6, 1));
}

float quadratic(float a, float b, float c){
return (-b + sqrt( b*b - 4*a*c)) / (2*a);
}


I have to write an function that's giving me the coefficients as parameters and the results as an array.



I just don't know how to make an array.



thank you so much in advance!










share|improve this question
















I have an assignment to do and have no clue how to do it.



given is a quadratic equation:



y = a*x*x + b*x + c


thats my code so far:



void setup(){
println(quadratic(4, 6, 1));
}

float quadratic(float a, float b, float c){
return (-b + sqrt( b*b - 4*a*c)) / (2*a);
}


I have to write an function that's giving me the coefficients as parameters and the results as an array.



I just don't know how to make an array.



thank you so much in advance!







java arrays processing






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 28 '18 at 19:19









Rabbid76

36.4k113247




36.4k113247










asked Nov 20 '18 at 19:50









nilezguynilezguy

254




254








  • 1





    It's really hard to help with general "how do I do this" type questions. You're going to have to break your problem down into smaller steps and approach those steps one at a time. Then if you get stuck, post a Minimal, Complete, and Verifiable example along with a more specific question. Good luck.

    – Kevin Workman
    Nov 20 '18 at 19:53






  • 1





    Please see: Why is “Can someone help me?” not an actual question?

    – EJoshuaS
    Nov 20 '18 at 19:54











  • Looks like you need to encode the quadratic formula into Java.

    – Fred Larson
    Nov 20 '18 at 19:54











  • I updated my post. It would be very nice if u would help me with the array

    – nilezguy
    Nov 20 '18 at 20:11











  • Thanks for editing your post. Your question is still pretty broad, but I've posted a general answer.

    – Kevin Workman
    Nov 20 '18 at 20:46














  • 1





    It's really hard to help with general "how do I do this" type questions. You're going to have to break your problem down into smaller steps and approach those steps one at a time. Then if you get stuck, post a Minimal, Complete, and Verifiable example along with a more specific question. Good luck.

    – Kevin Workman
    Nov 20 '18 at 19:53






  • 1





    Please see: Why is “Can someone help me?” not an actual question?

    – EJoshuaS
    Nov 20 '18 at 19:54











  • Looks like you need to encode the quadratic formula into Java.

    – Fred Larson
    Nov 20 '18 at 19:54











  • I updated my post. It would be very nice if u would help me with the array

    – nilezguy
    Nov 20 '18 at 20:11











  • Thanks for editing your post. Your question is still pretty broad, but I've posted a general answer.

    – Kevin Workman
    Nov 20 '18 at 20:46








1




1





It's really hard to help with general "how do I do this" type questions. You're going to have to break your problem down into smaller steps and approach those steps one at a time. Then if you get stuck, post a Minimal, Complete, and Verifiable example along with a more specific question. Good luck.

– Kevin Workman
Nov 20 '18 at 19:53





It's really hard to help with general "how do I do this" type questions. You're going to have to break your problem down into smaller steps and approach those steps one at a time. Then if you get stuck, post a Minimal, Complete, and Verifiable example along with a more specific question. Good luck.

– Kevin Workman
Nov 20 '18 at 19:53




1




1





Please see: Why is “Can someone help me?” not an actual question?

– EJoshuaS
Nov 20 '18 at 19:54





Please see: Why is “Can someone help me?” not an actual question?

– EJoshuaS
Nov 20 '18 at 19:54













Looks like you need to encode the quadratic formula into Java.

– Fred Larson
Nov 20 '18 at 19:54





Looks like you need to encode the quadratic formula into Java.

– Fred Larson
Nov 20 '18 at 19:54













I updated my post. It would be very nice if u would help me with the array

– nilezguy
Nov 20 '18 at 20:11





I updated my post. It would be very nice if u would help me with the array

– nilezguy
Nov 20 '18 at 20:11













Thanks for editing your post. Your question is still pretty broad, but I've posted a general answer.

– Kevin Workman
Nov 20 '18 at 20:46





Thanks for editing your post. Your question is still pretty broad, but I've posted a general answer.

– Kevin Workman
Nov 20 '18 at 20:46












1 Answer
1






active

oldest

votes


















0














I'd recommend googling something like "Processing array" or "Java array" for a ton of results.



The Processing reference is a great first place to start. Here is the reference for arrays in Processing, and it includes sample code like this:



int numbers = new int[3];
numbers[0] = 90; // Assign value to first element in the array
numbers[1] = 150; // Assign value to second element in the array
numbers[2] = 30; // Assign value to third element in the array
int a = numbers[0] + numbers[1]; // Sets variable 'a' to 240
int b = numbers[1] + numbers[2]; // Sets variable 'b' to 180


Shameless self-promotion: here is a tutorial on arrays in Processing.






share|improve this answer
























  • thanks for your effort. but i still can't figure it out how to do it :/

    – nilezguy
    Nov 21 '18 at 19:06











  • @nilezguy Which part is giving you trouble? Start with something simpler. Create an array using hard-coded values. Get that working first, then try to add in more logic. Then if you get stuck, you can post a Minimal, Complete, and Verifiable example along with a more specific technical question. Good luck.

    – Kevin Workman
    Nov 21 '18 at 19:28











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53400537%2fprocessing-how-can-make-a-function-thats-finding-me-the-results-of-an-quadrati%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














I'd recommend googling something like "Processing array" or "Java array" for a ton of results.



The Processing reference is a great first place to start. Here is the reference for arrays in Processing, and it includes sample code like this:



int numbers = new int[3];
numbers[0] = 90; // Assign value to first element in the array
numbers[1] = 150; // Assign value to second element in the array
numbers[2] = 30; // Assign value to third element in the array
int a = numbers[0] + numbers[1]; // Sets variable 'a' to 240
int b = numbers[1] + numbers[2]; // Sets variable 'b' to 180


Shameless self-promotion: here is a tutorial on arrays in Processing.






share|improve this answer
























  • thanks for your effort. but i still can't figure it out how to do it :/

    – nilezguy
    Nov 21 '18 at 19:06











  • @nilezguy Which part is giving you trouble? Start with something simpler. Create an array using hard-coded values. Get that working first, then try to add in more logic. Then if you get stuck, you can post a Minimal, Complete, and Verifiable example along with a more specific technical question. Good luck.

    – Kevin Workman
    Nov 21 '18 at 19:28
















0














I'd recommend googling something like "Processing array" or "Java array" for a ton of results.



The Processing reference is a great first place to start. Here is the reference for arrays in Processing, and it includes sample code like this:



int numbers = new int[3];
numbers[0] = 90; // Assign value to first element in the array
numbers[1] = 150; // Assign value to second element in the array
numbers[2] = 30; // Assign value to third element in the array
int a = numbers[0] + numbers[1]; // Sets variable 'a' to 240
int b = numbers[1] + numbers[2]; // Sets variable 'b' to 180


Shameless self-promotion: here is a tutorial on arrays in Processing.






share|improve this answer
























  • thanks for your effort. but i still can't figure it out how to do it :/

    – nilezguy
    Nov 21 '18 at 19:06











  • @nilezguy Which part is giving you trouble? Start with something simpler. Create an array using hard-coded values. Get that working first, then try to add in more logic. Then if you get stuck, you can post a Minimal, Complete, and Verifiable example along with a more specific technical question. Good luck.

    – Kevin Workman
    Nov 21 '18 at 19:28














0












0








0







I'd recommend googling something like "Processing array" or "Java array" for a ton of results.



The Processing reference is a great first place to start. Here is the reference for arrays in Processing, and it includes sample code like this:



int numbers = new int[3];
numbers[0] = 90; // Assign value to first element in the array
numbers[1] = 150; // Assign value to second element in the array
numbers[2] = 30; // Assign value to third element in the array
int a = numbers[0] + numbers[1]; // Sets variable 'a' to 240
int b = numbers[1] + numbers[2]; // Sets variable 'b' to 180


Shameless self-promotion: here is a tutorial on arrays in Processing.






share|improve this answer













I'd recommend googling something like "Processing array" or "Java array" for a ton of results.



The Processing reference is a great first place to start. Here is the reference for arrays in Processing, and it includes sample code like this:



int numbers = new int[3];
numbers[0] = 90; // Assign value to first element in the array
numbers[1] = 150; // Assign value to second element in the array
numbers[2] = 30; // Assign value to third element in the array
int a = numbers[0] + numbers[1]; // Sets variable 'a' to 240
int b = numbers[1] + numbers[2]; // Sets variable 'b' to 180


Shameless self-promotion: here is a tutorial on arrays in Processing.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 20 '18 at 20:46









Kevin WorkmanKevin Workman

33.8k54069




33.8k54069













  • thanks for your effort. but i still can't figure it out how to do it :/

    – nilezguy
    Nov 21 '18 at 19:06











  • @nilezguy Which part is giving you trouble? Start with something simpler. Create an array using hard-coded values. Get that working first, then try to add in more logic. Then if you get stuck, you can post a Minimal, Complete, and Verifiable example along with a more specific technical question. Good luck.

    – Kevin Workman
    Nov 21 '18 at 19:28



















  • thanks for your effort. but i still can't figure it out how to do it :/

    – nilezguy
    Nov 21 '18 at 19:06











  • @nilezguy Which part is giving you trouble? Start with something simpler. Create an array using hard-coded values. Get that working first, then try to add in more logic. Then if you get stuck, you can post a Minimal, Complete, and Verifiable example along with a more specific technical question. Good luck.

    – Kevin Workman
    Nov 21 '18 at 19:28

















thanks for your effort. but i still can't figure it out how to do it :/

– nilezguy
Nov 21 '18 at 19:06





thanks for your effort. but i still can't figure it out how to do it :/

– nilezguy
Nov 21 '18 at 19:06













@nilezguy Which part is giving you trouble? Start with something simpler. Create an array using hard-coded values. Get that working first, then try to add in more logic. Then if you get stuck, you can post a Minimal, Complete, and Verifiable example along with a more specific technical question. Good luck.

– Kevin Workman
Nov 21 '18 at 19:28





@nilezguy Which part is giving you trouble? Start with something simpler. Create an array using hard-coded values. Get that working first, then try to add in more logic. Then if you get stuck, you can post a Minimal, Complete, and Verifiable example along with a more specific technical question. Good luck.

– Kevin Workman
Nov 21 '18 at 19:28


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53400537%2fprocessing-how-can-make-a-function-thats-finding-me-the-results-of-an-quadrati%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

'app-layout' is not a known element: how to share Component with different Modules

android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

WPF add header to Image with URL pettitions [duplicate]