Gas_Price - fprintf('Your cost will be $%1.2f', cost) case...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
% Jeremy Debruce % This program will calculate the price of gas. clc % Defined Variables Gas = input('Do you Want gas in Liters or Gallons?. Enter in sigle qoutes. ') switch Gas case 'Gallons' Gas=2.00; g = input('Enter the amount of gas? ') cost = g*Gas;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: fprintf('Your cost will be $%1.2f', cost) case 'Liters' Gas=2.00; l = input('Enter the amount of gas? ') cost = l*(Gas*3.7854); fprintf('Your cost will be $%1.2f', cost) otherwise('Your gas price cannot be calculated.') end...
View Full Document

This note was uploaded on 06/17/2011 for the course COMP 1200 taught by Professor Staff during the Spring '11 term at Kennesaw.

Ask a homework question - tutors are online