Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Each part of this lab will use the same input file, named lab3-in.dat. This file will be located in the same directory as the executables

Each part of this lab will use the same input file, named lab3-in.dat. This file will be located in the same directory as the executables (do not specify a path for the file in the Select statements). This file is a roster of animals in a travelling carnival.

The record format for the file is as follows:

Field Description Length Data Type

Name 12 String

Gender 1 String

Species 15 String

The end result of each part of this assignment is the same. You will be given different programming specifications in each, to force you to use some of the different statements and concepts we have discussed recently. If some aspect of a program does not have specifications dictating how to accomplish that part, then you are free to use whatever approach you wish.

Each program is a hybrid of batch and interactive. The input is coming from a file, but the output will be going to the console window; there is no output file. The programs will determine how many animals fall into each class. These classes, and animal species in each, are (note the proper case):

Amphibian: (Frog, Newt, Salamander, Toad)

Bird: (Albatross, Eagle, Falcon, Hawk, Pelican, Vulture)

Mammal: (Ape, Cheetah, Chimp, Coyote, Lion, Mongoose, Otter, Tiger, Wolf)

Reptile: (Alligator, Boa, Cobra, Komodo, Turtle, Viper)

Other: Anything else

The output should consist solely of class names and counts, nicely formatted. Allow 3 digits for each count.

This will seem like more work than it is; a lot of the code amongst each part is the same so there are plenty of copy-and-paste opportunities.

Part A

You will create an OpenCOBOL program, named lab3a.cob, that will generate the desired counts adhering to the following specifications:

Use a condition name to denote and check for the end of file. Use Set to manipulate the end of file variable

Use condition names and If statements to determine in which category each animal belongs

Part B

You will create an OpenCOBOL program, named lab3b.cob, that will generate the desired counts adhering to the following specifications:

Use an Evaluate statement without condition names to determine in which category each animal belongs

Part C

You will create an OpenCOBOL program, named lab3c.cob, that will generate the desired counts adhering to the following specifications:

The program will initially prompt the user to provide (from the keyboard) the number of records in the file (the sample file has 71 records). Allow for a 3-digit record count.

o Repeat prompting the user for a record count until the user provides a non- negative value

o You are free to assume that the user will not provide a record count that exceeds the number of records in the file

o You are free to assume the user will only provide numeric values

Instead of checking for the end of file, use the Perform Times loop with the value provided by the user as the limit

Use If statements without condition names to determine in which category each animal belongs

Part D

You will create an OpenCOBOL program, named lab3d.cob, that will generate the desired counts adhering to the following specifications:

The program will initially prompt the user to provide (from the keyboard) the number of records in the file (the sample file has 71 records). Allow for a 3-digit record count.

o Repeat prompting the user for a record count until the user provides a non- negative value

o You are free to assume that the user will not provide a record count that exceeds the number of records in the file

o You are free to assume the user will only provide numeric values

Instead of checking for the end of file, use the Perform Varying loop with the value provided by the user as the limit

Use condition names

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions