GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

GradePack

List and describe 5 major trends of Romanticism reflected in…

List and describe 5 major trends of Romanticism reflected in Romantic Music and provide examples from the listening that illustrate these trends. Please be specific and use complete sentences. 10 points total.  

Read Details

If you wanted to see the effect of men’s facial hair on wome…

If you wanted to see the effect of men’s facial hair on women’s ratings of attractiveness, you could randomly assign different groups of participants to two different groups: one group rates a photo of a male with a full beard, and the other group rates a clean-shaven male. What type of experimental design is this?

Read Details

Common age-related changes that alter pharmacokinetics in ol…

Common age-related changes that alter pharmacokinetics in older adults include? Select all that apply.

Read Details

Define and describe the sonata-allegro form and all of its s…

Define and describe the sonata-allegro form and all of its sections (this means its 3 main sections as well as all of the subsections therein). (Please use complete sentences and be specific.)

Read Details

24 points –> DO NOT USE Upload a .c source file containing…

24 points –> DO NOT USE Upload a .c source file containing all necessary functions to implement the following program. Your program will implement a translator for a fake language to be used in a video game. You will prompt the user to enter a sentence, then display its translation. To this end, you will construct the resulting translation by concatenating the individual translation of each word. Your program will be organized as follows: Function translate_sentence will handle all the steps of translating a whole sentence, passed as a string parameter, and return the resulting translation. Function translate_word will be used by the above to translate one word into our fake language and return a string representing the translation. In order to translate any given English word, our function will simply measure the number of characters that it contains, and then return a copy of a translation string that will be found in an array containing, for each length of word between 1 and 8 characters, the fake language word to be used as translation. Any word longer than 8 characters will be translated as “AFGURNM”. If an empty string “” is being translated, the table will contain its translation at index 0 as “”. Here is the table you should be using: 1 “A” 5 “CETER” 2 “DO” 6 “SOLURE” 3 “TER” 7 “KELTRAM” 4 “QORA” 8 “OKENUFAL” Hint: Start with writing a version of the program that only asks for one word at a time and translate it. Once you get this to work, you may attempt to read an entire sentence and translate it, but it will be more difficult. When you are ready to work on that part, use strtok in order to get, from a sentence entered by the user, an array containing strings representing each of the words found in the sentence. If you do not remember the strtok function from your reading assignment, you are free to lookup its manpage. Example of Execution for the single-word translation version (user input is in bold) Enter a single word to translate: hello Translation is: CETER Enter a single word to translate: welcome Translation is: KELTRAM Enter a single word to translate: Translation is: (the user entered nothing, the translation is an empty string “”) Example of Execution for the full-sentence translation version (user input is in bold) Enter a sentence to translate: hello people Translation is: CETER SOLURE Enter a sentence to translate: I do not know what it says Translation is: A DO TER QORA QORA DO QORA Enter a sentence to translate: Translation is: (the user entered nothing, the translation is an empty string “”)   Grading Criteria:  Your program will be evaluated based on the following criteria:  Rubric # Pts Additional Grading Notes The program compiles without compilation errors or warnings 3 Deduct 1 point per minor compilation error (e.g., typo, forgotten semi-colon, forgotten or extra curly braces or parentheses). If the program does not compile due to too many errors or due to an error that is non-trivial to fix (see above), then the whole assignment receives zero points. The program executes without crashing at runtime 3 Deduct one point for each use case that leads the program to crash (maximum 3) The translate_word function takes a string as parameter and returns a string representing its translation, according to the provided table. 3 3 – Implemented according to requirements 2 – Mostly properly implemented 1 – Not properly implemented 0 – not implemented The translate_word function handles correctly strings longer than 8 characters. 3 3 – Implemented according to requirements 2 – Mostly properly implemented 1 – Not properly implemented 0 – not implemented The translate_word function handles correctly the translation of empty strings. 3 3 – Implemented according to requirements 2 – Mostly properly implemented 1 – Not properly implemented 0 – not implemented The translate_sentence function correctly calls strtok in order to obtain an array of strings each representing a word of the sentence passed as parameter. 3 3 – Implemented according to requirements 2 – Mostly properly implemented 1 – Not properly implemented 0 – not implemented The translate_sentence function correctly iterate over each of these words and concatenate their translation (according to translate_word) in a string that is then returned. 3 3 – Implemented according to requirements 2 – Mostly properly implemented 1 – Not properly implemented 0 – not implemented The main method prompts the user to enter a single word, and translate it, until they enter an empty string. At that point, it prompts the user to enter a full sentence, and translate it, until they enter another empty string. 3 3 – Implemented according to requirements 2 – Mostly properly implemented 1 – Not properly implemented 0 – not implemented Total 24  

