Define the following variables matlab tableprice 25695 chai
Define the following variables: matlab
table_price = $256.95
chair_price = $89.99
Then change the display format to bank and:
a. Evaluate the cost of two tables and eight chairs.
b. The same as part a., but add 5.5% sale tax.
c. The same as part b., but round the total cost to the nearest dollar.
Solution
%Define the following variables: matlab
% table_price = $256.95
% chair_price = $89.99
clear all;
close all;
table_price = 256.95;
chair_price = 89.99;
%Then change the display format to bank and:
format bank;
%Results Currency format with 2 digits after the decimal point.
%a. Evaluate the cost of two tables and eight chairs.
cost = (2*table_price)+(8*chair_price);
disp(cost);
%b. The same as part a., but add 5.5% sale tax.
costwithtax = cost*(1.055);
disp(costwithtax);
%c. The same as part b., but round the total cost to the nearest dollar.
roundedcostwithtax = round(costwithtax);
disp(roundedcostwithtax);
