首页 > > 详细

辅导Java编程、Computational Thinking程序讲解留学生、解析Computational Thinking编程、Matlab语言讲解留学生

COMPSCI 1JC3
Introduction to Computational Thinking
The purpose of Assignment 5 is implement a practical higher-order func-
tion. The requirements for Assignment 5 are given below. Please submit
Assignment 5 as a single .hs le to the Assignment 5 folder on Avenue
under Assessments/Assignments. Assignment 5 is due December 2, 2017
before noon. Unlike the previous assignments, there is not an extra credit
version of Assignment 5.
Although you are allowed to receive help from the instructional
sta and other students, your submitted program must be your
own work. Copying will be treated as academic dishonesty!
1 Background
Using the trapezoidal rule, the value of a de nite integral
Z baf(x)dxcan be approximated by the summation
nXi=1f(xi 1) + f(xi)2 b anwhere
a = x0 Double -> (Double -> Double) -> Integer -> Double
such that
definiteIntegral a b g n
computes an approximation to the de nite integral
Z b
a
f(x)dx
using the trapezoidal rule with n partitions and using g to represent
the function f : R!R.
5. The le includes a function circleArea of type
Double -> Double
such that circleArea r computes the area of a circle of radius r using
definiteIntegral.
6. The le includes a function sphereVolume of type
Double -> Double
such that sphereVolume r computes the volume of a sphere of radius
r using definiteIntegral.
7. Your le can be imported into GHCi and all of your functions perform
correctly.
2.2 Testing
Include in your le a test plan for all the functions mentioned above. The
test plan must include at least three test cases for each function. Each test
case should have following form.:
Function: Name of the function being tested.
Test Case Number: The number of the test case.
Input: Inputs for function.
Expected Output: Expected output for the function.
Actual Output: Actual output for the function.
In addition, your test plan must include at least three QuickCheck cases
for definiteIntegral. Each QuickCheck case should have following form.:
Function: Name of the function being tested.
Property: Code de ning the property to be tested by QuickCheck.
Actual Test Result: Pass or Fail.
The test plan should be at the bottom of your le in a comment region
beginning with a f- line and ending with a -g line.
 

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!