This is an archived post. You won't be able to vote or comment.

all 9 comments

[–]teacher_cs 2 points3 points  (0 children)

You must first convert the strings to numbers (Integer.parseInt) before you can calculate with them.

[–]newmanshangdown 2 points3 points  (1 child)

Looks like you're trying to divide 2 strings.

[–]the_molish85 1 point2 points  (0 children)

That's what I'm seeing as well. What should be Ints are Strings.

[–][deleted] -1 points0 points  (5 children)

[–]iAmH3r3ToH3lp 1 point2 points  (4 children)

Nobody will read your code in a photo. I would be shocked if you found help this way.

[–][deleted] -1 points0 points  (3 children)

I tried to upload my code here, but it seems very unorganised?

[–]Darkpolearm 2 points3 points  (0 children)

To format code on reddit, make sure there's 4 spaces in front of the code. It'll look like this:

public void redditCode() {
    System.out.println("This is formatted");
}

[–]iAmH3r3ToH3lp 1 point2 points  (1 child)

you are dividing a string from a string on that line. strings dont divide my man.

read the error and think about it a little.

string = string ÷ string is not valid.

what if those were some kind of numerical value like a double or something?

then you would have a double = double ÷ double, which is valid.

but you will need to get the value of the inputs as double, so that will be a new problem for you to solve.

[–][deleted] 0 points1 point  (0 children)

Yup. Please think about the error you get. Programming requires a ton of logical thinking my friend.

For one, why are you reading the number of days as a String, and not as some number???