1. Homepage
  2. Programming
  3. MATH10017 CW1: Function Grapher for Hackers

MATH10017 CW1: Function Grapher for Hackers

Engage in a Conversation
BristolAlgorithms and Programming in C(++) and RMATH10017Function Grapher for HackersCR

CW1: Function Grapher for Hackers CourseNana.COM

Read the whole document before you start. Particularly the slide regarding plagiarism. CourseNana.COM

Coursework Objective CourseNana.COM

You will write a c program that produces the function graph of , for any in the terminal window of VSCode. CourseNana.COM

A complete program should produce something like: CourseNana.COM

Function graph for sin(2.00x+1.57):

|** **** ** | * ** ** ** |** ** * |**** |**** X---------------X---------------X---------------X-------------- |**** CourseNana.COM

| * ** * * |** *** |**** *** | **** ***** CourseNana.COM

Why Terminal Grapher? CourseNana.COM

Although many software enable you to generate function graphs easily, it is not always easy to include graphs in traditional text based editors. CourseNana.COM

You want to post a function graph on reddit, which does not allow comments with images. CourseNana.COM

You want to attach a function graph in the email, but your editor only accepts text messages. CourseNana.COM

Part I CourseNana.COM

  1. Download the CW file, and unzip it to your labpack. CourseNana.COM

  2. Open grapher.c . CourseNana.COM

  3. Create a function plot with two inputs a and b and no output. CourseNana.COM

  4. In lecture 4, we talked about how to write code to produce the following output: CourseNana.COM

****
****
****
****

4. Copy and paste relevant code to plot , so now you can see the above output when you call plot in main . CourseNana.COM

Part II CourseNana.COM

0. Now, remove the printf statement in your code. CourseNana.COM

1. Modify your loops, so it prints out the following coordinates . CourseNana.COM

1.00, 0.00
1.00, 0.10 //the second coordinate increases by .1
...
1.00, 6.20 //the second coordinate stops at 6.20
0.80, 0.00 //the first coordinate decreases by .2
0.80, 0.10
...
0.80, 6.20
...
-1.00, 0.00
-1.00, 0.10
...
-1.00, 6.20 // the first coordinate stops at -1.00

Part II CourseNana.COM

Hint, what output will the following code produce? CourseNana.COM

for(double i = 0.0; i <= 1.0; i = i + 0.1){
    printf("%.2f\n", i);

} CourseNana.COM

Make sure you can produce the correct output before you continue. CourseNana.COM

Part III CourseNana.COM

Now, remove the printf statement in your code. Write code according to the following description: CourseNana.COM

For each coordinate ,
If , print out
* otherwise, print out an empty space . CourseNana.COM

Hint: The absolute value function is fabs(a) . CourseNana.COM

With some additional tricks you have learned from the lectures/labs, you should be able to produce: CourseNana.COM

Part III CourseNana.COM

At this moment, there should be about 10 lines of code in your plot function. Do not over engineer your code. CourseNana.COM

Part IV (Challenging) CourseNana.COM

Modify your code, so plot(a,b) produces the graph for function . CourseNana.COM

Add a title to your graph:
Function graph for sin(ax+b) , where a and b will be CourseNana.COM

replaced with the actual values of a and b . CourseNana.COM

Part V (Challenging) CourseNana.COM

Modify your code, so it produces a horizontal axis like this: CourseNana.COM

Function graph for sin(2.00x+1.57):
***                           ****                           **
   *                        **    **                       **

** ** * **** CourseNana.COM

**** --------------------------------------------------------------- CourseNana.COM

**** * ** * * ** *** ** ** * ** **** ***** CourseNana.COM

Part V (Challenging) CourseNana.COM

Modify your code, so it marks with X . CourseNana.COM

Function graph for sin(2.00x+1.57):
***                           ****                           **
   *                        **    **                       **

** ** * **** CourseNana.COM

**** X---------------X---------------X---------------X-------------- CourseNana.COM

**** * ** * * ** *** ** ** * ** **** ***** CourseNana.COM

Part V (Challenging) CourseNana.COM

Now, add the verticle axis CourseNana.COM

Function graph for sin(2.00x+1.57):

|** **** ** | * ** ** ** |** ** * |**** |**** X---------------X---------------X---------------X-------------- |**** CourseNana.COM

| * ** * * |** *** |**** *** | **** ***** CourseNana.COM

You should be able to do all 5 parts with less than 50 lines of code (my answer uses 34 lines of code). Do not over engineer your code (such as adding user interface). CourseNana.COM

Marking Criteria CourseNana.COM

5% for submitting a C file with the correct file name, i.e., ab1234.c where ab1234 is your email address before @ . CourseNana.COM

10% for submitting a C file that compiles. CourseNana.COM

15% for submitting a C file that produce the correct output for part I. CourseNana.COM

30% for submitting a C file that produce the correct output for part II. CourseNana.COM

50% for submitting a C file that produce the correct output for part III. CourseNana.COM

60% for submitting a C file that produce the correct output for part IV. CourseNana.COM

Marking Criteria CourseNana.COM

80% for submitting a C file that produce the correct output for part V. CourseNana.COM

20% additional points for good coding practice: CourseNana.COM

Good code format.
Apt use of comments.
Good variable/function naming scheme.
CourseNana.COM

CourseNana.COM

Plagiarism CourseNana.COM

You can discuss about the general strategy of your code with your coursemates. CourseNana.COM

You must write the code independently! Do not write code together! CourseNana.COM

Academic collusion is a serious offense. Certainly do not copy other people's code. CourseNana.COM

You can use code you found on internet, but you MUST provide the source in the comments. If we found identical source code from the internet without any mentioning or citation, it will be regarded as plagiarism.  CourseNana.COM

Get in Touch with Our Experts

WeChat WeChat
Whatsapp WhatsApp
Bristol代写,Algorithms and Programming in C(++) and R代写,MATH10017代写,Function Grapher for Hackers代写,C代写,R代写,Bristol代编,Algorithms and Programming in C(++) and R代编,MATH10017代编,Function Grapher for Hackers代编,C代编,R代编,Bristol代考,Algorithms and Programming in C(++) and R代考,MATH10017代考,Function Grapher for Hackers代考,C代考,R代考,Bristolhelp,Algorithms and Programming in C(++) and Rhelp,MATH10017help,Function Grapher for Hackershelp,Chelp,Rhelp,Bristol作业代写,Algorithms and Programming in C(++) and R作业代写,MATH10017作业代写,Function Grapher for Hackers作业代写,C作业代写,R作业代写,Bristol编程代写,Algorithms and Programming in C(++) and R编程代写,MATH10017编程代写,Function Grapher for Hackers编程代写,C编程代写,R编程代写,Bristolprogramming help,Algorithms and Programming in C(++) and Rprogramming help,MATH10017programming help,Function Grapher for Hackersprogramming help,Cprogramming help,Rprogramming help,Bristolassignment help,Algorithms and Programming in C(++) and Rassignment help,MATH10017assignment help,Function Grapher for Hackersassignment help,Cassignment help,Rassignment help,Bristolsolution,Algorithms and Programming in C(++) and Rsolution,MATH10017solution,Function Grapher for Hackerssolution,Csolution,Rsolution,