This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: %Engineering 6, Spring 2004, Problem 4.1 Solution %(Worker analysis and results) %Suppress extra lines in output and clear variables %and command window format compact; clear; clc; %Define vectors for the hourly wage, hours worked, and % output data. (Note: We could have created % an array for the whole table, but it's easier % to do it like this.) wage = [5.00 5.50 6.50 6.00 6.25]; hours = [39 43 37 51 45]; output = [1050 900 1000 1250 1100]; %(a) Calculate and display worker earnings for the week. % (We'll use two lines; it could be displayed all on one.) earnings = wage.*hours; fprintf( 'Earnings for each worker ($): \n' ); fprintf( '%8.2f' ,earnings); %(b) Calculate total payroll for the week. payroll = sum(earnings); fprintf( '\n\nTotal payroll: $%.2f\n\n' ,payroll); %(c) Calculate total items made. items = sum(output); fprintf( 'Total items made: %.0f\n\n' ,items); %(d) Average cost to produce one item. aveCost = payroll/items; fprintf( 'Ave. cost to make one item: $%.3f\n\n' ,aveCost); %(e) Average time to produce one item. aveTime = sum(hours)/items; fprintf( 'Ave. time needed to make one item: %.3f hours\n\n' ,aveTime); %(f) Efficiency of workers. efficiency = output./hours; fprintf( 'Efficiency of each worker in items per hour:\n' ); fprintf( '%8.1f' ,efficiency); fprintf( '\n' ); Displayed results: Earnings for each worker ($): 195.00 236.50 240.50 306.00 281.25 Total payroll: $1259.25 Total items made: 5300 Ave. cost to make one item: $0.238 Ave. time needed to make one item: 0.041 hours Efficiency of each worker in items per hour: 26.9 20.9 27.0 27....
View Full Document
- Spring '06
- Row, $0.238, $1259.25, 0.041 hours