"ALBUM by ARTIST". Finally, computers should be "Public Computer". You may find the OCaML function string_of_int: int -> string helpful. Example Outputs # string_of_item (Book ("Types and Programming Languages", "Benjamin Pierce"));; -: string = "Types and Programming Languages by Benjamin Pierce" # string_of_item (Movie ("The Imitation Game", 2014)) ;; string= "The Imitation Game (2014)" # string_of_item Computer;; - string = "Public Computer" 2.2 string_of_entry checkout_entry -> string The second function you must implement converts checkout_entry to a string. An normal Item shall be rendered just as the wrapped catalog_item would be. A new entry should be rendered as "(NEW) ENTRY", where ENTRY is the wrapped checkout_entry. A pair should be "ENTRY1 and ENTRY2", where ENTRY1 and ENTRY2 are the items. In implementing this function, you may wish to call the string_of_item function you previously wrote. Example Outputs # string_of_entry (Item (Book ("Types and Programming Languages", "Benjamin Pierce"))) ;; - string = "Types and Programming Languages by Benjamin Pierce" #string_of_entry (New (Item (Movie ("The Imitation Game", 2014)))) ;; -: string = "(NEW) The Imitation Game (2014)" 2.3 daily_fine checkout_entry -> float The third function you must implement computes the fines (in dollars) incurred for each day an item is overdue. The fines are as follows: • Books: 0.25 • Movie: 0.50 • CD: 0.50 • Computer: 0.00 • New Items: Double the normal fine • Pair: The sum of the fines for each item 2.4 total fine: checkout list -> float The fourth function you will implement takes a list of checkout and returns the total fine for all items. Remember, if the int option is None, the item is not overdue and thus no fines are due for that item. You may find float_of_int : int -> float helpful in implementing this function.
"ALBUM by ARTIST". Finally, computers should be "Public Computer". You may find the OCaML function string_of_int: int -> string helpful. Example Outputs # string_of_item (Book ("Types and Programming Languages", "Benjamin Pierce"));; -: string = "Types and Programming Languages by Benjamin Pierce" # string_of_item (Movie ("The Imitation Game", 2014)) ;; string= "The Imitation Game (2014)" # string_of_item Computer;; - string = "Public Computer" 2.2 string_of_entry checkout_entry -> string The second function you must implement converts checkout_entry to a string. An normal Item shall be rendered just as the wrapped catalog_item would be. A new entry should be rendered as "(NEW) ENTRY", where ENTRY is the wrapped checkout_entry. A pair should be "ENTRY1 and ENTRY2", where ENTRY1 and ENTRY2 are the items. In implementing this function, you may wish to call the string_of_item function you previously wrote. Example Outputs # string_of_entry (Item (Book ("Types and Programming Languages", "Benjamin Pierce"))) ;; - string = "Types and Programming Languages by Benjamin Pierce" #string_of_entry (New (Item (Movie ("The Imitation Game", 2014)))) ;; -: string = "(NEW) The Imitation Game (2014)" 2.3 daily_fine checkout_entry -> float The third function you must implement computes the fines (in dollars) incurred for each day an item is overdue. The fines are as follows: • Books: 0.25 • Movie: 0.50 • CD: 0.50 • Computer: 0.00 • New Items: Double the normal fine • Pair: The sum of the fines for each item 2.4 total fine: checkout list -> float The fourth function you will implement takes a list of checkout and returns the total fine for all items. Remember, if the int option is None, the item is not overdue and thus no fines are due for that item. You may find float_of_int : int -> float helpful in implementing this function.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
OCaml Code: Make sure to show the full code and take a screenshot of the output. Make sure to use various test cases as well. There must be no error in the code at all. Make sure the code prints out all of the example outputs that is circled in the image attached.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education