The following program contains a cylinder class that represents a cylinder as a radius and a

The following program contains a Cylinder class that represents a cylinder as a radius and a height - see the diagram above. Implement the constructor and the volume method using the comments and the main function as a guide. For the constructor, you must use an initializer list to set the radius and height. The equation for the volume of a cylinder is volume = radius^2 * height. Your implementation will appear outside the class declaration, underneath the // FIXME comments. ``` #include #include using namespace std; class Cylinder { public: Cylinder(double r, double h); double volume() const; private: double radius; double height; }; // FIXME: implement the Cylinder constructor to set radius and height // You must use an initializer list to receive credit // FIXME: implement the volume method to return the volume of the Cylinder object int main() { // create a Cylinder with radius = 2.0 and height = 5.0 Cylinder c(2.0, 5.0); // should print 62.8 (maybe with more decimal places - it depends on the value you used for pi) cout << c.volume() << endl; return 0; } ```

The following program contains a Cylinder class that represents a cylinder as a radius and a height – see the diagram above. Implement the constructor and the volume method using the comments and the main function as a guide. For the constructor, you must use an initializer list to set the radius and height. The equation for the volume of a cylinder is volume = radius^2 * height. Your implementation will appear outside the class declaration, underneath the // FIXME comments. “` #include

Read More

MainPageExerciseshw51 Python Solve an Exercise 3 binarysearchnumbers LanguageType Related

Main Page Exercise: hw5.1 Python Solve an Exercise: 3 - binary_search_numbers Language/Type: Related Links: Given the following sorted lists of integers: - What indexes will be examined as the middle element by a binary search for the target value 8 when the search is run on the following input lists? - What value will the binary search algorithm return? (Notice that the input list e isn't in sorted order. What can you say about the binary search algorithm's result?) a. Indexes examined: a. Value returned: b. Indexes examined: b. Value returned: c. Indexes examined: c. Value returned: d. Indexes examined: d. Value returned: e. Indexes examined: e. Value returned: You passed 5 of 10 tests. Try again.

Main Page Exercise: hw5.1 Python Solve an Exercise: 3 – binary_search_numbers Language/Type: Related Links: Given the following sorted lists of integers: – What indexes will be examined as the middle element by a binary search for the target value 8 when the search is run on the following input lists? – What value will the binary search algorithm return? (Notice that the input list e isn’t in sorted order. What can you say about the binary search algorithm’s result?) a. Indexes examined: a. Valu

Read More

Q1 Write code in python that performs 1D convolution with inputs A Random input of length 100K or

Q1) Write code in python that performs 1D convolution with inputs: A) Random input of length 100K or more (let it be huge, for eg 120K)B) Random filters of length 3 to 25 or more (any random, eg 5)need to write two implementations of 1D convolution (one using for loops and other using matrix multiplication) in python as follows:1) A naive for-loop implementation of filter applied on input2) Matrix multiplication implementations(i) where the input is the column vector, (ii) where the filter is t

Read More

x No x is not in the phrase V V 1111 11 Secret Phrase Do

Create a Python file called PhraseGame.pyImport the provided DrawScoreboard.py module.Be sure to place the module in your development directory so that the import can find the file, then import it as import “” where “” is the name of the Python file without “.py”Write a function called display_guessed_letters() with the following signature:def display_guessed_letters(guessed_letters):This function should:Take an input parameter, a string of lowercase letters representing all guessed letters. You can assume: The input string will contain no spaces, digits, or other forms of punctuationThe letters are not necessarily in sorted order, but all characters will be unique. (There will be no more than one of each character in the parameter)Return the characters from the input string separated by commas, as shown in the example below:Write a function called display_secret_phrase() with the following signature:def display_secret_phrase(secret_phrase, guessed_letters):This function should:Take two input parameters: strings secret_phrase, and guessed_letters secret_phrase is the games’ secret phrase, consisting of upper and lower case letters, apostrophes, and spaces. You can assume secret_phrase contains no characters other than those.guessed_letters follows the same assumptions as the parameter of the same name in display_guessed_letters()Return a string of the guessed letters in the phrase following these specifications: For each letter that is not guessed, display a dashThe spaces and apostrophes are displayed regardless of guessesAll letters in the phrase are guessed for a letter guess and guesses are case insensitive (If it is capitalized in the secret phrase, then it is capitalized in the returned string, regardless of the case of the guess). For example, entering the character ‘A’ or ‘a’ as a guess, matches all letters for ‘A’ (either ‘A’ or ‘a’) in the phrase. “A Black Cat” would have “A --a-- -a-” displayed for ‘A’ or ‘a’ and “A --ac- Ca-” for a following guess of ‘C’ or ‘c’Example:Write a function called play_game() with the following signature:def play_game(secret_phrase, total_guesses):This function should:Take two input parameters: A string of the secret phrase and an integer number of guessesThe following steps are repeated until “!” is entered: Print the current scoreboardPrint the secret phrase (the blanks and current guesses)Print the letters guessed so farCheck if the stored guesses contains all the letters in the secret phrase, if so print the win messageCheck if the number of guesses exceeds the total allowed guesses. If so, print the game over messagePrompt the user to enter a character as a guess of a letter in the phrase. The input can either be an upper or lower case letter.After a character is entered: If an “!” is entered, the game ends early, printing a message accordinglyIf the character is a letter (upper or lower case) it will check to see if that letter has already been guessed. If it has not been guessed: store the letter. If the character is not in the phrase, print a message indicating an incorrect guess has been madeIf the character is in the phrase, update the scoreboard and the secret phrase displayIf it has been guessed: print that the letter was a duplicate, then prompt the user to enter another letter.In either case, they are both considered as a valid guess and not stored as an incorrect guessIf any other character is entered, a message is displayed indicating that it is not a valid guess. This also does not result in an incorrect guessThe program following sample outputs demonstrate the flow of execution and the expected output:Win Example:Lose Example:

Create a Python file called PhraseGame.pyImport the provided DrawScoreboard.py module.Be sure to place the module in your development directory so that the import can find the file, then import it as import “” where “” is the name of the Python file without “.py”Write a function called display_guessed_letters() with the following signature:def display_guessed_letters(guessed_letters):This function should:Take an input parameter, a string of lowercase letters representing al

Read More

begintabularcccc hline Operator Operandi Operand2 Result hline b c z

Write in C++7. Write a client program that uses Stack abstract data to compile a simple arithmetic expression without parentheses. For example, the expression a + b * c - d should be compiled according to the following table:The table shows the order in which the operations are performed ( * , +, -) and operands for each operator. The result column gives the name of an identifier (working backward from z) chosen to hold each result. Assume that the operands are the letters a through m and the operators are (+,-,*,/). Your program should read each character and process it as follows: If the character is blank, ignore it. If the character is neither blank nor an operand nor an operator, display an error message and terminate the program. If it is an operand, push it onto the operand stack. If it is an operator, compare its precedence to that of the operator on top of the operator stack. If the current operator has higherprecedence than the one currently on top of the stack (or if the stack is empty), it should be pushed onto the operator stack. If the current operator has the same or lower precedence, the operator on top of the operator stack must be evaluated next. This is done by popping that operator off the operator stack along with a pair of operands from theoperand stack and writing a new line in the output table. The character selected to hold the result should then be pushed onto the operand stack. Next, the current operator should be compared to the new top of the operator stack. Continue to generate output lines until the top of the operator stack has lower precedence than the current operator or until it is empty. At this point, push the current operator onto the top of the stack and examine the next character in the data string. When the end of the string is reached, pop any remaining operator along with its operand pair just described. Remember to push the result character onto the operand stack after each table line is generated. Do problem 7 on pp 355-356. Do not worry about parenthesis, just use letters and +,-,/,*. Follow the guidelines the problem gives you on how to handle the operators and operands. Use single digit numbers instead of letters and show the result of the formula you use. Make it so I can enter a group of about 7 - 12 operators and operands in an expression. Print out the stack at every change, at the beginning and the end also.

Write in C++7. Write a client program that uses Stack abstract data to compile a simple arithmetic expression without parentheses. For example, the expression a + b * c – d should be compiled according to the following table:The table shows the order in which the operations are performed ( * , +, -) and operands for each operator. The result column gives the name of an identifier (working backward from z) chosen to hold each result. Assume that the operands are the letters a through m and the op

Read More

Write a Python Program that accepts a DNA sequence from a text file dnatxt and counts the

Write a Python program that accepts a DNA sequence from a text file 'dna.txt' and counts the frequency of each of the nucleotide acids A, C, G, T. Assume the 'dna.txt' is in the same directory where your program is.

Write a Python program that accepts a DNA sequence from a text file ‘dna.txt’ and counts the frequency of each of the nucleotide acids A, C, G, T. Assume the ‘dna.txt’ is in the same directory where your program is.

Read More

Sample Run A screen shot of a sample run of this application is shown on the next page Design your

Sample Run A screenshot of a sample run of this application is shown on the next page. Design your application so it looks like the one shown in the screenshot. Display all currency values with two digits after the decimal point. Also, because the accuracy of numerical results is the most important part of any application, test your program with the data shown in the screenshot to ensure that your program works correctly. Enter the name of the item being financed: Enter the loan amount in dollars: Enter the annual interest rate (in percentage): Enter the duration of the loan in years (enter as a whole number): Monthly payment: $340.98 Programming Assignment: Monthly Payment Write a .NET MAUI App using C# that calculates the expected monthly payment for a personal loan based on user input. Input Your program should solicit the following information from the user. Calculated Variables Your program should calculate the following variables. NOTE: There is no exponentiation operator in C#. To raise a number to a power, we can use the Pow function. For example, the C# statement below will calculate ( (1 + text{rate})^{text{number_of_payments}} ) x = Convert.ToDecimal(Math.Pow(Convert.ToDouble(1 + rate), number_of_payments));

Sample Run A screenshot of a sample run of this application is shown on the next page. Design your application so it looks like the one shown in the screenshot. Display all currency values with two digits after the decimal point. Also, because the accuracy of numerical results is the most important part of any application, test your program with the data shown in the screenshot to ensure that your program works correctly. Enter the name of the item being financed: Enter the loan amount in dollar

Read More