The Fall 2019 Career Fair will be in the CH2M Hill Alumni Center on Wednesday, 10/23, 11am – 3pm.
- Please attend this event for just a little while, and write a paragraph with 3-5 sentences about your experience.
OR
- If you cannot attend the event, write a paragraph with 3-5 sentences about two companies (2 paragraphs total) you would like to visit at the career fair in the future and why you are picking these companies. You should also look up the company online to add to your knowledge about that company.
Design for Computation
We have been learning about problem-solving steps, control structures, and functions. In this computational section, you will use your understanding of selection and repetition control structures, as well as decomposition/functions, to solve the following problem.
Design a program to calculate the summation or integration of three different functions: f1(x) = 10x2 f2(x) = 2x2 – 5
f3(x) = x+20
Your program will ask the user to decide if they want to calculate the summation or integration and for which function (f1-f3). If integration is chosen, then you need to ask the user which approximation method to use, i.e. rectangle or trapezoids. This will help you gain experience thinking about when to use selection, repetition, and functions to solve a problem.
Your program will be very robust and handle all errors, and it will be properly decomposed into tasks and subtasks. Your design needs to clearly indicate what these tasks/functions will be and the corresponding algorithm you will use in each task. For example, you will likely need a task to get the user’s choice of summation or integration, and you will need tasks for calculating the summation and integration.
Summation Explanation:
Your program should determine the summation of whichever function the user chooses (f1-f3), but think about the evaluation of the function as a task itself to abstract the details of which function you are evaluating. For Example, if your f(x) = 2x:
𝑏 ∑2x
𝑥=𝑎
a is the starting point/lower limit for x and b is the stopping point/upper limit for x. If the user enters a starting point of 0 and stopping point of 2, then the summation would be 2*0+2*1+2*2 = 6 (or more abstractly f(0)+f(1)+f(2)).
Integration Explanation:
Your program should determine the area under the function the user chooses to integrate, and you will calculate the area under a curve using the rectangle or trapezoid method, depending on the method the user chooses. Don’t freak out!!! Programming integration into the computer does not consist of calculus!!!!!! It is simple math, and these two methods only require summing the area of a certain number of rectangles or trapezoids under a specific curve, f(x).
For Example, if your f(x) = 2x
Basic Numerical Methods (Rectangle vs. Trapezoid):
n = number of rectangles and/or trapezoids a = beginning x value b = boundary for rectangles
width = width of each rectangle/trapezoid, (b-a)/n
height_rectangle = f(x), where x changes by width for each rectangle
height_trapezoid = (f(x1)+f(x2))/2, where x1 and x2 change by width for each trapezoid area = width * height
The functions are bounded by any interval on the x-axis, including both positive and negative values!!!. You can check your answers:
http://www.wolframalpha.com/widgets/view.jsp?id=8ab70731b1553f17c11a3bbc87e0b605
Here is an example of how thorough you need to be in your design:
http://classes.engr.oregonstate.edu/eecs/fall2019/cs160–030/assign/Polya_template.pdf
This example design is only for a program that averages 5 numbers, so you can imagine how detailed you should make this program design for full credit! If you write this on paper, then you can scan you papers and save as a pdf in the library.
Step 1: Understanding the Problem/Problem Analysis. (20 pts)
Do you understand everything in the problem? List anything you do not fully understand, and make sure to ask a TA or instructor about anything you do not understand.
- What are the user inputs/requirements, program outputs, etc.? (5 pts)
- What assumptions are you are making? (5 pts)
- What are the functional requirements of this problem? (5 pts)
- What are all the tasks and subtasks in this problem? (5 pts)
Step 2: Program Design. (45 pts)
- What does the overall big picture of this program look like? (flowchart or pseudocode) (20 pts) o What are all the higher-level tasks to accomplish in this program, and where will you call each task? For example, you will call f1-f3 in the summation and in the integration task.
o What are the decisions that need to be made to determine which high-level tasks to complete?
- Based on all the tasks you identified, what does the algorithm details in each task look like? (flowchart or pseudocode) (20 pts) o What are the decisions you’ll make within each task?
- How and where are you going to handle bad input? (5 pts)
Based on your answers above, list the specific steps or provide a flowchart of what is needed to create this calculator with two modes. Be very explicit!!!
Step 4: Program Testing. (15 pts)
Create a test plan with the test cases (bad, good, and edge cases). What do you hope to be the expected results?
o What are the good, bad, and edge cases for ALL input in the program?
(10 pts) Extra Credit:
Add to your design the ability to have the user repeat this process until they no longer wish to do calculations.


