Question
CSC3320 System Level Programming Homework 5 Due at 11:59 pm on Saturday, Dec. 2, 2017 Part I: Finish the quiz HW5 -1 in the quizzes
CSC3320 System Level Programming Homework 5 Due at 11:59 pm on Saturday, Dec. 2, 2017 Part I: Finish the quiz HW5 -1 in the quizzes of iCollege. Note: You could have TWO attempts. The highest attempt will be considered as the final grade of this part. You can check the feedback and grade after the deadline. Part II: Continue the part II in homework 4. A sample of the output is as below: Note: To convert a string to a float point number, you can use the library function atof The C program can be implemented within 80 lines of code. If your program is longer than 80 lines, you may need to think about how to simplify your program. Question: Modify your C program by accepting the three inputs from command line. The first argument is the amount of loan, the second one is the interest rate per year and the last one is the number of payments. Name this C program as loan.c. To run the executable, e.g. you can try the command as below: ./loan 500 7.5 5 Note: In your answer sheet, for the C program above please attach a screenshot of the output when amount of loan is $2000, interest rate per year is %7.5 and number of payment is 6. Put the source code of each C program above into your answer sheet. Upload the c file of each C program above into the submission folder of iCollege. 2 Part III: The following structures are designed to store information about objects on a graphics screen. A point structure stores the x and y coordinates of a point on the screen. A rect structure stores the coordinates of the upper left and lower right corners of a rectangle. struct point { int x, int y;}; struct rect { struct point upperLeft, lowerRight; }; 1) Write functions that perform the following operations on a rect structure r passed as an argument: (a) Compute the center of r, returning it as point value. Function name: Center (b) Move r by x units in the x direction and y units in the y direction, returning the modified version of r. (x and y are additional arguments to the function.) Function name: Move 2) Suppose following declaration is in effect. struct rect *p; Assume that we want p point to a rect structure whose upper left corner is at (9,8) and whose lower right corner is (2,1). Write a series of statement that allocates such a structure and initialize it as indicated. 3) Now modify rect structure by adding one more member in it as following: struct rect { struct point upperLeft, lowerRight; char *name; }; Assume that we want p point to a rect structure whose upper left corner is at (9,8), whose lower right corner is (2,1) and name is MyRect. Write a series of statement that allocates such a structure and initialize it as indicated.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started