# We Helped With This MATLAB Programming Homework: Have A Similar One?

SOLVED
Category Programming MATLAB Undergraduate Solved Do My Engineering Homework

## Short Assignment Requirements

There 5 questions which are 1a 1b 2a 2b 3.do the first part minilab, do not worry about a second part called quiz. I need a pdf and m file.

## Assignment Description

ENG 006 — Engineering Problem Solving

Lab 4

Objectives:

Random number generators, if-else statements, switch-case statements.

Instructions for each lab are will be on the Canvas. They will be available at the beginning of each lab. The labs last for 50 minutes. The last 20 minutes will be allocated for the quiz, while the first 30 minutes will be for the mini project.

You can talk during the mini project and use class notes.

During the quiz you cannot talk or use notes.

Students must submit their mini project files within 24 hours.

Quizzes must be submitted before the end of the lab period.

### Part 1: Mini Project

Work by yourself or other group members on this project. It’s okay if you don’t finish here, you have 24 hours to submit your lab. Submit your work as a PDF file using the publish feature in Matlab and .m file on Canvas when you are done. Run your code before publishing.

Open a new script and work in it. HOME >> New Script (or Ctrl + N)

% First Name: <Your First Name>

% Last Name: <Your Last Name>

Please read: Submit a solution for each problem. All solutions must be in a single m-file. Divide each question into separate sections using the %% operator.  The double percent sign (%%) and a space in the m-file makes a publishable section. You should see that all your problems are divided into sections in the PDF file.

Problem 1a:

In this problem, you are going to create a script that takes any integer number as input and returns a message indicating whether the number is odd, even, or zero. Use the function input() to read in the  number that the user enters at run-time. You must use if-else statements to check and display the messages.

Problem 1b:

Repeat problem 1a but use switch-case statements instead of if-else statements.

Problem 2a:

In this problem, you are going to write a simple dice game. The winning numbers of the dice consist of three random integer numbers between 1 and 6 (see documentations of randi() and randperm() functions). Your code should ask the player to input/guess 3 integer numbers between 1 and 6 (use input() function as described in Problem 1a). When the user enters all the numbers, your code should compare the user’s numbers with the winning numbers and display a message that shows how many of them match and much the user has earned. You must use if-else statements to check and display the messages. You can use logical indexing with sum function to find how many numbers match. The player doesn’t have to guess the order of numbers that are randomly generated and numbers can be repeated.

If they match all 3 numbers, they win \$1000.

If they match any 2 numbers, they win \$10.

If they match only 1 number, they win \$1.

If they don’t match any number, they win nothing.

The messages that display in the command window should look similar to the examples below:

You matched all 3 numbers! You won \$1000! You could not guess any numbers! You lose!

Problem 2b:

Repeat problem 2a but use switch-case statements instead of if-else statements.

Problem 3:

For this problem, you are going to make a program that determines whether a triangle is a right, equilateral, isosceles, or “other” kind of triangle. Your code should ask the user to input 3 integer numbers (representing the sides of the triangle) and display a message indicating what type of triangle it is. You can use either if-else or switch-case statements.

### Part 2: Quiz

If you’ve already finished part 1, use your remaining time to prepare for the quiz on Canvas. Don’t forget to double check your file uploads for part 1.

Customer Feedback

"Thanks for explanations after the assignment was already completed... Emily is such a nice tutor! "

Order #13073

Find Us On