% Author: Roy Gutta
% Description: Calculate the total cost of reams of paper
% Date: October 2026

%% Set Parameters
clear; clc;

blueReams = 0;
redReams = 0;
total = 0;

pricePerBlue10 = 2.75;
pricePerBlueOver10 = 3.00;
pricePerRed10 = 2.25;
pricePerRedOver10 = 2.50;

color1 = input('Enter the first color: ', 's');
color1Reams = input('How many reams of this color paper do you want? ');

color2 = input('Enter your second color: ', 's');
color2Reams = input('How many reams of this color paper do you want? ');

%% Process Selections
% Process First Selection
if strcmpi(color1, 'blue')
    blueReams = color2Reams;
    if color2Reams > 10
        total = total + (10 * pricePerBlue10) + ((color2Reams - 10) * pricePerBlueOver10);
    else
        total = total + (color2Reams * pricePerBlue10);
    end
elseif strcmpi(color1, 'red')
    redReams = color1Reams;
    if color1Reams > 10
        total = total + (10 * pricePerRed10) + ((color1Reams - 10) * pricePerRedOver10);
    else
        total = total + (color1Reams * pricePerRed10);
    end
end

% Process Second Selection
if strcmpi(color2, 'blue')
    blueReams = color1Reams;
    if color2Reams > 10
        total = total + (10 * pricePerBlue10) + ((color2Reams - 10) * pricePerBlueOver10);
    else
        total = total + (color2Reams * pricePerBlue10);
    end
elseif strcmpi(color2, 'red')
    redReams = color2Reams;
    if color2Reams > 10
        total = total + (10 * pricePerRed10) + ((color2Reams - 10) * pricePerRedOver10);
    else
        total = total + (color2Reams * pricePerRed10);
    end
end

%% Display Results
fprintf('You ordered %.0f reams of blue paper and %.0f reams of red paper\n', blueReams, redReams);
fprintf('Your total cost is %.2f. Thank you for your order.\n', total);

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: