Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Haskell programming language (1) Write a averageThree function to return the average of three integers. averageThree :: Integer -> Integer -> Integer -> Float

In Haskell programming language (1) Write a "averageThree" function to return the average of three integers. averageThree :: Integer -> Integer -> Integer -> Float

(2) Write a "howManyAboveAverage" function which returns how many of three integer inputs are above its average value. (utilize the averageThree function.) howManyAboveAverage :: Integer -> Integer -> Integer -> Integer

(3) Write a "howManyWithinThreshold" function that returns how many of the first three arguments are within the threshold (the fourth argument) of the average of the first three arguments. (utilize the averageThree function and the logic in the howManyAboveAverage function.) howManyWithinThreshold :: Integer -> Integer -> Integer -> Float -> Integer

I personally have completed (1) and (2)!

[sample of (1)] averageThree :: Integer -> Integer -> Integer -> Float averageThree a b c = (fromIntegral (a + b + c)) / 3

All i need help with is 3, where i am stuck and can not resolve!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Shamkant B. Navathe

7th Edition Global Edition

1292097612, 978-1292097619

More Books

Students also viewed these Databases questions

Question

Describe the DBA's responsibilities.

Answered: 1 week ago