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

Ok here is the information pertaining to the problem. Also I\'m not sure why Tot

ID: 1814015 • Letter: O

Question

Ok here is the information pertaining to the problem. Also I'm not sure why TotalVolume, Vcone & Vcylinder are even needed but we are required to have them. Also the ifelse statements arent getting applied and it's just automatically doing TotalCost=(400*SAcone)+(300*SAcylinder)+(300*SAcylinderbase);


A containing tank is to be constructed that will hold oil when filled. The shape of the tank is to be a cylinder (including a base) surmounted by a cone (i.e., with a conical top). The cone's height is always equal to its radius which is also the radius of the cylinder. The cost to construct the cylinder portion of the tank is $300 per square meter while the cost for the cone portion is $400 per square meter. Write a function that takes two inputs (TotalVolume and r) and calculates and displays the total cost of constructing the tank. For this problem, when TotalVolume = 500 and r=1.0-7.0 in steps of 0.1. Use the variables listed below.

Explanation / Answer

Here is the corrected code of yours


HOpe its works

TotalVolume = input('Enter the Total Volume: ');


i=1:0.1:7;

k=1;

for r=i

Vcone = (1/3).*(pi).*(r.*r.*r);

Vcylinder = pi.*(r.*r.*h);

SAcone = pi*sqrt(2).*(r.*r);

SAcylinder = 2*pi.*r.*h;

SAcylinderbase = pi.*(r.*r);


if (SAcylinderbase+SAcylinder > 200)

TotalCost(k)=((300*SAcylinder)+(300*SAcylinderbase))*.9 + (400*SAcone)

%TotalCost=((400*SAcone)+(300*SAcylinder)*0.9)+(300*SAcylinderbase);

elseif (SAcone > 100)

TotalCost(k)=(400*SAcone*.8)+(300*SAcylinder)+(300*SAcylinderbase);

elseif (SAcone > 100 & SAcylinderbase+SAcylinder > 200)

TotalCost(k)=((400*SAcone*.8)+(300*SAcylinder)*0.9)+(300*SAcylinderbase*.9);

elseif (SAcone <= 100 & SAcylinderbase+SAcylinder <= 200)

TotalCost(k)=(400*SAcone)+(300*SAcylinder)+(300*SAcylinderbase);

end

k=k+1;

end


figure

plot(r,TotalCost);

xlabel('Radius');

ylabel('Cost');

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote