C- Computer QuestionsExam 1

C- Computer QuestionsExam 1 - character string, including a...

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

View Full Document Right Arrow Icon
Computer Question 1: Plot and Subplot 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 0 to 10. Title and label both the x and y axes of your graph. a) y = x 2 b) y = x 3 c) y = (x- 5) 3 d) y = 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. As you test your program, remember to enter the employee’s name as a
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: 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 Computer Question 3: Finding the 3 largest elements 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 50 (in increments of 0.5), display the following 3-D surface using the surf command. Turn the grid on. z = x*cos(y)/5 Your surface should look something like this:...
View Full Document

This note was uploaded on 02/29/2012 for the course 440 127 taught by Professor Blase during the Fall '09 term at Rutgers.

Page1 / 2

C- Computer QuestionsExam 1 - character string, including a...

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