Write a program with OCaml. Your program will consist of a function that accepts two strings. Each string is the name of a file. The first is the name of an input file and the second is the name of an output file. Name the function pangram. (Note that your program can also make use of other helper functions. Just make sure function pangram takes as arguments the input file and output file that are specified in the program) A pangram is a sentence that contains all the letters of the English alphabet at least once. For example, the quick brown fox jumps over the lazy dog is a pangram. The program you are to write must read in an input file (input.txt- a plain text file which contains 5 sentences), line by line and check if the line read is a pangram or not. If the sentence read is a pangram, it writes true to the output file. If it is not, it writes false to the output file. For example, if input.txt contains: we promptly judged antique ivory buckles for the next prize. how quickly daft jumping zebras vex. pottery is an art. crazy fredrick bought many very exquisite opal jewels. mr. dumbledore is a funny name for a dog. Then your program must output the following to the output.txt: true true false true false NOTE: Text that you write to the output file (output.txt) is case sensitive - please use all lower case when you write to the output file. Moreover, the example provided here is only representative and has been formatted to look good in pdfs, take a look at the sample input and output files for a precise formatting of what your program will actually read in and should output. You can assume that input.txt contains all the letters are in lower case. Please use the sample test cases provided to test your code locally and submit your solution to Autolab for grading. For the purpose of this assignment, you do not need to do any specific error checking on the files. Your program can assume that the files exist (for the input file) or can be created or overwritten (for the output file).

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
icon
Related questions
Question

Make sure to show the full code with the screenshot of the output. 

## Writing a Pangram Checker Program Using OCaml

### Task Overview
In this assignment, you are required to write a program in OCaml that checks if sentences are pangrams. A pangram is a sentence that contains all the letters of the English alphabet at least once. Your task is to create a function that accepts two strings, each representing the name of a file. The first string is the name of an input file, and the second is the name of an output file. This function will determine if each sentence in the input file is a pangram and then write the results to the output file.

### Program Specification

#### Function Definition
- **Function Name:** `pangram`
- **Arguments:** Two strings (names of the input and output files)

The function `pangram` should:
1. Read and process each sentence in the `input.txt` file.
2. Determine if each sentence is a pangram.
3. Write `true` for pangram or `false` for non-pangram lines to the `output.txt` file.

#### Pangram Definition
A pangram is a sentence that includes every letter of the English alphabet at least once. Example: "The quick brown fox jumps over the lazy dog" is a pangram.

### Example

#### Input File (`input.txt`):
```
we promptly judged antique ivory buckles for the next prize.
how quickly daft jumping zebras vex.
pottery is an art.
crazy frederick bought many very exquisite opal jewels.
mr. dumbledore is a funny name for a dog.
```

#### Output File (`output.txt`):
```
true
true
false
true
false
```

### Additional Notes

1. **Case sensitivity:** The output results should be written in lowercase (`true` or `false`).
2. **Example files:** The provided example files are for representation and formatting purposes. Ensure the formatting in your actual submission matches this example.
3. **Input Assumptions:** The input file will contain only lowercase alphabets and spaces.
4. **Testing:** Use the sample test cases provided to test your code locally. Submit your working solution to Autolab for grading.
5. **Error Handling:** You are not required to perform any special error handling for the purpose of this assignment.
6. **File Existence:** Assume the input file exists and is readable, and the output file can be created or overwritten.

By following
Transcribed Image Text:## Writing a Pangram Checker Program Using OCaml ### Task Overview In this assignment, you are required to write a program in OCaml that checks if sentences are pangrams. A pangram is a sentence that contains all the letters of the English alphabet at least once. Your task is to create a function that accepts two strings, each representing the name of a file. The first string is the name of an input file, and the second is the name of an output file. This function will determine if each sentence in the input file is a pangram and then write the results to the output file. ### Program Specification #### Function Definition - **Function Name:** `pangram` - **Arguments:** Two strings (names of the input and output files) The function `pangram` should: 1. Read and process each sentence in the `input.txt` file. 2. Determine if each sentence is a pangram. 3. Write `true` for pangram or `false` for non-pangram lines to the `output.txt` file. #### Pangram Definition A pangram is a sentence that includes every letter of the English alphabet at least once. Example: "The quick brown fox jumps over the lazy dog" is a pangram. ### Example #### Input File (`input.txt`): ``` we promptly judged antique ivory buckles for the next prize. how quickly daft jumping zebras vex. pottery is an art. crazy frederick bought many very exquisite opal jewels. mr. dumbledore is a funny name for a dog. ``` #### Output File (`output.txt`): ``` true true false true false ``` ### Additional Notes 1. **Case sensitivity:** The output results should be written in lowercase (`true` or `false`). 2. **Example files:** The provided example files are for representation and formatting purposes. Ensure the formatting in your actual submission matches this example. 3. **Input Assumptions:** The input file will contain only lowercase alphabets and spaces. 4. **Testing:** Use the sample test cases provided to test your code locally. Submit your working solution to Autolab for grading. 5. **Error Handling:** You are not required to perform any special error handling for the purpose of this assignment. 6. **File Existence:** Assume the input file exists and is readable, and the output file can be created or overwritten. By following
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

Where is the screenshot of the terminal? How do I know whether this code works completely? I need to see the output. 

Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
File Input and Output Operations
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education