Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please write it in HLA not C programming language! For a pyramid, a cone or a cy

ID: 3918776 • Letter: P

Question

Please write it in HLA not C programming language!

For a pyramid, a cone or a cylinder, their volumes can be computed from the parameters b, r and h, as shown below:

Volume = pi * r * r * h

Write an HLA Assembly language program that computes and then prints the volume of a pyramid, cone and cylinder based on a radius r, a length b and a height h by writing a function with the following signature:

A sample program dialogue is shown below.

Lemme calculate the volumes of various things!
Gimme r: 1.0
Gimme b: 1.0
Gimme h: 1.0
Volume of a pyramid = 0.33333
Volume of a cone = 1.04719
Volume of a cylinder = 3.14159

Lemme calculate the volumes of various things!
Gimme r: 1.0
Gimme b: 1.0
Gimme h: 3.0
Volume of a pyramid = 1.00000
Volume of a cone = 3.14159
Volume of a cylinder = 9.42477

Lemme calculate the volumes of various things!
Gimme r: 2.0
Gimme b: 1.0
Gimme h: 3.0
Volume of a pyramid = 1.00000
Volume of a cone = 12.5663
Volume of a cylinder = 37.6991

Pyramid Cone Cylinder Volume = 1 / 3 * b * h Volume = 1/ 3 * pi * r * r h

Volume = pi * r * r * h

Explanation / Answer

I have did a coding to calculate the volume of the cone: HLA

program volume;
#include( "stdlib.hhf" );
static
radius : real32; height : 32;

procedure volumeFinder( r: real32; h : real32 ); @nodisplay; @noframe;
static
returnAddress : dword;
v : real32;

begin volumeFinder;

pop(returnAddress);
pop(r);
push(returnAddress);

pop(returnAddress);
pop(h);
push(returnAddress);

finit();
fld( r );
fld( st0 ); // copies the value of the previous stack
fld( h );
fmul();

fldpi();
fld(0.3); .
fmul();

fmul();

fstp( v );
stdout.putr32(v, 10, 4);// z the floating point value with the width and number of digital points
ret();
end volumeFinder;

begin volume;

stdout.put("Lemme calculate the volumes of cone!", nl);//n1 is new line
stdout.put("Gimme r: ");stdout.put("Gimme h: ");
stdin.get(radius);stdin.get(height);
stdout.put("Volume of cone is: ", nl);
call volumeFinder;

end volume;

Similarly this could be done for the remaining both.