Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

please i need help for this assignment !!

Asked by chris on 22 Dec 2012

Please can you help me with this assignment?

  1. Write a MATLAB script which prompts the user to enter his/her day of birth and then month of birth.
  2. If the day or/and month are not valid, the user should be asked to try until he/she enters valid data or the max Number of trials is exceeded
  3. When the data are valid, Matlab should display on the screen the sign of the zodiac of the user using this following table:
aries:march 21 - april 19 .
taurus: april 20 - may20 .
gemini: may 21 - june 20 .
cancer: june21 - july 22 .
leo:july23 - aug 22 .
virgo:aug 23 - sep 22 .
libra : sep 23 - oct 22.
scorpio: oct 23 -nov 21 .
sagittarius: nov 22 - dec 21 .
capricorn : dec 22 - jan 19 .
aquarius : jan 20 - feb 18 .
pisces : feb 19 - march 20.

1 Comment

Walter Roberson on 22 Dec 2012

Please read the guide to tags and retag this question. see http://www.mathworks.co.uk/matlabcentral/answers/43073-a-guide-to-tags

chris

Products

No products are associated with this question.

1 Answer

Answer by Image Analyst on 22 Dec 2012

Use inputdlg() to get the month and day numbers from the user. The help has examples. Then use a bunch of if statements to determine which zodiac sign to assign, for example

DateNumber = datenum(2012,M,D); % Get serial date number
if DateNumber .....

and so on

2 Comments

proecsm on 22 Dec 2012

or use a case structure

Walter Roberson on 22 Dec 2012

It can be done without "if" or "case", by using histc() to find the bin.

Image Analyst

Contact us