Write your programs using Racket functional language. Run each of the programs as many times as necessary
Question:
Write your programs using Racket functional language.
Run each of the programs as many times as necessary to show that different situations are handled properly.
- n the beginning of each part of this problem, introduce a named value sqr3, which is 1.732. You will have to write a function my_calc that takes two numerical parameters. If the first parameter is 1, calculate the area of an equilateral triangle, whose side equals the second parameter of the function. If the first parameter is 2, calculate the area of the hexagon, whose side equals the second parameter of the function. For other values of the first parameter and for a non-positive second parameter return a false Boolean value.
- (a) Implement a function my_calc using a multiple-way selection structure when checking the value of the first parameter.
- (b) Implement a function my_calc using a two-way selection structure when checking the value of the first parameter.
2. Write a Racket function rem_two that takes a simple list as a parameter and returns a list identical to the parameter except with the second and third elements removed. If the given list does not have at least 3 elements, the function should return an empty list. Remember that you are NOT allowed to use standard functions for finding the length of the list.
3. Write a function my_delete that takes two parameters: an atom and a list (which may be a nested list). This function will produce a list, identical to its parameter list, except with all occurrences of an atom parameter removed, no matter how deep they were. The produced list should not have anything in place of the deleted atoms.
Principles Of Information Security
ISBN: 9780357506431
7th Edition
Authors: Michael E. Whitman, Herbert J. Mattord