Read Details

In reference to this problem: The Coco Co. is considering tw…

In reference to this problem: The Coco Co. is considering two mutually exclusive projects with the following cash flows. Which project would you pick, assuming the cost of capital is 10%? Simply specify A or B in your answer. Year Project A Project B 0 -$150,000 -$50,000 1  $120,000  $10,000 2  $30,000  $30,000 3  $35,000  $30,000  

Read Details

A biotech company has accepted a project that is expected to…

A biotech company has accepted a project that is expected to increase revenues by $[x] a year and cash expenses by $[y] a year. The project will require the purchase of some new equipment that will increase depreciation expenses by $[z] a year. Net working capital is also expected to increase by $[a] annually. The firm is in the [b]% marginal tax bracket. What is the change in operating cash flows? Round to the nearest whole number.

Read Details

Description of the Program to Write Upload a .c source file…

Description of the Program to Write Upload a .c source file containing all necessary functions to implement the following program. You will prompt the user to enter a sentence, and then display its translation. To this end, you will construct the resulting translation by concatenating the individual translation of each word. Your program will be organized as follows: Function translate_sentence will handle all the steps of translating a whole sentence, passed as a string parameter. It will return the resulting translation as a new string that is the concatenation of the result of calling translate_word on each word of the original sentence. The new string will have a maximum size of 5 times the size of the string we are translating. You will make sure that you do not concatenate into it more words than it can store (e.g., stop adding any more translations once you have one that does not fit in what space is left). Function translate_word will be used by the above function to translate one word and return a new string representing the translation. If the word is not known, then the new string will contain a copy of the original word.  In order to translate you are going to use a lookup table that will store, in a two-dimensional array, some words and their translation. For this exam, we will focus on translating the 10 digits from English to French. The table will look like the following (see below). You will return the original word except if you find it in the table, in which case you will return a new string containing the corresponding translation.      static const char * translationTable[NB_WORDS][2] = {        { “zero” , “zero” },        { “one” , “un” },        { “two” , “deux” },        { “three” , “trois” },        { “four” , “quatre” },        { “five” , “cinq” },        { “six” , “six” },        { “seven” , “sept” },        { “eight” , “huit” },        { “nine” , “neuf” }    }; Hint: Remember, or check the manpage of, strdup. This little function will make it easy to create new strings that are a copy of an existing one. Do not forget to deallocate all the memory that has been allocated. For instance, strdup returns a newly allocated string when you call it and it is your responsibility to deallocate it when it is no longer useful. Start with writing a version of the program that only asks for one word at a time and translate it. Once you get this to work, you may attempt to read an entire sentence and translate it, but it will be more difficult. When you are ready to work on that part, use strtok in order to get, from a sentence entered by the user, an array containing strings representing each of the words found in the sentence. If you do not remember the strtok function from your reading assignment, you are free to look at its manpage. Example of Execution for the single-word translation version (user input is in bold) Enter a single word to translate: one Translation is: un Enter a single word to translate: two Translation is: deux Enter a single word to translate: something Translation is: something Enter a single word to translate: Translation is: (the user entered nothing, the translation is an empty string “”) Example of Execution for the full-sentence translation version (user input is in bold) Enter a sentence to translate: one two three Translation is: un deux trois Enter a sentence to translate: one two testing one two three Translation is: un deux testing un deux trois Enter a sentence to translate: Translation is: (the user entered nothing, the translation is an empty string “”)   Grading Criteria:  Your program will be evaluated based on the following criteria:  Rubric # Pts Additional Grading Notes The program compiles without compilation errors or warnings 3 Deduct 1 point per minor compilation error (e.g., typo, forgotten semi-colon, forgotten or extra curly braces or parentheses). If the program does not compile due to too many errors or due to an error that is non-trivial to fix (see above), then the whole assignment receives zero points. The program executes without crashing at runtime 3 Deduct one point for each use case that leads the program to crash (maximum 3) The translate_word function takes a string as parameter and returns a string representing its translation, according to the provided table. 3 3 – Implemented according to requirements 2 – Mostly properly implemented 1 – Not properly implemented 0 – not implemented The translate_word function handles correctly words that are not listed in its translation table. 3 3 – Implemented according to requirements 2 – Mostly properly implemented 1 – Not properly implemented 0 – not implemented The translate_word function handles correctly the translation of empty strings. 3 3 – Implemented according to requirements 2 – Mostly properly implemented 1 – Not properly implemented 0 – not implemented The translate_sentence function correctly calls strtok in order to obtain each word of the sentence to translate. 3 3 – Implemented according to requirements 2 – Mostly properly implemented 1 – Not properly implemented 0 – not implemented The translate_sentence function correctly concatenates the translation of each word (according to translate_word) in a newly allocated string that is then returned. 3 3 – Implemented according to requirements 2 – Mostly properly implemented 1 – Not properly implemented 0 – not implemented The main method prompts the user to enter a single word, and translate it, until they enter an empty string. At that point, it prompts the user to enter a full sentence, and translate it, until they enter another empty string. 3 3 – Implemented according to requirements 2 – Mostly properly implemented 1 – Not properly implemented 0 – not implemented Total 24  

Read Details

Description of the Program to Write Upload a .c source file…

Description of the Program to Write Upload a .c source file containing a main function that will implement the following program. Your program will implement a text-based 2-players game. The goal of the game is for each player to take turn entering a single word. The first letter of that word must be the last letter of the previous word entered by the other player. You will display an error message if this is not the case and prompt again the faulty player to re-enter a word starting with the right letter. The first player starts by entering a word starting with any letter of their choice. Players are not allowed to enter words that have been previously memorized. The program memorizes a word when it is an acceptable input from one of the player (i.e., never used before, starting with right letter). There is a limit to how many words the program can memorize, this limit is entered by the user at the beginning of the game. We will keep track of the score in the form of the length of the words-chain that is created by the two players.  As soon as one of the players has no idea, they may give up by entering the string “…” instead of a word. The game then ends and the score is displayed for the winning player. To make things easier, we will assume a few things that your program does not have to enforce: The players will always enter their word all in lower-case letters. The players’ input will always consist of a single word (e.g., “disk-drive” or “diskdrive” instead of “disk drive”) Both players will agree to a theme for the words to be chosen, before to start the game. See the example of program’s execution section below for more details about the requirements. Example of Program’s Execution (user input is in bold) Words-Chains game starting. Please agree on a theme.How many used words should I keep track of? 0How many used words should I keep track of? -5How many used words should I keep track of? 4Player 1: Enter a word (must start with any letter): oneMemorized word #1 is ‘one’The words-chain is, so far, of length 1.Player 2: Enter a word (must start with ‘e’): twoYour word starts with a ‘t’ but it should start with a ‘e’. Try again.Player 2: Enter a word (must start with ‘e’): enactedMemorized word #2 is ‘enacted’The words-chain is, so far, of length 2.Player 1: Enter a word (must start with ‘d’): threeYour word starts with a ‘t’ but it should start with a ‘d’. Try again.Player 1: Enter a word (must start with ‘d’): directoryMemorized word #3 is ‘directory’The words-chain is, so far, of length 3.Player 2: Enter a word (must start with ‘y’): yellow-stoneMemorized word #4 is ‘yellow-stone’The words-chain is, so far, of length 4.Player 1: Enter a word (must start with ‘e’): enactedThis word has already been used.Try again.Player 1: Enter a word (must start with ‘e’): yellow-stoneThis word has already been used.Try again.Player 1: Enter a word (must start with ‘e’): elaborateToo many words to rememberThe words-chain is, so far, of length 5.Player 2: Enter a word (must start with ‘e’): enactedThis word has already been used.Try again.Player 2: Enter a word (must start with ‘e’): elaborateToo many words to rememberThe words-chain is, so far, of length 6.Player 1: Enter a word (must start with ‘e’): …Player gave up. Game is over.Winner is player 2 with a words-chain of length 6.The words that were memorized during the game are:oneenacteddirectoryyellow-stone How to implement the program Decompose your program into the following functions:  int ask_user_how_many_used_words(); This function will prompt the user to enter an int value (see above) until the user entered a value that is greater than zero. It will then return that value.  char** allocate_used_words(int how_many); This function will take as parameter the number of words to remember. It will then allocate a dynamical array of pointers on characters of that size. Each of the elements of this array, which will be pointers on the words remembered, will be initialized to NULL. The address of the dynamically allocated array of pointers is then returned. bool already_used(char** used, char* w, int max); This function returns true if the string passed as parameter w is one of the words that were memorized in the dynamically allocated array of strings passed as parameter used. The parameter max tells us how many words were currently memorized in used. If the word has not been memorized, the function returns false. void remember_word(char** used, char* w, int max, int* current); This function will add the word passed as the string parameter w to the dynamically allocated array of strings passed as parameter used. To do so, it will make use of the parameter max, which is the maximum number of words that can be memorized, as well as the parameter current which is the index of next word to be memorized,HINT: use the strdup function (check its manpage) to make a copy of w in the used array of pointers. int main(void); The main function will implement most of the game, using the above-described functions, so that it executes as illustrated in the example of program’s execution section. Grading Criteria: Rubric # Pts Additional Grading Notes The program compiles without compilation errors or warnings 3 Deduct 1 point per minor compilation error (e.g., typo, forgotten semi-colon, forgotten or extra curly braces or parentheses). If the program does not compile due to too many errors or due to an error that is non-trivial to fix (see above), then the whole assignment receives zero points. The program executes without crashing at runtime 3 Deduct one point for each use case that leads the program to crash (maximum 3) The program provides sufficient comments detailing the role of each function (and its parameters / return values), as well as the role of each variable used in the code. 3 3 – Implemented according to requirements 2 – Mostly properly implemented 1 – Not properly implemented 0 – not implemented Function ask_user_how_many_used_words 3 3 – Implemented according to requirements 2 – Mostly properly implemented 1 – Not properly implemented 0 – not implemented Function allocate_used_words 3 3 – Implemented according to requirements 2 – Mostly properly implemented 1 – Not properly implemented 0 – not implemented Function already_used 3 3 – Implemented according to requirements 2 – Mostly properly implemented 1 – Not properly implemented 0 – not implemented Function remember_word 3 3 – Implemented according to requirements 2 – Mostly properly implemented 1 – Not properly implemented 0 – not implemented main function 3 3 – Implemented according to requirements 2 – Mostly properly implemented 1 – Not properly implemented 0 – not implemented Total 24  

