Answered Essay: Your company produces spherical tanks. You are tasked to create code using fprintf that will o

Problem 2: Your company produces spherical tanks. You are tasked to create code using fprintf that will output formatted tables that indicate the mass of fluid contained in the tank for various tank diameters, liquid levels, and liquid densities. The code should prompt the user for: DTANK The minimum diameter, maximum diameter, and number of diameters to be considered The number of water levels to be considered The minimum density, maximum density, and number of densities to be considered * . Your code should output a table for each tank diameter in the series. Each row of the table must correspond to a certain fluid density, and each column in the table will correspond to a certain water level WATER Format your code to generate output similar to the sample output. In the sample, diameters range from tanks 2 to 4 meters, densities range from 500 to 1500 kg/mA3, and 5 water heights are tabulated.

Your company produces spherical tanks. You are tasked to create code using fprintf that will output formatted tables that indicate the mass of fluid contained in the tank for various tank diameters, liquid levels, and liquid densities. The code should prompt the user for: The minimum diameter, maximum diameter, and number of diameters to be considered The number of water levels to be considered The minimum density, maximum density, and number of densities to be considered Your code should output a table for each tank diameter in the series. Each row of the table must correspond to a certain fluid density, and each column in the table will correspond to a certain water level. Format your code to generate output similar to the sample output. In the sample, diameters range from tanks 2 to 4 meters, densities range from 500 to 1500 kg/mA3, and 5 water heights are tabulated.

Expert Answer

 

Program screenshots:

clear all; %Prompt the user to enter the values num dia- input (Enter number of diameters:); min dia - input (Enter minimum diameter: max dia - input (Enter maximum diameter: %Split the diameter values and store in the vector. diameter-linspace (min dia, max dia, num dia); %Prompt the user to enter the values num density - input(Enter number of densities: ) min density- input (Enter minimum density: ); max density = input (Enter maximum density: ); %split the density values and store in a vector density -linspace (min_density, max_density, num density); num levels - input (Enter number of water levels: ); mass 0; Start the loop to print the table for 1 1 : numel (diameter) %Print the table headings fprintf(nTank Diameter = %. 1 f metersnrho/H ?n, diameter (i)); Compute the start value oI the columns Start- diameter (i) /num levels; Split the number of levels and store in the vector level linspace (Start, diameter (i), num levels)

Sample output:

Code to copy:

clc;

clear all;

%Prompt the user to enter the values.

num_dia = input(‘Enter number of diameters: ‘);

min_dia = input(‘Enter minimum diameter: ‘);

max_dia = input(‘Enter maximum diameter: ‘);

%Split the diameter values and store in the vector.

diameter = linspace(min_dia, max_dia, num_dia);

%Prompt the user to enter the values.

num_density = input(‘Enter number of densities: ‘);

min_density = input(‘Enter minimum density: ‘);

max_density = input(‘Enter maximum density: ‘);

%Split the density values and store in a vector.

density = linspace(min_density, max_density, num_density);

num_levels = input(‘Enter number of water levels: ‘);

mass = 0;

%Start the loop to print the table.

for i = 1:numel(diameter)

 

%Print the table headings.

fprintf(‘nTank Diameter = %.1f metersnrho/H n’, diameter(i));

 

%Compute the start value of the columns.

Start = diameter(i)/num_levels;

%Split the number of levels and store in the vector.

level = linspace(Start, diameter(i), num_levels);

%Set the whitespaces between the values.

levelPrint = sprintf(‘%.1fttt’, level);

fprintf(‘ttt%snn’, levelPrint)

fprintf(‘—————————————————————————————-n’);

%Start the loop to fill the table.

for j = 1:numel(density)

fprintf(‘%4d|’, density(j));

 

%Start the loop to compute the mass.

for k = 1:numel(level)

Radius = diameter(i) / 2;

height = level(k);

%Compute the volume and mass.

volume = (pi*height^2*(3*Radius – height)) / 3;

mass(j, k) = density(j) * volume;

%Print the mass.

fprintf(‘tt%4.0f’, mass(j, k));

end

fprintf(‘n’);

end

fprintf(‘n’);

end

Buy Essay
Calculate your paper price
Pages (550 words)
Approximate price: -

Help Me Write My Essay - Reasons:

Best Online Essay Writing Service

We strive to give our customers the best online essay writing experience. We Make sure essays are submitted on time and all the instructions are followed.

Our Writers are Experienced and Professional

Our essay writing service is founded on professional writers who are on stand by to help you any time.

Free Revision Fo all Essays

Sometimes you may require our writers to add on a point to make your essay as customised as possible, we will give you unlimited times to do this. And we will do it for free.

Timely Essay(s)

We understand the frustrations that comes with late essays and our writers are extra careful to not violate this term. Our support team is always engauging our writers to help you have your essay ahead of time.

Customised Essays &100% Confidential

Our Online writing Service has zero torelance for plagiarised papers. We have plagiarism checking tool that generate plagiarism reports just to make sure you are satisfied.

24/7 Customer Support

Our agents are ready to help you around the clock. Please feel free to reach out and enquire about anything.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

HOW OUR ONLINE ESSAY WRITING SERVICE WORKS

Let us write that nagging essay.

STEP 1

Submit Your Essay/Homework Instructions

By clicking on the "PLACE ORDER" button, tell us your requires. Be precise for an accurate customised essay. You may also upload any reading materials where applicable.

STEP 2

Pick A & Writer

Our ordering form will provide you with a list of writers and their feedbacks. At step 2, its time select a writer. Our online agents are on stand by to help you just in case.

STEP 3

Editing (OUR PART)

At this stage, our editor will go through your essay and make sure your writer did meet all the instructions.

STEP 4

Receive your Paper

After Editing, your paper will be sent to you via email.