Question: 1 4 . 7 Project 4 : Identifier Functions Overview Name this program p 4 . c - This program will read a series of
Project : Identifier Functions
Overview
Name this program p c This program will read a series of string tokens until endoffileEOF Ctrl D It will determine the type of each
token, according to the following requirements:
Positive Integer
The token only contains one or more digits.
Examples
Output: "The token is a positive integer
Negative Integer
The token starts with and is followed by one or more digits.
Examples
Output: "The token is a negative integer
Binary Number
The token starts with b zero & lowercase b and is followed by one or more s and s
Examples
Ob
Ob
Ob
Output: "The token is a binary number
GUID Globally Unique IDentifier
The token contains characters in the following format xxXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX where X is a hex
digit.
chars dash chars dash chars dash chars dash chars
Hex digits are in the character set ABCDEFabcdef
Examples
dccababfaedfd
DdaacfdCbCAb
Output: "The token is a guid
Positive FloatingPoint Number
A double or float is an example of a floatingpoint number.
The token contains only digits except for a decimal point located between digits.
Examples
Invalid Examples
Output: "The token is a positive floatingpoint number
Negative FloatingPoint Number
The token starts with a and is followed by only digits except for a decimal point located between digits.
Examples
Output: "The token is a negative floatingpoint number
Other
If the token does not match one of the types above, output "The token cannot be identified
Example
aout
Enter a token to identify, EOF to stop:
The token is a positive integer
Enter a token to identify, EOF to stop:
The token is a negative integer
Enter a token to identify, EOF to stop:
b
The token is a binary number
Enter a token to identify, EOF to stop:
abC
The token is a guid
Enter a token to identify, EOF to stop:
The token is a positive floatingpoint number
Enter a token to identify, EOF to stop:
The token is a negative floatingpoint number
Enter a token to identify, EOF to stop:
text
The token cannot be identified
Enter a token to identify, EOF to stop:
Requirements
You must write six function with the following signatures, which will return true or false if the token parameter is or is not the
specific type indicated:
int isPositiveInteger char token;
int isNegativeIntegerchar token;
int isBinaryNumberchar token;
int isGuidchar token;
int isPositiveFloatingPoint char token;
int isNegativeFloatingPointchar token;
Notes
Assume each input string token will contain less than characters.
Because of the definitionrules of each type, no token can satisfy multiple type definitions.
You must determine if the token is one of the types by looping through andor accessing the token's individual characters. A large
penalty will be deducted for solving the problem without accessing the token's characters.
Be sure to not access an array outside of its bounds length or it may cause a segmentation fault or undefined behavior.
Make sure the output matches the example.
Testing
Be sure to create your own test cases to verify your code works. Create similar but invalid tokens to try and break your code.
Be sure to submit to the format checker project in Submit mode to verify format and that it passes the examples. The format checker
is not graded, and you can submit as many times as you want.
Grading
Note: if you do not pass the valid cases, you will not pass the invalid cases of a particular type.
Points are allocated to each type as follows:
Positive Integer:
Negative Integer.
Binary Number.
GUID:
Positive FloatingPoint Number:
Negative FloatingPoint Number:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
