Question: Problem Specification For this programming assignment, you will implement of a C program for printing digits 0 , 1 , 2 , . . .
Problem Specification
For this programming assignment, you will implement of a C program for printing digits
on console using three horizontal segments a g and d and four vertical segments
f b e and c as depicted in Figure
Figure : Top row from left to right depicts how digits are represented using seven
segments. Bottom row from left to right depicts how digits are represented using seven
segments.
To draw each horizontal segment, you need to print two rows of asterisks and to draw
each vertical segment, you need to print two columns of asterisks. The length of horizontal
and vertical segments will be given by the user of the program. Figure is an example of
displaying digit using seven segments made of asterisks.
Program Input
The program starts by displaying the following message:
This is a segment display! Press Enter after providing any number in keyboard.
Please enter the length of horizontal segments from to :
After the user enters the length of horizontal segments using keyboard, your program will
check the entered length. If the length is less than or greater than the program must
Figure : How digit is represented using asterisks. In this example, the length of each
horizontal segment is asterisks and the length of each vertical segment is asterisks.
print a message stating that the length is not acceptable and the user must try entering the
length again. When user enters an acceptable length for the horizontal segments, then, the
program prints out the following message on screen:
Now enter the length of vertical segments from to :
After the user enters the length of vertical segments using keyboard, your program will
check the entered length. If the length is less than or greater than the program must
print a message stating that the length is not acceptable and the user must try entering the
length again. Also, if the length of vertical segment is greater than twice the length
of horizontal segment or less than half of the length of horizontal segment, the
program must print a message stating that the length is not acceptable and the user must try
entering the length again. When user enters an acceptable length for the vertical segments,
then, the program prints out the following message on screen:
Enter a positive integer:
After the user enters the positive integer, the program checks to see if the user input
is a valid positive integer. If the user input is not legal, the program must print out a
message stating that the user input is not acceptable and the user must try entering the
positive integer again. When user enters an acceptable input a positive integer the program
prints out the sevensegment representation of that number. Then, the program repeats this
process printing the message Enter a positive integer: and printing out its sevensegment
representation indefinitely.
To end this infinite loop, user can simply presses Ctrl D which is a way to pass
EOF character to the program via standard input stream keyboard
Submissions
You need to submit a zip file compressing the C source files related to the assignment
c files header filesh files if any, a snapshot of your Unix terminal running GDB
on your code jpg or png file and a makefile. Please use sevenseg to name the
executable of your program in the makefile to make sure that the autograder can
successfully run your program. Do NOT include the autograder in your submission.
Grading Criteria
makefile:
GDB Snapshot and Correctness of C syntax no compilation error:
Proper scan and error checking of user input via keyboard:
Proper print of digits on screen:
Figure : Top row from left to right depicts how digits are represented using seven
segments. Bottom row from left to right depicts how digits are represented using seven
segments.
To draw each horizontal segment, you need to print two rows of asterisks and to draw
each vertical segment, you need to print two columns of asterisks. The length of horizontal
and vertical segments will be given by the user of the program. Figure is an example of
displaying digit using seven segments made of asterisks.
Program Input
The program starts by displaying the following message:
"This is a segment display! Press "Enter" after providing any number in keyboard.
Please enter the length of horizontal segments from to :
After the user enters the length of horizontal segments using keyboard, your
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
