Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

. INTRODUCTION This project assesses students\' ability to carry out various sof

ID: 3722435 • Letter: #

Question

. INTRODUCTION This project assesses students' ability to carry out various software development activities in order to develop an engineered solution to a given problem. This involves identifying the requirements, writing a specification, designing, testing and evaluating a solution. The process has several stages and some investigation is required so students should plan the work carefully. The project contributes in gaining valuable experience in the understanding of programming using C, and provides an important element in preparation for the end-of-semester examination. Working successfully as a team is a key requirement for working in industry, and for this project students will be working in a group of 3 to 4 members. Lecturers/Instructors will act as the client for the software development project, and students will need to elicit detailed information at appropriate times. The list of delivery requirements appears later in this document. Students should develop the solution to the assignment mainly in their own time, however, some of the office hours will be set aside to enable students to seek clarification, elicit more details from the client, and receive feedback on students' work. In keeping with the practical industrial scenario, there will be two milestones set for deliverable components of the project; the difference in this case is that rather than the company takes a substantial financial penalty for a missed milestone, students will be penalized with a percentage reduction of their assignment mark. The stages of the project are as follows: 1. System Analysis and Design (logical design of your program: defining the main menu, defining all functions and interaction between these functions); and implementing the main menu, and the full system. 2. Project discussion and interview There are no visual elements to the program. The entire program runs using a console window All output will be text based and directed towards the console window Students should not diverge from the project specification. If you do not conform to the project specification then you will lose marks. If you do want to make some addition to the project and you

Explanation / Answer

/*

* smsInC.c

*

* Created on: Mar 5, 2018

* Author: XXXX

*

* Hello,

* I have tried to implement the program as correct as possible.

* Due to time constraint was not able to test and comment thoroghly.

* I will be updating the answer and reupload once tested.

* Do check and try to use the code.

* Thanks.

* P.S do give feedback and thumbs up if the solution is helpful.

*/

#include <stdio.h>

// All the required global variables are declared here

char inbox1[15];

char inbox2[15];

char inbox3[15];

char inbox4[15];

char inbox5[15];

char usersList[5][2] = {{'.','.'},

{'.','.'},

{'.','.'},

{'.','.'},

{'.','.'}};

int usersPin[5]={0,0,0,0,0};

//function to authenticate any user

char doAutenticate(char uname,int pin){

int i;

for(i=0;i<5;i++){

if(usersList[i][0]==uname && usersPin[i]==pin){

return 1;

}

}

return 0;

}

//The function to add a new user

int addUser(char uname,int pin){

char currentUname;

int currentPin;

printf("Enter username and PIN to authenticate yourself and adding a new user: ");

scanf("%c %d",&currentUname,&currentPin);

if(doAutenticate(currentUname,currentPin)==1){

int i;

for(i=0;i<5;i++){

if(usersList[i][0]==uname){

printf("Username already exists. ");

return 0;

}

else if(usersList[i][0]=='.'){

usersList[i][0]=uname;

usersPin[i]=pin;

printf("User added succesfully. ");

return 0;

}

}

printf("Userslist full. ");

}else{

printf("Authentication Failed. Wrong username or password. Returning to main menu... ");

}

return 0;

}

//The function to delete any existing user

int deleteUser(char uname,int pin){

char currentUname;

int currentPin;

printf("Enter username and PIN to authenticate yourself and adding a new user: ");

scanf("%c %d",&currentUname,&currentPin);

if(doAutenticate(currentUname,currentPin)==1){

int i;

for(i=0;i<5;i++){

if(usersList[i][0]==uname){

usersList[i][0]='.';

switch(i+1){

case 1:

inbox1[0]='';

break;

case 2:

inbox2[0]='';

break;

case 3:

inbox3[0]='';

break;

case 4:

inbox4[0]='';

break;

case 5:

inbox5[0]='';

break;

}

usersPin[i]='.';

printf("User deleted successfully. ");

return 0;

}

}

printf("Username does not exist. Recheck and reenter. Returning to main menu... ");

}else{

printf("Authentication Failed. Wrong username or password. Returning to main menu... ");

}

return 0;

}

//This is the function to change the pin

int changePin(char uname,int pin){

char currentUname;

int currentPin;

printf("Enter username and PIN to authenticate yourself and adding a new user: ");

scanf("%c %d",&currentUname,&currentPin);

if(sizeof(pin)/sizeof(int)!=4){

printf("PIN should be 4 digit integer value. Please check and revisit. Returning to main menu... ");

}

else if(doAutenticate(currentUname,currentPin)==1){

int i;

for(i=0;i<5;i++){

if(usersList[i][0]==uname){

usersPin[i]=pin;

printf("User deleted successfully. ");

return 0;

}

}

printf("Username does not exist. Recheck and reenter. Returning to main menu... ");

}else{

printf("Authentication Failed. Wrong username or password. Returning to main menu... ");

}

return 0;

}

//This is the function to go to SMS Submenu

void smsMenu(char uname,char message[]){

int subChoice=0;

printf("Select a option to continue: "

"1. Send SMS to existing user "

"2. View the recieved SMS "

"3. Delete a received SMS "

"4. Return to main menu");

scanf("%d",&subChoice);

char currentUname;

int currentPin;

printf("Enter username and PIN to authenticate yourself and adding a new user: ");

scanf("%c %d",&currentUname,&currentPin);

switch(subChoice){

case 1:

if(doAutenticate(currentUname,currentPin)==1){

int i=0;

for(i=0;i<5;i++){

if(usersList[i][0]==uname){

switch(i+1){

case 1:

if(inbox1!=''){

printf("Inbox full. Can't send message now. Returning to sub menu... ");

}else{

inbox1[0]=message;

usersList[i][1]=currentUname;

printf("Message sent succesfully. ");

}

break;

case 2:

if(inbox2!=''){

printf("Inbox full. Can't send message now. Returning to sub menu... ");

}else{

inbox2[0]=message;

usersList[i][1]=currentUname;

}

break;

case 3:

if(inbox3!=''){

printf("Inbox full. Can't send message now. Returning to sub menu... ");

}else{

inbox3[0]=message;

usersList[i][1]=currentUname;

}

break;

case 4:

if(inbox4!=''){

printf("Inbox full. Can't send message now. Returning to sub menu... ");

}else{

inbox4[0]=message;

usersList[i][1]=currentUname;

}

break;

case 5:

if(inbox5!=''){

printf("Inbox full. Can't send message now. Returning to sub menu... ");

}else{

inbox5[0]=message;

usersList[i][1]=currentUname;

}

break;

}

}

}

printf("Username does not exist. Recheck and reenter. Returning to sub menu... ");

}else{

printf("Authentication Failed. Wrong username or password. Returning to sub menu... ");

}

break;

case 2:

if(doAutenticate(currentUname,currentPin)==1){

int i=0;

for(i=0;i<5;i++){

if(usersList[i][0]==currentUname){

switch(i+1){

case 1:

if(inbox1[0]==''){

printf("Inbox empty.Returning to sub menu... ");

}else{

printf("%c : %s ",usersList[i][1],inbox1);

}

break;

case 2:

if(inbox2[0]==''){

printf("Inbox empty.Returning to sub menu... ");

}else{

printf("%c : %s ",usersList[i][1],inbox2);

}

break;

case 3:

if(inbox3[0]==''){

printf("Inbox empty.Returning to sub menu... ");

}else{

printf("%c : %s ",usersList[i][1],inbox3);

}

break;

case 4:

if(inbox4==''){

printf("Inbox empty.Returning to sub menu... ");

}else{

printf("%c : %s ",usersList[i][1],inbox4);

}

break;

case 5:

if(inbox5==''){

printf("Inbox empty.Returning to sub menu... ");

}else{

printf("%c : %s ",usersList[i][1],inbox5);

}

break;

}

}

}

printf("Username does not exist. Recheck and reenter. Returning to sub menu... ");

}else{

printf("Authentication Failed. Wrong username or password. Returning to sub menu... ");

}

break;

case 3:

if(doAutenticate(currentUname,currentPin)==1){

int i=0;

for(i=0;i<5;i++){

if(usersList[i][0]==currentUname){

switch(i+1){

case 1:

if(inbox1[0]==''){

printf("Inbox empty.Returning to main menu... ");

}else{

inbox1[0]='';

printf("Message deleted successfully. ");

}

break;

case 2:

if(inbox2[0]==''){

printf("Inbox empty.Returning to main menu... ");

}else{

inbox2[0]='';

printf("Message deleted successfully. ");

}

break;

case 3:

if(inbox3[0]==''){

printf("Inbox empty.Returning to main menu... ");

}else{

inbox3[0]='';

printf("Message deleted successfully. ");

}

break;

case 4:

if(inbox4[0]==''){

printf("Inbox empty.Returning to main menu... ");

}else{

inbox4[0]='';

printf("Message deleted successfully. ");

}

break;

case 5:

if(inbox5[0]==''){

printf("Inbox empty.Returning to main menu... ");

}else{

inbox5[0]='';

printf("Message deleted successfully. ");

}

break;

}

}

}

printf("Username does not exist. Recheck and reenter. Returning to sub menu... ");

}else{

printf("Authentication Failed. Wrong username or password. Returning to sub menu... ");

}

break;

}

}

//This is the function to show main menu

void mainMenu(){

int choice=0;

getInput:

printf("Select a option to continue: "

"1. Add a new user "

"2. Delete an existing user "

"3. Change PIN number "

"4. Send or View or Delete SMS "

"5. Exit. ");

scanf("%d",&choice);

char uname;

int pin;

char message[15];

switch(choice){

case 1:

printf("Enter username and PIN for new user:");

scanf("%c %d",&uname,&pin);

addUser(uname,pin);

goto getInput;

case 2:

printf("Enter username and PIN of the existing user:");

scanf("%c %d",&uname,&pin);

deleteUser(uname,pin);

goto getInput;

case 3:

printf("Enter username and PIN of the existing user:");

scanf("%c %d",&uname,&pin);

changePin(uname,pin);

goto getInput;

case 4:

printf("Enter receivers username and message :");

scanf("%c %s",&uname,&message);

smsMenu(uname,message);

goto getInput;

case 5:

printf("Thanks for visiting, Exiting system now. ");

break;

default:

goto getInput;

}

};

//main function

int main(){

printf("******Welcome to SMS system****** ");

mainMenu();

}