Physics Calculator
Extension Description
Extension Name - PhysicsCalculator
Extension Package - xyz.nisarga.PhysicsCalculator
Current Version - 1.0
Extension Created - 2021-02-08T18:30:00Z
Extension Last Updated - 2021-02-08T18:30:00Z
Blocks
Open Source
Download
xyz.nisarga.PhysicsCalculator.aix (6.2 KB)
9 Likes
Nice work Please follow the naming conventions as well :
If you are developing an extension, then please follow the naming conventions, which is UpperCamelCase for the package name as well as for property, method and event names (i.e. the first letter should be a capital letter) and lowerCamelCase for parameter names, no underscores .
Example
[naming]
What does UpperCamelCase mean?
UpperCamelCase (part of CamelCase ) is a naming convention in which a name is formed of multiple words that are joined together as a single word with the first lā¦
Methods' parameter names should be in lowerCamelCase .
2 Likes
Taifun
February 9, 2021, 5:34pm
3
thank you for your contribution, keep up the good work!
as @MohamedTamer already mentioned, please follow the naming conventions, adjust the extension accordingly and republish it
also all your methods are about Calculating something, which means, you could remove the term Calculate to get shorter methods blocks... for example Acceleration rather than CalculateAcceleration or GravitationalPotentialEnergy rather than CalculateGravitationalPotentialEnergy
Taifun
Trying to push the limits! Snippets , Tutorials and Extensions from Pura Vida Apps by Taifun.
4 Likes
Nice extension, but it would be better if you attach an aia. for the test.
1 Like
You can upload the extension into an app and test it out.
1 Like
gordonlu310:
Nice extension
Thanks...!
The extension is really easy to use.
1 Like
Great extension! I have learned more about creating extensions.
1 Like
By using double instead of integer the calculations can be done with results with decimals.
Rewriting your functions, I would suggest this.
@SimpleFunction(description = "Density")
public double Density(double mass, double volume) {
if (volume != 0) {
return mass / volume;
} else {
return 0; // Handle division by zero case
}
}
@SimpleFunction(description = "Volume")
public double Volume(double mass, double density) {
if (density != 0) {
return mass / density;
} else {
return 0; // Handle division by zero case
}
}
@SimpleFunction(description = "Mass")
public double Mass(double density, double volume) {
return density * volume;
}
@SimpleFunction(description = "Speed")
public double Speed(double distance, double time) {
if (time != 0) {
return distance / time;
} else {
return 0; // Handle division by zero case
}
}
@SimpleFunction(description = "Distance")
public double Distance(double time, double speed) {
return time * speed;
}
@SimpleFunction(description = "Acceleration")
public double Acceleration(double initialVelocity, double finalVelocity, double time) {
if (time != 0) {
return (finalVelocity - initialVelocity) / time;
} else {
return 0; // Handle division by zero case
}
}
@SimpleFunction(description = "Retardation")
public double Retardation(double initialVelocity, double finalVelocity, double time) {
if (time != 0) {
return (initialVelocity - finalVelocity) / time;
} else {
return 0; // Handle division by zero case
}
}
@SimpleFunction(description = "Force")
public double Force(double mass, double acceleration) {
return mass * acceleration;
}
@SimpleFunction(description = "Pressure")
public double Pressure(double force, double area) {
if (area != 0) {
return force / area;
} else {
return 0; // Handle division by zero case
}
}
@SimpleFunction(description = " Heat Absorbed By An Object")
public double HeatAbsorbed(double massOfObject, double relativeHeat, double changeOfTemperature) {
return massOfObject * relativeHeat * changeOfTemperature;
}
@SimpleFunction(description = "Power")
public double Power(double workDone, double time) {
if (time != 0) {
return workDone / time;
} else {
return 0; // Handle division by zero case
}
}
@SimpleFunction(description = "Work Done")
public double WorkDone(double force, double displacement) {
return force * displacement;
}
@SimpleFunction(description = "Kinetic Energy")
public double KineticEnergy(double mass, double velocity) {
return 0.5 * mass * velocity * velocity;
}
@SimpleFunction(description = "Gravitational Potential Energy")
public double GravitationalPotentialEnergy(double mass, double g, double height) {
return mass * g * height;
}