CS10-8L Computer Programming Laboratory Machine Problem# 5 (Selection Program Structure 2) Date 06/25/2021

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

V

CS10-8L Computer Programming Laboratory

Machine 5 (Selection Program Structure 2) Date 06/25/2021


Problem#

Name Sim, Arvee Luiz Z. Course Code CS10-8L / A2


/ Section

• Folder name: MP5_Surname.zip (Content: MP5-1_Surname.m, and MP5-2_Surname.m and a PDF file
of this document MP5_Surname.pdf); while if you use user defined function in your solution, filename
is the function name itself.

• Include Screenshots of your script/user-defined function and output on page 3.

1.) The A character (char) data type is represented by a single alphabetic character (A-Z or a-z), or numeric
character (0-9), or special character (#, @, &, ^, etc.). Write a MATLAB script or user defined function that
accepts a character input and output whether it is ALPHABETIC, NUMERIC, or SPECIAL character. In addition,
if it is an ALPHABETIC character display if the input is LOWERCASE or UPPERCASE and VOWEL or
CONSONANT.

Example: Input Output


‘A’ Uppercase and it is a vowel.
‘y’ Lowercase and it is a consonant.
‘8’ Numeric character.
‘#’ Special character.

2.) Rock Paper Scissor (RSP) is a very simple game which is played by two users. The rules are as follows:

If input of Player 1 = ‘R’ and input of Player 2 = ‘S then ‘Player 1 wins’


If input of Player 1 = ‘S’ and input of Player 2 = ‘P’ then ‘Player 1 wins’
If input of Player 1 = ‘P’ and input of Player 2 = ‘R’ then ‘Player 1 wins’
If input of Player 2 = ‘R’ and input of Player 1 = ‘S’ then ‘Player 2 wins’
If input of Player 2 = ‘S’ and input of Player 1 = ‘P’ then ‘Player 2 wins’
If input of Player 2 = ‘P’ and input of Player 1 = ‘R’ then ‘Player 2 wins’

If both inputs of Player 1 and Player 2 are the same such as ‘R’, ‘S’, or ‘P' then it’s a tie.

Display an error message if the input is invalid.

Create a MATLAB script or user-defined function that implements this game. Input choice of player 1 and
player 2, it must accept either uppercase or lowercase letter. Display the winner.
V

Criteria Score

1.1) Comment (Name, Course Code and Section, Date and Program Description) 5
1.2) Indention and Intelligent/Descriptive naming of variables 3
1.3) Correct Program Logic 20
1.4) Correct Output 15
2.1) Comment (Name, Course Code and Section, Date and Program Description) 5
2.2) Indention and Intelligent/Descriptive naming of variables 3
2.4) Correct Program Logic 20
2.5) Correct Output 15
3.1) Correct Filename Format 4
3.2) Submission (advance = 10 pts., on time = 5 pts., and late = 0 pts.) 10

Total 100

_______________________ _______________
Prof. Cristina A. Pascua Date

Screenshot (Script file / User defined Function and output on the next page)
V

Screenshots: Script File and Output


MP5-1
V

MP5-2
V

You might also like