Homework #2
All problems must be in a single *.m file and be in separate blocks using '%% Problem X'. You will need additional files for the various functions and class definitions. See class webpage for naming convention.
Contents
Problem 1
Create a 'struct' type variable named 'Student' that has fields: 'Name', 'Major', 'Year'. Build the struct with your information ('Year' is 'Freshman', etc.). Suppress output when building the struct. When complete, display 'Student' in the command window.
Problem 2
Repeat Problem 3 of HW1, but this time use a 'while' loop and a function that reproduces exactly the functionality of MATLAB's 'isprime' function. This should be called 'LastName_HW2_isprime'. Do not use any high-level MATLAB built in functions in your code (such as 'factor'). Simple math functions are OK (such as 'round', 'mod'). Output the list of primes to the command window as a 10 x 1 matrix.
Problem 3
Create a 'class' called 'LastName_HW2_MathOps'. The class should have two properties 'A', and 'B'. The class should also have three methods 'AB_Add', 'AB_Mult', 'AB_Sub'. These should perform the cooresponding operations using 'A' and 'B'.
Create an object of the class, set A=4, B=2 and call all three methods with un-suppressed output.