Question: 1. Write Racket expressions that do the following: a. Defines a function printValue that takes a list consisting of symbol, price and shares as arguments
1. Write Racket expressions that do the following: a. Defines a function printValue that takes a list consisting of symbol, price and shares as arguments and prints out the stock symbol and the value of price x shares b. Binds the list ("AAPL", 100, 5) to the variable appleStock c. Calls the function printValue with the variable appleStock
2. Write Racket expressions that do the following: a. Defines a function compareValue that takes two lists consisting of symbol, price and shares as arguments and returns true if the first argument has a greater value (price x shares) than the second argument, and false otherwise b. Binds the list ("IBM", 30, 10) to the variable ibmStock c. Calls the function compareValue with appleStock and ibmStock as arguments
3. Write Racket expressions that do the following: a. Defines a function findMaxValue that takes a list of lists consisting of symbol, price and shares as arguments and returns the stock with the greatest value (price x shares). b. Binds the list ("GOOG", 70, 15) to googleStock c. Binds the list ("FB", 20, 8) to facebookStock d. Creates a list of all four stock lists (appleStock, ibmStock, googleStock and facebookStock) bound to stockList e. Calls findMaxValue with stockList as its argument
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
