Question: 1 4 . 7 Project 4 : Identifier Functions Overview Name this program p 4 . c - This program will read a series of

14.7 Project 4: Identifier Functions
Overview
Name this program p4. c - This program will read a series of string tokens until end-of-file/EOF (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
1024
7
07
Output: "The token is a positive integer \
"
Negative Integer
The token starts with - and is followed by one or more digits.
Examples
-1024
-7
-07
Output: "The token is a negative integer
"
Binary Number
The token starts with 0 b (zero & lowercase b) and is followed by one or more 0 s and 1 s .
Examples
Ob0101
Ob1
Ob0
Output: "The token is a binary number
"
GUID (Globally Unique IDentifier)
The token contains 36 characters in the following format xxXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX where X is a hex
digit.
8 chars dash 4 chars dash 4 chars dash 4 chars dash 12chars
Hex digits are in the character set {0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,a,b,c,d,e,f}
Examples
7d430162-0cc9-46ab-8abf-2ae6d62fd334
37596153-D158-46da-acf7-d0Cb6C4Ab085
Output: "The token is a guid
"
Positive Floating-Point Number
A double or float is an example of a floating-point number.
The token contains only digits except for a decimal point located between digits.
Examples
1024.5
7.0
01.00
Invalid Examples
.5
5.
Output: "The token is a positive floating-point number \
"
Negative Floating-Point Number
The token starts with a - and is followed by only digits except for a decimal point located between digits.
Examples
-1024.5
-7.0
-01.00
Output: "The token is a negative floating-point number \
"
Other
If the token does not match one of the types above, output "The token cannot be identified \
".
Example
./a.out
Enter a token to identify, EOF to stop:
1024
The token is a positive integer
Enter a token to identify, EOF to stop:
-1024
The token is a negative integer
Enter a token to identify, EOF to stop:
0b0101
The token is a binary number
Enter a token to identify, EOF to stop:
12345678-1234-1234-1234-123456789abC
The token is a guid
Enter a token to identify, EOF to stop:
1024.0
The token is a positive floating-point number
Enter a token to identify, EOF to stop:
-1024.0
The token is a negative floating-point number
Enter a token to identify, EOF to stop:
text123!
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 !0(true) or 0(false) if the token parameter is or is not the
specific type indicated:
int isPositiveInteger (char token[]);
int isNegativeInteger(char token[]);
int isBinaryNumber(char token[]);
int isGuid(char token[]);
int isPositiveFloatingPoint (char token[]);
int isNegativeFloatingPoint(char token[]);
Notes
Assume each input string token will contain less than 100 characters.
Because of the definition/rules of each type, no token can satisfy multiple type definitions.
You must determine if the token is one of the types by looping through and/or 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 [0, length-1] 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: 15
Negative Integer. 15
Binary Number. 20
GUID: 20
Positive Floating-Point Number: 15
Negative Floating-Point Number: 15
1 4 . 7 Project 4 : Identifier Functions Overview

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!