Skip to content

Tag: math

How to calculate the coordinates of the second point on the map?

Example pictureI have the coordinates of the first point on the map, there is a distance between the points and there are degrees of rotation relative to the cardinal points (from the compass). Please tell me how to calculate the coordinates of the second point on the map? I tried to take the formula for find…

Rounding in Java using Math.random()

Suppose I write then one would obtain and output of x in [0, 4.9…]. But upon casting it as an integer, the result I continuously see (in my course) is [0, 4]. My question is how we are defining the rounding function; I am familiar with the floor function, and the floor of 4.9… is precisely 5 due t…

(Java) Generating random number for division program

Hi I’m new to programming and I’m trying to make a division program that can generate 2 random numbers and the condition is that the first number must be more than the second and they give no remainder. If the number generated does not meet the condition it keeps generating until the conditions ar…

Math function to get output desired

I am currently learning the basic math functions and I am struggling to get this output for my homework. I think the wording is just making me more and more confused. Thanks in advance for your help! Here is the problem layout: Z = 7 Use the Math methods and the System.out.println statement to display: the sq…