|
CSIS 250 Spring 2000 Assignment #5Date Assigned: March 27, 2000 Date Due: April 5, 2000 at 10:00 AM Total points: 18 Develop a function (displaySmart) to create smart output for CNode as described below and discussed in the class. coef expo output output case# conditions stand smart ---- ---- ------ ------- ---- ----------------- 0 0 0*x^0 0 1 coef==0 0 1 0*x^1 0 0 2 0*x^2 0 1 0 1*x^0 +1 2 coef<>0 and expo==0 2 0 2*x^0 +2 -3 0 -3*x^0 -3 1 1 1*x^1 +x 3 coef==1 or coef==-1 and expo==1 -1 1 -1*x^1 -x 1 2 1*x^2 +x^2 4 coef==1 or coef=-1 and expo>1 1 3 1*x^3 +x^3 -1 4 -1*x^4 -x^4 2 1 2*x^1 +2*x 5 coef>1 or coef<-1 and expo==1 3 1 3*x^1 +3*x -4 1 -4*x^1 -4*x 2 2 2*x^2 +2*x^2 6 coef>1 or coef<-1 and expo>1 2 3 2*x^3 +2*x^3 -2 4 -2*x^4 -2*x^4 Run enough iterations to cover each case specified above. For each pair of coef and expo values display the following: values of coef and expo standard output case # smart output a blank line or a string of asterisks Submit the following (do not submit the entire source code, submit only your contribution): 1. Printed source code of displaySmart function (6 points) 2. Printed source code of testDisplaySmart function (6 points) 3. Printed sample runs (6 points) |