[FREE/Open Source] PhysicsCalculator - Extension

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



image

Open Source

Download

xyz.nisarga.PhysicsCalculator.aix (6.2 KB)

9 Likes

Nice work :+1: Please follow the naming conventions as well :

Methods' parameter names should be in lowerCamelCase.

2 Likes

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 icon24 Taifun.

4 Likes

Nice Extension :innocent: :+1:

1 Like

Wow, :heart_eyes:Nice Extension. Good job :smile: :+1:

1 Like

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

Thanks...!

The extension is really easy to use.

1 Like

Maybe yep...

1 Like

Great extension! I have learned more about creating extensions.

1 Like

Pretty nice!

Thanks :slight_smile:

Thanks!

1 Like

Heart warming!

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;
    }