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

  Cross-cultural opportunities and conflicts in canada

Short Paper on Cross-cultural Opportunities and Conflicts in Canada.

  Sociology theory questions

Sociology are very fundamental in nature. Role strain and role constraint speak about the duties and responsibilities of the roles of people in society or in a group. A short theory about Darwin and Moths is also answered.

  A book review on unfaithful angels

This review will help the reader understand the social work profession through different concepts giving the glimpse of why the social work profession might have drifted away from its original purpose of serving the poor.

  Disorder paper: schizophrenia

Schizophrenia does not really have just one single cause. It is a possibility that this disorder could be inherited but not all doctors are sure.

  Individual assignment: two models handout and rubric

Individual Assignment : Two Models Handout and Rubric,    This paper will allow you to understand and evaluate two vastly different organizational models and to effectively communicate their differences.

  Developing strategic intent for toyota

The following report includes the description about the organization, its strategies, industry analysis in which it operates and its position in the industry.

  Gasoline powered passenger vehicles

In this study, we examine how gasoline price volatility and income of the consumers impacts consumer's demand for gasoline.

  An aspect of poverty in canada

Economics thesis undergrad 4th year paper to write. it should be about 22 pages in length, literature review, economic analysis and then data or cost benefit analysis.

  Ngn customer satisfaction qos indicator for 3g services

The paper aims to highlight the global trends in countries and regions where 3G has already been introduced and propose an implementation plan to the telecom operators of developing countries.

  Prepare a power point presentation

Prepare the power point presentation for the case: Santa Fe Independent School District

  Information literacy is important in this environment

Information literacy is critically important in this contemporary environment

  Associative property of multiplication

Write a definition for associative property of multiplication.

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