Define a struct to represent a product item with the fields: name, ID, price. 2) Define two named instances: “Trousers” 012 100 and “Shirt” 345 85. 3) Write a function that takes as argument: one struct instance, a new value for the name (string) and new value for price field. The function will overwrite the previous values for the name field and price field in the called struct instance. For example, you create struct instance item_1 with the value from point 2 “Jeans” 1223 50. When you run the function, it will update the name and price fields with the new values from the argument of the function. Make sure to explain what the difference between mutable and immutable is, as comments in your Racket file.
Define a struct to represent a product item with the fields: name, ID, price.
2) Define two named instances: “Trousers” 012 100 and “Shirt” 345 85.
3) Write a function that takes as argument: one struct instance, a new value for the
name (string) and new value for price field. The function will overwrite the previous
values for the name field and price field in the called struct instance. For example,
you create struct instance item_1 with the value from point 2 “Jeans” 1223 50. When
you run the function, it will update the name and price fields with the new values from
the argument of the function. Make sure to explain what the difference between
mutable and immutable is, as comments in your Racket file.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps