Ask your own question, for FREE!
Mathematics 10 Online
OpenStudy (yumi):

Can anyone help me make an algorithm (Flowchart) for my java program? Please!

OpenStudy (shadowlegendx):

@Jaynator495

jaynator495 (jaynator495):

Oh, because this was in math, i was ready to yell DANG IT SHADOW I DONT HELP IN MATH, but since this is a programming question...

jaynator495 (jaynator495):

Proceed! LOL

OpenStudy (shadowlegendx):

xD

OpenStudy (yumi):

i need help checking if my code is correct, and also how to do the flowchart?

jaynator495 (jaynator495):

Post away

OpenStudy (yumi):

OpenStudy (yumi):

thats what i had to do

OpenStudy (christopher1448):

Ok...

OpenStudy (yumi):

import java.util.Scanner; public class Chpt6_Project { public static void main(String[] args) { Scanner input = new Scanner(System.in); int num1; int num2; int num3; int sum; System.out.print("Enter three numbers: "); num1 = input.nextInt(); num2 = input.nextInt(); num3 = input.nextInt(); sum = num1 + num2 + num3; System.out.println("The sum is: " + sum); if(isPrime(sum)) System.out.println("The sum is a prime"); else System.out.println("The sum is not a prime"); } public static boolean isPrime(int n) { if (n%2==0) return false; //even numbers are not prime for(int i=3;i<n;i+=2) { //loop through all odd numbers if(n%i==0) return false; //if n is divisible by a number, it's not prime } return true; //otherwise n is prime } }

OpenStudy (yumi):

thats my code

OpenStudy (yumi):

its my first semester, so if i did everything wrong, please go easy jaja

jaynator495 (jaynator495):

TIP \``` CODE HERE \```

OpenStudy (christopher1448):

That looks good. Yep you did good

jaynator495 (jaynator495):

that will result in ``` CODE HERE ```

OpenStudy (yumi):

what?

OpenStudy (yumi):

i just see CODE HERE?

OpenStudy (christopher1448):

WERE SO CONFUSED :B

OpenStudy (yumi):

is my code wrong?

jaynator495 (jaynator495):

Yes, put your code in between the \``` This \```

jaynator495 (jaynator495):

Your code is fine though! lol

OpenStudy (yumi):

im not understanding ,sorry

jaynator495 (jaynator495):

this site may be of help to you http://www.browxy.com/

jaynator495 (jaynator495):

you may also like Visual Studio Community from microsoft, i believe they allow java applications...

OpenStudy (yumi):

i use Eclipse?

jaynator495 (jaynator495):

Thats works to ._.

OpenStudy (yumi):

could you help me with the flowchart?

jaynator495 (jaynator495):

@Jamierox4ev3r

jaynator495 (jaynator495):

I presume you mean a chart that represents the different paths of the scripts execution?

OpenStudy (yumi):

yes

jaynator495 (jaynator495):

Well, i think i just answered your question. Just make a chart of the scripts execution with each path, here's an example of one. |dw:1478127929287:dw|

jaynator495 (jaynator495):

uh, that example is broken o-o

jaynator495 (jaynator495):

http://www.rff.com/medicare-supplement-insurance.png Here lol

OpenStudy (yumi):

lol, i mean, i know what it should look like, i just need guidance on the steps, and whether i need 2 because of the isPrime

jaynator495 (jaynator495):

Alrighty, here is a example on what it might look like generated from http://code2flow.com/# (honestly, it will simply split on each true false, and merge..) Minus all the unneeded code being added into it

jaynator495 (jaynator495):

Sorry, i'm to lazy to make a actual flow chart x'D i think you can make one in word ._.

OpenStudy (yumi):

thanks lol

jaynator495 (jaynator495):

np xD

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!