Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The purpose of this assignment is to get you up and try some Haskell functions. Download all the*.hs files from Canvas: .CSC207al.hs is the file
The purpose of this assignment is to get you up and try some Haskell functions. Download all the"*.hs" files from Canvas: .CSC207al.hs is the file you will be working on - see details later. .CSC207altester.hs is the tester file - do not modify this file. CSC207a1TestData.hs is the data file for the tester-do not modify this file When we dine out, in addition to the price of the food and tax, we often want to pay tips to the waiters and/or waitresses. In this assignment, we want to write a simple Haskell function to calculate the tips as to a percentage to the price after tax The function calcTips takes four parameters: price, taxRate, and tipsRate, all of them are guaranteed to be positive. The tips can be calculated using the following formula: tips price x (1 + taxRate) x tipsRate Examples .calcTips 20 0.08 0.153.24 . calcTips 30 0.1 0.18 5.94 .calcTips 25 0.07 0.2 5.35 The file "csc207a1.hs" contains the prototype for the function (in which it always returns an impossible value of -1.0). You should change the implementation so that it works as described above. Be careful not to change the first line. It is required to make the tester work. You can test your function using the data shown above. Once you feel comfortable that your function is working correctly, you can use the tester to do more extensive tests. Just load the tester into ghci (or Winghci) and ask it to show the results. The following shows what you get when running the tester against the invalid solution
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started