Computer Science, asked by DrStudy, 11 months ago

Please explain each step of this program.(Next question)

Do not spam and the best answer will be marked as the brainliest.
Answer only if you have learnt Java programming basics.​

Attachments:

DrStudy: Plz answer fast
rakeshchennupati143: dude r u there?

Answers

Answered by ashwin456ojha
1

Explanation:

Since there is final keyword means, you cant change its value once it get defined, double is used means it can either hold very large (or small) numbers. The double variable is also used to hold floating point values.

So, the value of YARD and MILE wont be changed. Then the value of dist_feet would come in floating point, so dist_feet is declared in double. Ignore the dist_mile=0; and dist_yard= 0;

dist_yard= dist_feet/YARD

here the value of dist_yard = 1000/3.0

so dist_yard = 333.333

now there is a value of var dist_yard, so it can be used in next statement that is :

dist_mile = dist_yard/MILE

here the value of dist_yard = 333.333/1260

so dist_yard = 0.2

Next two statements are simple since they're only printing information.

Explained!


DrStudy: This day, you really did a great help for me.
DrStudy: Congratulations, for your two brainliest answers.
ashwin456ojha: ok
DrStudy: Thanks for following me.
Answered by rakeshchennupati143
1

Explanation:

  • A class CharConver is initialized with public static void main method
  • a double variable is initialized with a keyword "final"
  • final keyword is used only when the value assigned for that particular variable is final and should not be changed.
  • so YARD and MILE are assigned as double variables with final keyword with value 3.0 and 1260 respectively
  • dist_yard variable is initialized as double and given value 1000
  • dist_mile and dist_yard are assigned as double variables with value 0
  • the value of dist_feet/YARD is stored in dist_yard
  • because the given feet divided by the YARD gives us the feet in yards
  • then dist_yard divided by MILE is stored in dist_mile
  • when yards are divided my mile it will give us the feet in miles
  • so print yards and print miles

----Hope this will help you get what you want or what you want to learn mark brainliest if you like my answer

Similar questions