Define state as a cell array containing the state names

Assignment Help Other Subject
Reference no: EM133129895

PSYCH 20A MATLAB Programming for Behavioral Sciences - University of California

This program gives the user a quiz on state capitals, in alphabetical order by state, and then reports their score.

• Begin your script with opening comments that briefly describe what the program does and include your name and the date.

• Then clear the variables from the workspace.

• Then clear the command window.

• Then input the data from usStates.csv into a table called stateCapitalTable.

• Divide the rest of your script into 4 sections with prominent headings: INPUT NUMBER OF STATES, DEFINE QUIZ ITEMS, GIVE QUIZ, REPORT SCORE.

In the INPUT NUMBER OF STATES section:

• Get keyboard input from the user, using the following prompt (with a space after the colon):
Enter the number of states to include on the quiz:

• That keyboard input should be collected inside a while-loop so that the user is prompted over and over until they give a valid response (an integer between 1 and 50). HINT: Use the ismember function in the while-statement.

In the DEFINE QUIZ ITEMS section:

• Define state as a cell array containing the state names, and define capital as a cell array containing the respective capitals of those states. These cell arrays should only include the requested number of items. For example, if the user requested 5 states to be included on the quiz, then the state and capital vectors should only contain the first 5 states and the first 5 capitals (respectively), extracted from stateCapitalTable.

In the GIVE QUIZ section:

• Initialize a cell array called response to hold the user's responses.

• Initialize a logical vector called scoreCard to hold true/false values indicating whether each answer is correct or incorrect, respectively. You can initialize this vector as all false values by using the false function (which works just like the ones or zeros function).

• Use a for-loop to give the quiz and collect the responses. Each prompt should be in the form of a question (with a space after the question mark). For example, the first prompt should be:
What is the capital of Alabama?

• After each question, display ‘Correct!‘ if the answer is correct, or ‘Incorrect!‘ if the answer is incorrect, in the command window. Consider empty answers as incorrect.

• If the user types the word stop (using any capitalization) in response to any quiz question, display ‘Quiz aborted‘ in the command window, and then abort the program immediately (without reporting ‘Incorrect!‘, without asking any more questions, and without executing anything in the REPORT SCORE section).

In the REPORT SCORE section:

• After the last question (if the quiz wasn't aborted), display the user's score in the command window as the number correct out of the number of items, followed by the percent correct rounded to 1 decimal place in parentheses. For example, if the user got 7 out of 8 items correct, the report should say:

You got 7 out of 8 answers correct (87.5%).

Attachment:- MATLAB Programming.rar

Reference no: EM133129895

Questions Cloud

Determine the amount of the fringe benefits cost : Gibson Services Company has 52 employees, 31 of whom are assigned to Division A and 21 to Division B. Determine the amount of the fringe benefits cost
Annual income-tax savings : An industrial firm is considering purchasing several programmable controllers and automating their manufacturing operations. It is estimated that the equipment
What is the value of the firm : The owner of a firm expects to make a profit of $100 for each of the next two years and to be able to sell the firm at the end of the second year for $800.00. T
How might your knowledge of the scarcity concept : How might your knowledge of the scarcity concept help you make better choices both now and in the future? Provide an explanation for your view.
Define state as a cell array containing the state names : Define state as a cell array containing the state names, and define capital as a cell array containing the respective capitals of those states
Create a numeric example and an economic graph : Explain what happens to Average Fixed Costs when 0 increases. Create a numeric example AND an economic graph to support your answer.
What will happen to the firm current ratio : The King Carpet Company has $2,830,000 in cash and a total of $12,070,000 in current assets. What will happen to the firm current ratio
Explain total cost curve and the total variable cost curve : What is the distance between the total cost curve and the total variable cost curve? Explain and include a graph in your answer.
What is the proper use of eminent domain : 1) What is the proper use of Eminent Domain, where is this power found?

Reviews

Write a Review

Other Subject Questions & Answers

  Explain the role that challenge administrators play in osha

Discuss the benefits that OSHA alliances provide to employers and workers in general industry. Describe the role that Challenge Administrators play in the OSHA Challenge voluntary cooperative program.

  Ethics important to public safety organization

Are codes of ethics important to a Public Safety organization? Why or why not? Do you view a code of ethics as being realistic or idealistic and why?

  Describe the clinical findings that may be present

Discuss the questions that would be important to include when interviewing a patient with this issue. Describe the clinical findings that may be present.

  What is the value of using carefully selected terminology

What is the value of using carefully selected terminology for operations in the homeland? How does the symbolism of IAA potentially aid homeland security.

  Competition create incentives

Market forms and increased competition create incentives to use resources efficiently and increase the quality of the services provided.

  What is the equilibrium constant for reaction

b.) What is n? c.) What is delta G for this reaction at 25 degrees Celsius? d.)  What is the equilibrium constant for this reaction at 25 degrees Celsius?

  What is the bdi

What is the BDI? What does it do? Do you see CBT technique as being helpful for Depression? Why? Why not?

  Discuss how incidents or accidents have been brought

discuss how incidents or accidents have been brought about due to bad maintenance practices in the aviation industry.

  Describe the historical context of the period

Analyze how this work explores a particular theme and/or stylistic characteristic from its period. Describe the historical context of the period

  Develop a summary of the given scenario

Develop a summary of the given scenario. Which business organizational form would be best given the above circumstances, and why?

  How will changing policy affect clinical social workers

How will changing this policy affect clinical social workers or the clients of clinical social workers? Provide an update on the advocacy activities your.

  Customer tracking systems project

Pine Valle furniture's customer tracking systems project is now ready to move into the system design phase. You are excited because this phase involves designing the new system's forms, reports and database

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd