Question: Your Own Program - Metric Flash Cards Metric Flash Cards This assignment is individual work. Submissions will be uploaded to a plagiarism - checking website
Your Own Program Metric Flash Cards Metric Flash Cards
This assignment is individual work. Submissions will be uploaded to a plagiarismchecking website to ensure that they are not copied from other students. Note that simply changing variable names and comments will not fool the software.
You should complete Metric Flash Cards Initial Check first, though the "Hints" section of this assignment will be useful for completing that one. All the code you write for that assignment will be useful in this main assignment, though different parts of the Initial Check function will go into different locations in your main program. Initial check will be a function, but your main program should be a script!
Background
You are a programmer and engineer with a passion for students in the Natural Sciences. To help high schoolers get ready for their Physics exams, PhayEt County Public Schools has commissioned you to create a computer program called Metric Flash Cards.
Per the school district's request, your program will be able to test students' knowledge of the metric prefixes milli mega etc. for as long as each student desires.
You have been provided with a spreadsheet listing prefixes, exponents for example, the exponent for milli is because milli multiplies by and abbreviations for use in the program. You can view or download the spreadsheet here: metricPrefixes.xsx downarrow
This file MUST be present for your program to function. You should not rename it Algorithm
The program should execute the following algorithm:
Inputs: metricPrefixes.xlsx spreadsheet, user input
Output: A sequence of questions and feedback as to whether each user answer is correct or incorrect, followed by a summary of the results.
Procedure:
Note: Some of the following steps are explained in more detail in the "Hints and Useful Information" section at the end of this assignment. If you're not sure how to do something, check there first!
Pull data from the given Excel Sheet into a Table object. This will contain three arrays, with the prefixes, their exponents, and their abbreviations.
Create two separate string arrays for the names and abbreviations of the prefixes, and a numeric array for their exponents.
Display the logo
Request the user to input how many prefixes they will review. This value should be read and stored as an integer.
Repeat the following steps for the number of prefixes requested:
Using the length of one of the arrays, generate a random integer that will represent the row number of a random prefix from the spreadsheet.
Find the name, abbreviation, and exponent of the prefix and store all three as variables.
Store the row number of the prefix in an array for later use when generating the summary.
Report the prefix's name to the user.
Prompt the user to input the abbreviation of the prefix.
If the input is correct, display a message of congratulations.
If the input is incorrect, display the correct answer. If the input is incorrect, display the correct answer.
Prompt the user to input the exponent of the prefix.
If the input is correct, display a message of congratulations.
If the input is incorrect, display the correct answer.
Pause the script for seconds to give the student a short break, then print a blank line.
Determine whether or not the user has reviewed any prefixes. If not, display a message which says: No prefixes were reviewed." Otherwise, display a score report as follows:
Display the start of the "SESSION REVIEW" block as displayed in the example.
Display the total number of prefixes reviewed.
Display the total number and percentage of abbreviations which the student inputted correctly.
Display the total number and percentage of exponents which the student inputted correctly.
Uniformly display the name, abbreviation, and exponent of each reviewed prefix.
Hints for This Step:
You should have already created an array which holds the row numbers of the reviewed prefixes.
Use a loop to iterate from to the length of this array, and look up the row number from that array.
Look up the name, abbreviation, and exponent in the same way as step
Use fprintf to format the strings and numbers, leftaligned. Use fprintf's "field width" feature to make the prefix names five characters wide s the abbreviation two characters wide, and the exponent three characters wide.
End the Session Review with a closing line for the block, as displayed in the example.
Display a message of thanks and end the program. Hints and Useful Information
Reading in the prefixes' information
Given the Excel sheet of three columns, you will need to read the values into your program as a twocolumn table object. You kind find more information about tables in the optional chapter of the ZyBook, specifically Loosely, this can be done using the following command:
metricTable readtablefileName;
The table contains a "field" for each of the three columns. The field is named after the header in row one of the spreadsheet: The three fields from our spreadsheet are called You shoul
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
