F- Computer QuestionsExam 1

F- Computer QuestionsExam 1 - Labor Practices. As you test...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Computer Question 1: Plot Write Matlab code that displays the following four graphs next to each other (in one figure) as seen below. Let x contain 100 evenly spaced points, running from 1 to 10. Title and label both the x and y axes of your graph. a) y = log(x) b) y = e x c) y = e x+5 d) y = cos 2 (x) Computer Question 2: Paychecks You must calculate the salary for an employee. First, prompt the user to enter the name of the employee. Then, prompt the user to enter the number of hours worked this week. Then display (using fprintf) the following: “The employee, named ___, earned ____ dollars” (obviously, fill in the blanks) Workers are paid $30 an hour for the first 40 hours. They are then paid 50% more, or $45, for overtime (all hours worked in excess of 40 hours) each week. If the user enters a negative number for the number of hours worked, your program should instead display “Error- Negative Hours.” If the user enters a number greater than 120, your program should instead display “Violation of Fair
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Labor Practices. As you test your program, remember to enter the employees name as a character string, including a single quote at the beginning and end of the name. If youd like to verify your calculations, try the following values: 1 hour = $30, 2 hours = $60, 40 hours = $1200, 41 hours = $1245, 42 hours = $1290 -1 hours = Error, 120.5 hours = Violation of Fair Labor Practices Computer Question 3: Summing primes Write Matlab Code that calculates the sum of all of the prime numbers between 15 and 150: 17 + 19 + 23 + 29 + + 137 + 139 + 149 Note that you are not permitted to use a loop to solve this problem; you must use matrix / vector operations and functions. If you want to check your answer, the correct sum is 2235. Computer Question 4: Plotting a surface For both x and y running from 0 to 100 (in increments of 2), display the following 3-D surface using the surf command. Turn the grid on. z = y*sin(x)/5 Your surface should look something like this:...
View Full Document

Page1 / 2

F- Computer QuestionsExam 1 - Labor Practices. As you test...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online