Read Details

Description of the Program to Write Upload a .c source file…

Description of the Program to Write Upload a .c source file containing a main function that implements the following program. Two players take turns entering a positive integer between 1 and 100 inclusive. The first player may enter any number between 1 and 100. Every subsequent number entered must satisfy the following rule: The sum of the digits in the number must be equal to the sum of the digits in the previous number. Example: if the previous number is 23 (sum = 2 + 3 = 5), the next number must have a digit sum of 5 (e.g., 14, 32, 50). Players may not enter numbers that have been previously used. At the start of the game, the user specifies how many numbers the program should memorize. If this limit is reached, the program refuses to memorize additional numbers but continues validating moves. A player may give up by entering 0, which immediately ends the game. The program tracks the length of the sequence (number of valid numbers entered). The winner is the player who last successfully entered a valid number. At the end of the game, the program displays: The winning player The length of the sequence The numbers that were memorized during the game (up to the maximum specified in item #5) Sample Program Execution Number Chain with Digit-Sum Rule starting.How many numbers should I keep track of? -2How many numbers should I keep track of? 0How many numbers should I keep track of? 3Player 1: Enter a number (any number between 1 and 100): 23Memorized number #1 is 23The sequence length is now 1.Player 2: Enter a number (sum of digits must equal 5): 14Memorized number #2 is 14The sequence length is now 2.Player 1: Enter a number (sum of digits must equal 5): 32Memorized number #3 is 32The sequence length is now 3.Player 2: Enter a number (sum of digits must equal 5): 41Too many numbers to rememberThe sequence length is now 4.Player 1: Enter a number (sum of digits must equal 5): 50Your number has already been used or is invalid. Try again.Player 1: Enter a number (sum of digits must equal 5): 23This number has already been used. Try again.Player 1: Enter a number (sum of digits must equal 5): 5Memorized number #4 is 5The sequence length is now 5.Player 2: Enter a number (sum of digits must equal 5): 50Too many numbers to rememberThe sequence length is now 6.Player 1: Enter a number (sum of digits must equal 5): 0Player gave up. Game is over.Winner is player 2 with a sequence length of 6.The numbers that were memorized during the game are:231432 Functions to implement 1. int ask_user_how_many_used_numbers(void);Prompt user for the number of numbers to memorize (>0).Returns: number of numbers to memorize. 2. int* allocate_used_numbers(int how_many);Allocate array for memorized numbers, initialized to 0.Parameters: how_many — max size.Returns: pointer to array. 3. bool already_used(int* used, int n, int current);Check if n is already in used.Parameters: used — array, n — number to check, current — count stored.Returns: true if used, false otherwise. 4. void remember_number(int* used, int n, int max, int* current);Store n in used if memory allows; increment current. 5. bool is_valid_number(int prev, int n);Validate n: 1–100, and if not first number, digit sum equals previous number.Parameters: prev — previous number (0 if first), n — candidate number.Returns: true if valid, false otherwise. 6. int main(void);Implements the game loop: prompts each player for input, validates numbers, checks duplicates, handles giving up, alternates turns, tracks sequence and memory, declares winner.Returns: 0 on exit. Grading Criteria Rubric # Pts Additional Grading Notes The program compiles without compilation errors or warnings 3 Deduct 1 point per minor compilation error (e.g., typo, forgotten semi-colon, forgotten or extra curly braces or parentheses). If the program does not compile due to too many errors or due to an error that is non-trivial to fix (see above), then the whole assignment receives zero points. The program executes without crashing at runtime 3 Deduct one point for each use case that leads the program to crash (maximum 3) Function ask_user_how_many_used_numbers 3 3 – Implemented according to requirements 2 – Mostly properly implemented 1 – Not properly implemented 0 – not implemented Function allocate_used_numbers 3 3 – Implemented according to requirements 2 – Mostly properly implemented 1 – Not properly implemented 0 – not implemented Function already_used 3 3 – Implemented according to requirements 2 – Mostly properly implemented 1 – Not properly implemented 0 – not implemented Function remember_number 3 3 – Implemented according to requirements 2 – Mostly properly implemented 1 – Not properly implemented 0 – not implemented Function is_valid_number 3 3 – Implemented according to requirements 2 – Mostly properly implemented 1 – Not properly implemented 0 – not implemented main function 3 3 – Implemented according to requirements 2 – Mostly properly implemented 1 – Not properly implemented 0 – not implemented Total 24    

Read Details

Posts pagination

Newer posts 1 … 26,180 26,181 26,182 26,183 26,184 … 93,199 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top