processing: How can make a function that's finding me the results of an quadratic formula with an array?
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
add a comment |
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
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
add a comment |
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
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
java arrays processing
edited Nov 28 '18 at 19:19
Rabbid76
40.2k123252
40.2k123252
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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.
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
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
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
add a comment |
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.
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
add a comment |
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.
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.
answered Nov 20 '18 at 20:46
Kevin WorkmanKevin Workman
34.1k54172
34.1k54172
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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