Help with C thanksQuestion 1 Implement a C program and explain the syntax and use of data

Help with C++ thanks.Question 1. Implement a C++ program and explain the syntax and use of data structures such as structures and class. Question 1a. Define a structure named Person using the C++ language to hold A string representing the name of the person. A float representing the BMI of the person. An integer representing the age of the person. A bool representing the Singapore nationality status of the person.Question 1b. Implement a main function to demonstrates the use of the structure

Read More

1 Write a function which takes a list of the coefficients of a polynomial Pxa0a1xa2x2anxn

(1) Write a function which takes a list of the coefficients of a polynomial P(x) = a0 + a1x + a2x^2 + ... + anx^n of arbitrary degree n, and a value of x0, and returns P(x0). You can use the function given in lectures, ensuring you understand how it works. (2) Use the function to evaluate (a) P1(x) = 4x^4 + 3x^2 + 2 at x = 2. (b) P2(x) = 241x^4 at x = 2. Are these answers exact? Explain why or why not. (Use a print statement to show the evaluation of your function, and answer the question in a comment.) (3) The power series for the sine function sin(x) is given by sin(x) = Σ (1)^n * (2n+1)! * x^(2n+1) = x - x^3/3! + x^5/5! - x^7/7! + ..., for all x. Use the first four terms in this series in the Horner evaluation function at a suitable value of x to give an approximation of sin(π/4). (4) (a) Use your Horner's method function to evaluate the polynomial (x-1)^3 at the point x = 1.000001. (b) Is this answer correct? (c) Briefly explain why or why not. (5) In week 3 we wrote a function to convert from binary to decimal. This can be adapted to other bases; here we will explore octal (base 8). The efficiency of the function we wrote can be improved using the same principle as Horner's method. Write such a function (horner_octal_to_dec) using the ideas of Horner's method which takes a list whose entries are integers between 0 and 7, where the list represents a base-8 number, and returns the corresponding decimal integer (so the input [2,5,1] returns the integer 169).

(1) Write a function which takes a list of the coefficients of a polynomial P(x) = a0 + a1x + a2x^2 + … + anx^n of arbitrary degree n, and a value of x0, and returns P(x0). You can use the function given in lectures, ensuring you understand how it works. (2) Use the function to evaluate (a) P1(x) = 4x^4 + 3x^2 + 2 at x = 2. (b) P2(x) = 241x^4 at x = 2. Are these answers exact? Explain why or why not. (Use a print statement to show the evaluation of your function, and answer the question in a c

Read More

Write a script in Python that automatically creates a directory structure for each user in a csv

Write a script in Python that automatically creates a directory structure for each user in a csv file.e.g.jmurphy – docs – source – imagesIt also copies a readme.txt file to the folder.The csv file has 1 line. e.g.jmurphy,mobrien,koconnor,bmulcahyYou need to create 3 files:createDirs.pyusers.csvreadme.txt

Read More

Hough Transformation An approach that finds the continual lines from edge pixels on images This

Hough Transformation: An approach that finds the continuous lines from edge pixels on images. This implementation only requires working on straight lines. On the screen, show the original image, the edge image (i.e., only showing the edge pixels in the image), the space of the transformation shown as an image, and overlay the straight lines detected from the transformation on the original image.

Hough Transformation: An approach that finds the continuous lines from edge pixels on images. This implementation only requires working on straight lines. On the screen, show the original image, the edge image (i.e., only showing the edge pixels in the image), the space of the transformation shown as an image, and overlay the straight lines detected from the transformation on the original image.

Read More

Problem 3 Let 1 be a line in the xy plane If l is a vertical line its equation is xa for some

Problem 3) Let 1 be a line in the xy plane. If l is a vertical line, its equation is x=a for some real number a. Suppose I is not a vertical line and its slope is m. Then the equation of l is y=mx+b, where b is the y-intercept. If 1 passes through the point (x0,y0), the equation of 1 can be written as yy0=m(xx0). If (x1,y1) and (x2,y2) are two points in the xy plane and x1=x2, the slope of the line passing through these points is m=(y2y1)/(x2x1). Write a program that prompts the user for two points in the xy plane. The program should output the equation of the line and use if statements to determine and output whether the line is vertical, horizontal, increasing, or decreasing. If 1 is a non-vertical line, output its equation in the form y=mx+b. Problem 4) Write a program that prompts the user to enter two integers. The program should output how many numbers are multiples of 3 and how many numbers are multiples of 5 between the two integers (inclusive). Sample Output: Enter two integers: 5 50 Multiples of 3 between 5 and 50: 15 Multiples of 5 between 5 and 50: 10

Problem 3) Let 1 be a line in the xy plane. If l is a vertical line, its equation is x=a for some real number a. Suppose I is not a vertical line and its slope is m. Then the equation of l is y=mx+b, where b is the y-intercept. If 1 passes through the point (x0,y0), the equation of 1 can be written as yy0=m(xx0). If (x1,y1) and (x2,y2) are two points in the xy plane and x1=x2, the slope of the line passing through these points is m=(y2y1)/(x2x1). Write a program that prompts the user for two po

Read More

Problem 5 Develop a program that asks the user to enter a number If the user enters 1 the

Problem 5) Develop a program that asks the user to enter a number. If the user enters 1, the program computes and displays the value of S1. If the user enters 2, the program computes and displays the value of S2. If the user enters something else, the program displays the message: "invalid choice". The following equations define S1 and S2: S1 = ∑(k=1 to N) k S2 = ∑(r=1 to N) r + 5r The user provides the value of N. Problem 6) Develop a C++ program that continuously prompts the user to enter a positive number until the user enters a negative number to terminate the entry process. When this happens, the program should display the sum of the positive numbers entered by the user. For example, if the user enters 4, 1, 5, 2, 3, the sum computed by the program should be 12 (the negative number is not included in the sum).

Problem 5) Develop a program that asks the user to enter a number. If the user enters 1, the program computes and displays the value of S1. If the user enters 2, the program computes and displays the value of S2. If the user enters something else, the program displays the message: “invalid choice”. The following equations define S1 and S2: S1 = ∑(k=1 to N) k S2 = ∑(r=1 to N) r + 5r The user provides the value of N. Problem 6) Develop a C++ program that continuously prompts the user to enter a po

Read More