Home / Expert Answers / Computer Science / answer-in-c-pls-assignment1a-math-mad-libs-in-traditional-mad-libs-you-39-re-given-a-paragraph-of-t-pa485

(Solved): Answer in C# pls Assignment1A: Math Mad Libs: In traditional Mad Libs, you're given a paragraph of t ...



Answer in C# pls

Assignment1A:
Math Mad Libs: In traditional Mad Libs, youre given a paragraph of text with blanks; you then
fill in those bl
Assignment2A:
Finding multiples Weve learned that in programming, there is a special operator for getting the
whole number r
Assignment2B:
Unusual shapes! At this point, weve gotten pretty comfortable with calculating the perimeter
and area of squar
Assignment1A: Math Mad Libs: In traditional Mad Libs, you're given a paragraph of text with blanks; you then fill in those blanks to create an amusing or silly story. In this program, we will do the same thing but with numbers! You will print out the following equation as a string literal: x + (y/z) *w = ? You will then prompt the user to enter one number at a time, replacing the variables from left to write with those numbers and printing the updated string to the screen. After the last number is entered, you will print the full equation with the solution replacing the "?" question mark. A sample output from this program is as shown below, with user input in bold. Your program's output must match this format, but it should work for any valid user input. Save your source code in a file called Assignment1A (with a file extension of .cpp, .cs or .java) Sample Output: [Math Mad Libs] x + (y / z) * w = ? Enter the first term: 3 I 3+ (y/z) w = ? Enter the second term: 4.3 3+ (4.3 / z) * W = ? Enter the third term: -2 3+ (4.3 / -2) * W = ? Enter the fourth term: 7.8 3+ (4.3-2)* 7.8 = -13.77 Note: Use a floating point variable to store each value entered by the user. Depending on your programming language, you may or may not have a decimal value displayed when entering a whole number (for instance, entering 5 may print out 5.0). Both formats are acceptable for this assignment. Also, you can assume the user will not input "0" for the third term. We will learn how to handle logical issues like this a little later in the course. Assignment2A: Finding multiples We've learned that in programming, there is a special operator for getting the whole number remainder of division: The Modulo Operator! So, 11 % 10 will give us a value of 1, since 10 goes evenly into 11 with a remainder of 1. There are many uses for this operator which we will learn throughout the semester. In this assignment, we're going to use it to find the nearest multiple of a number based on user input. For example, if we're looking for multiples of 6, then the nearest multiple from 13 is 12, and the nearest multiple from 22 is 18 (rounded down). Your task is to: a) Ask the user to enter a whole number they want to find a multiple of b) Read that value in c) Ask the user to enter a second number d) Read that value in e) Use the Modulo Operator to find the nearest multiple of the first number from the second number f) Display the result to the user The algorithm's output is as shown below, with user input in bold. Save your source code in a file called Assignment2A (with a file extension of .cpp, .cs or .java) Sample Output #1: Enter a number you want to find a multiple of: 3 Enter a second number: 10 Calculating... The nearest multiple of 3 from 10 is 9! Sample Output #2: Enter a number you want to find a multiple of: 12 Enter a second number: 95 Calculating... The nearest multiple of 12 from 95 is 84! Sample Output # 3: Enter a number you want to find a multiple of: 7 Enter a second number: 33 Calculating... The nearest multiple of 7 from 33 is 28! Assignment2B: Unusual shapes! At this point, we've gotten pretty comfortable with calculating the perimeter and area of squares and rectangles. In this assignment, we'll make a program that calculates these values for regular pentagons and hexagons! Hexagon Pentagon Research the formulas to calculate the area of regular pentagons and hexagons, and implement them in your code. Hint: You can replicate exponents using multiplication. For example, r' is the same as (r* r). You will likely also need to use square root. We will learn more about functions later in the course, but for now you can use the following commands. Java C# C++ Math.sqrt (variable) Math.Sqrt (variable) Sqrt (variable) Example Usage: double result = Math.sqrt(4); //result will equal 2 Your task is to: A) Prompt the user to enter the necessary information to calculate the area and perimeter of a pentagon and hexagon B) Read in those values C) Perform calculations to the perimeter and area of each shape D) Display the result to the user The algorithm output is as shown below, with user input in bold. Save your source code in a file called Assignment2B (with a file extension of .cpp, .cs or.java) Sample Output: [Pentagon Calculator] Enter the length of one side: 7 Pentagon Perimeter = 35 Pentagon Area = 84.3


We have an Answer from Expert

View Expert Answer

Expert Answer


Part (2)(A) C# code for the provided problem statement using System; class Solution { public static void Main() { // Ask the user to enter a whole number they want to find a multiple of Console.Write("Enter a number you
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe