W2021 CST8234 – C Programming XXXXXXXXXXDue Date: March 21, XXXXXXXXXX:59) 03_CST8234_StudRegSystemPlotter – lab 04- 1 / 3 Lab 04: To demonstrate command of I/O Note: Students must demonstrate their...

1 answer below »
c


W2021 CST8234 – C Programming Due Date: March 21, 2021 (23:59) 03_CST8234_StudRegSystemPlotter – lab 04- 1 / 3 Lab 04: To demonstrate command of I/O Note: Students must demonstrate their lab in the following week of March (22-26)th, 2021 to get the grade. This lab is worth 20marks. A Missed demonstration will result in 25% grade deduction. Late submission and late demonstration to the lab is welcomed but with a loss of marks. That is, you do not earn full marks for late submission. 10% penalty for every day late up to 50%. Work will not be ac- cepted after 10 days. You must talk to your lab professor in case of any unprecedented situation which may result in late submission. You are required to submit the screenshot of your terminal showing successful execution of the pro- gram (including relevant display messages or output statements) along with properly commented (as per assignment submission standards doc on BrightSpace) .c file and makefile of your code. Problem Statement: Collaborating Plotter You are asked to write a C program coPlot.c that will cooperate with the end-user, accept keyboard input during execution, and output the results based on the user's commands. More precisely, your program will support the following "commands" typed-in by the end-user during runtime: 1> Bit operations: Logic Gate Operands Manipulation bit_or bitwise OR of the two specified integers bit_and bitwise AND of the two speci-fied integers bit_xor bitwise XOR of the two specified integers bit_shift_left
shift the bits of the integer s k bits to the left bit_shift_right
shift the bits of the integer s k bits to the right 2> String Operations: reverse - reverse of the specified string 3> Termination: exit - stop the execution of your program W2021 CST8234 – C Programming Due Date: March 21, 2021 (23:59) 03_CST8234_StudRegSystemPlotter – lab 04- 2 / 3 When your program is started, it should ask the user for a command to run. Once the user types-in the command, your program should do the processing and print the results to the screen. This shall continue until the user types the exit command, at which point your program terminates. Here is an example run: • :~> ./coPlot >> Please enter a command to run. bit_or 15 25 31 >> Please enter a command to run. bit_and 15 25 9 >> Please enter a command to run. bit_xor 15 25 22 >> Please enter a command to run. reverse hello olleh >> Please enter a command to run. reverse CST_8234_Intro_to_C_Prog gorP_C_ot_ortnI_4328_TSC >> Please enter a command to run. exit Good Bye! Useful Tips: • Use the function atoi, defined in stdlib.h, to convert string input from the user to an integer for the bitwise operations. • chars have numerical values in ASCII (for example 'a' has the numerical value 97, 'A' has value 65, and '0' has value 48 in ASCII). Additionally, sequential characters have sequential numerical values (for example, 'b' has value 98 and 'c' has value 99). Thus, to get the character forward from char c, you can just do c+1. Submission Instructions • You must submit your source code (.c file) and makefile in the assigned submission folder on BRS section 010 (activities  Assignments). We don’t need your entire project folder. • You will need to demo this code in your lab session, the week of March 22-26th, 2021. During demonstration, you must be able to answer any questions related to the assessment. W2021 CST8234 – C Programming Due Date: March 21, 2021 (23:59) 03_CST8234_StudRegSystemPlotter – lab 04- 3 / 3 • Your programs will be compiled with GCC and tested on WSL. Keep in mind that your assign- ment testing will be on fixed environment and therefore your applications is expected to run on that. Marking Scheme Item Penalty Coding correctness (functions’ structure) is substandard 5 marks Inappropriate and Inefficient Logic 1 marks Other specification violations 2 marks Defilements in regards to distribution of well-contained functions between files and makefile 2 marks Missed demonstration 5 marks Input validation is inacceptable 5 marks Total _Out of 20. Academic Integrity Reminder Remember that you may have general discussions about how to approach this problem with your peers, but you should work on the final solution by yourself alone. Problem Statement: Collaborating Plotter
Answered 2 days AfterMar 13, 2021

Answer To: W2021 CST8234 – C Programming XXXXXXXXXXDue Date: March 21, XXXXXXXXXX:59)...

Arun Shankar answered on Mar 16 2021
136 Votes
#include
#include
#include
int main(void)
{
char command[100]
, a[100], b[100];
int proceed = 1;
while(proceed)
{
printf("\nPlease enter a command to run.\n");
scanf("%s", command);
if(strcmp(command, "exit") == 0)
{
printf("\nGood Bye!");
proceed = 0;
}
else if(strcmp(command, "reverse") == 0)
{
scanf("%s", a);
int i = 0;
for(; a[i]!= '\0';...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here