rks4_1 - % to get the total salary total_salary =...

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

View Full Document Right Arrow Icon
%Engineering 6, Winter 2006, Problem 4.1 %Raminderdeep Sidhu, 7987 %Section A01, Thursday 8- 8:50 % Hourly wage, hours worked, output (no. of items) for each worker in one % week f five workers us stored in the array. Based on the given % information this program performs % following operations. clear; clc; fprintf('\n') % Vector creation for hourly wage, hours worked, output hourly_wage = [5.00, 5.50, 6.50, 6.00, 6.25]; % Hourly wage for five workers hours_worked = [39, 43, 37, 51, 45]; % Hours worked by each worker output = [1050, 900, 1000, 1250, 1100]; % Number of items produced % by each worker % Multiplying element by element of arrays to get the money earn by each % worker money_earned = hourly_wage.* hours_worked; % .* represents the % multiplication of matrix fprintf(' Money earn by each worker:\n') fprintf(' $%.2f\n', money_earned) % Multiplying element by element of array hourly worked and hours worked
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % to get the total salary total_salary = sum(money_earned); fprintf('\n') fprintf(' Total salary $%.2f paid out\n', total_salary) % elements of array C are added to get the total number of items total_items = sum(output); fprintf('\n') fprintf(' Total %.0f items made\n', total_items) % total salary is divided by total items average_cost = total_salary./total_items; fprintf('\n') fprintf(' Average cost $%.3f to produce one item\n', average_cost) % total hours are divided by total items total_hours = sum(hours_worked); average_for_item = (total_hours./total_items); fprintf('\n') fprintf(' %.3f hours to produce one item\n', average_for_item) % Calculating the efficiency defined as output divided by hours worked efficiency = output./hours_worked; fprintf('\n') fprintf(' Efficiency of each worker:\n') fprintf(' %.1f\n', efficiency) fprintf('\n')...
View Full Document

This note was uploaded on 04/21/2010 for the course ENGINEERIN 87897 taught by Professor Noclue during the Spring '07 term at UC Davis.

Ask a homework question - tutors are online