• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Where has the radius variable been defined?

 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello, good evening, does anyone know? Thank you.
 
Marshal
Posts: 79969
396
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What language is that?
Radius is defined in line 15 as a parameter to the area_circle() function. Are you using that function? You appear to have all sorts of different spellings, rad and RAD, perimeterAnddiameter and perimeterYdiameter, which seem to be swapping between English and spanish. Does that code actually compile and run?
If you defined those variables as Real, why are you using 3 instead of π?
 
Bruno Valdeolmillos
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:What language is that?
Radius is defined in line 15 as a parameter to the area_circle() function. Are you using that function? You appear to have all sorts of different spellings, rad and RAD, perimeterAnddiameter and perimeterYdiameter, which seem to be swapping between English and spanish. Does that code actually compile and run?
If you defined those variables as Real, why are you using 3 instead of π?


It is not a language, it is pseudocode. It is to learn programming logic.
The code works perfect. I defined it as real and then put 3 instead of the value of PI(3,14) to quickly check if the results were correct (so as not to use the calculator).
I did not know that the arguments could be defined after putting the function name. Anyway, it defines the radio variable after writing the function name but I don't know what data type it is. I assume that it is defined from the line 3
 
Bruno Valdeolmillos
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Of course, my native language is Spanish and I translated it into English using google translator and it did not translate the conjunction "y" well, which in English is and. Sorry.
 
Bartender
Posts: 5563
213
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Bruno,

Bruno wrote:SubProcess perimeterAnddiameter(rad By Value, perimeter By Reference, diameter By Reference)


That reminds me of Quick Basic, about 10_000 years ago!

But in Java, everything is passed by value, even if that value is a reference!
 
Bruno Valdeolmillos
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Piet Souris wrote:hi Bruno,

Bruno wrote:SubProcess perimeterAnddiameter(rad By Value, perimeter By Reference, diameter By Reference)


That reminds me of Quick Basic, about 10_000 years ago!

But in Java, everything is passed by value, even if that value is a reference!


that is, it does not exist by reference in Java??
I am still trying to understand the difference between by value and by reference, in addition to its usefulness (I was told that it is used to make a copy, "backup" style) Supposedly by value it does not return values to the main algorithm... I will seek.
 
When all four tires fall off your canoe, how many tiny ads does it take to build a doghouse?
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic