* * *

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

godik

  • New member
  • *
  • Posts: 7
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: 2640
  • 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.1.0 r59317M FPC 3.3.1 r39660 x86_64-linux-qt Chakra, Qt 4.8.7/5.11.1, Plasma 5.13.5
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.14

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

godik

  • New member
  • *
  • Posts: 7
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: 2640
  • 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.1.0 r59317M FPC 3.3.1 r39660 x86_64-linux-qt Chakra, Qt 4.8.7/5.11.1, Plasma 5.13.5
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.14

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

Handoko

  • Hero Member
  • *****
  • Posts: 2610
  • 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

  • Jr. Member
  • **
  • Posts: 89

Bart

  • Hero Member
  • *****
  • Posts: 3115
    • 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

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus