Recent

Author Topic: Calculating Volume and surface of the ball using Program  (Read 2975 times)

godik

  • New Member
  • *
  • Posts: 23
Calculating Volume and surface of the ball using Program
« on: October 10, 2018, 05:15:51 pm »
Hello Can Someone help me how can I do this? and when i want to make this program i have to use Button,Tedit,Tlabel.Thank you all.

Blaazen

  • Hero Member
  • *****
  • Posts: 3237
  • POKE 54296,15
    • Eye-Candy Controls
Re: Calculating Volume and surface of the ball using Program
« Reply #1 on: October 10, 2018, 05:34:53 pm »
Code: Pascal  [Select][+][-]
  1. uses math;
  2. ...
  3. volume:=4*pi*power(r, 3)/3;
  4. surface:=4*pi*r*r;
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

godik

  • New Member
  • *
  • Posts: 23
Re: Calculating Volume and surface of the ball using Program
« Reply #2 on: October 10, 2018, 05:45:30 pm »
But I have to use button,tedit and tlabel

Blaazen

  • Hero Member
  • *****
  • Posts: 3237
  • POKE 54296,15
    • Eye-Candy Controls
Re: Calculating Volume and surface of the ball using Program
« Reply #3 on: October 10, 2018, 05:51:03 pm »
I guess user will fill the radius of the ball to the edit. You have to convert it from string to integer with r:=strtoint(Edit1.Text);

You can do it in event Button1.OnClick, together with the formulas above. And result write to the label, using Label1.Caption:=inttostr(Volume);

Just try yourself or show us what you already have.
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Calculating Volume and surface of the ball using Program
« Reply #4 on: October 10, 2018, 05:51:35 pm »
@godik

It sounds like a homework.

Have you wrote something? Show us your code. If none, you should try to do it your best first then post your code here, so others can guide you.

Soner

  • Sr. Member
  • ****
  • Posts: 305

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: Calculating Volume and surface of the ball using Program
« Reply #6 on: October 12, 2018, 03:02:54 pm »
Use a TFloatSpinEdit, no need to convert to and from string, it has a Value property.

Bart

 

TinyPortal © 2005-2018