

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Some concept of Computers and Programming I are Practice Analyzing, Student Proctor, Practice Analyzing, Practice Array, Problem Statement. Main points of this assignment are: Problem Statement, Problem Statement, Running, Testing, Program, Expressions, Incremental Development, Practice Writing, Practice Analyzing, Nicklaus
Typology: Exercises
1 / 2
This page cannot be seen from the preview
Don't miss anything!


Purpose
Introduction
One of Nicklaus Wirth's books was entitled "Algorithms + Data Structures = Programs." In this assignment we will work with integer and real number data types to practice converting mathematical expressions into C++ expressions. The function we will work with is the following:
Instructions
Write a C++ program to answer the questions below. Pay attention to the coding standards for this class! The output of your program should be a one line answer for each of the 8 questions below. Each answer should start with the text "question X: ", where X is replaced by the letter of the question being answered.
// question a: what is f(2) if a==13, b==5, c==6, d==7?
// question b: assume no change in coefficients, what is f(77)?
// question c: what is f(-2) if the coefficients are all
// negative?
// question d: assuming same coefficients as question c, what is // f(-77)?
// question e: assuming same coefficients as question c, print // the larger of f(-32) and f(-8)
// question f: assume same coefficients as question c, ask the // user for an integer. // Let Z represent the integer the user typed. What is f(Z)? // BE CAREFUL! Consider all possibilities and consequences of Z!
// question g: repeat question f (ask for another integer.)
// question h: repeat question f (ask for another integer.)
Questions g and h do exactly the same thing that question f does.
TEST your code!!! I will be testing your code. You want to catch as many errors (and fix or document them) before I catch them. This is what happens in the industry. As a professional you will want to catch as many errors as you can, instead of suffering the embarrassment of having your users catch them!
How do you test your code? Think about possibilities and consequences. If the user types 5, what will my program do? Would that be valid? If my code is correct, what should the actual value of f(-77) be? Did I get that value? If not, what's wrong with my code?
Don't wait until you have written all the code to test it! Write the code to answer question a, compile and link, then test! When that's working, repeat for the next question. This is called incremental development.
Deliverables
Submit hard copy of your source code; Submit hard copy of your running results. Grading ♦ Clean compile 50%. Non-compiling code results in zero for this assignment. ♦ 50% for correctly functioning algorithms, subject to conformance to coding standards. Untested or insufficiently tested algorithms will result in proportionate deductions.