You has been requested to design and develop a food ordering system based on following requirements:
The system shall allow the user to place an order for the food(s), view the food details, modify or delete the details of the food if necessary. Your program should be menu driven, giving the user various choices. You shall design the system by demonstrating the full understanding of object-oriented and use of list/link-list concept.
For every food order, the following information will be stored: Order ID (Auto assigned, unique ID), Food Code, flavor (example: Strawberry, chocolate), weight (Kg), Unit Price, Qty and customer information who order this cake. The customer information consists of customer ID, name, address and contact number. The order ID shall be automatically assigned with a unique ID when new order is added. The system shall display additional information that is amount (unit price * qty) when viewing the order details.
*in C++ language .
Functionalities provided:
Please select an action
[1] Place Order
[2] View Food Details
[3] Modify Food Details
[4] Delete Food
[5] View All Orders
[6] Delete Order
[7] Display Customer Details
[8] Add Food
[9] Exit
In: Computer Science
Complete the code. You are given a zip file that contains an online multiplayer Tic-tac-toe system. The system comprises two main modules: Server and Client and uses server – client communication between them. You will have to extend the client and server files to include the missing communications using socket programming. In this game, the server runs indefinitely, waiting for a client. A client connects to the server to see if there are other players online. A client then invites one of the players to play the game. If the asked player accepts the invitation, the game will start. At the end of the game, the two players can either play again or quit the game and return to the server command line. The Tic-tac-toe Client: In the beginning, the client will prompt the player to specify the server IP address. The client will then list all the commands supported by the client. There are four commands included in the client implementation: join, list, invite and leave. The client creates two different threads to handle the connection with the server and the opponent client. Client commands: join: followed by a username that the player wishes to use in the game. list: list the usernames of all online players. invite: send a play request to another player. leave: leave the game; this will remove the player name from the online player list. The Tic-tac-toe Server: The server maintains clients' information in a hash-map data structure where the client IP address and username are used as a key; this allows multiple clients with a different IP address to use the same username. The server uses a multi-threaded approach to concurrent server design: for each client, a new thread is created to handle the client request. This thread will exit when the client sends a leave command to the server.
Fill in the coed that is numbered
SERVER.C
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <pthread.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "uthash.h"/*Create and maintain HashMap functions*/
#define QLEN 15 /* max number of pending incoming connections
*/
#define BUFFERSIZE 1500 /* max size of buffer*/
#define STRLEN 100 /* max string length */
typedef struct {
char name [STRLEN];
char ip_addr [STRLEN];
} record_key_t;
typedef struct {
record_key_t key;
int status;
UT_hash_handle hh;
} record_t;
/* functions prototype*/
void * server_thd(void * parm); /* a function to handle communication with clients */
void get_online_Players(const void *key, const void *value, void *obj); /* a function to handle the li$
int add_user(char name [STRLEN], char ip_addr [STRLEN]);
void print_users();
void user_left(char name [STRLEN], char ip_addr [STRLEN]);
void user_join(record_t *p);
record_t *users = NULL; /* init. hashmap list*/
pthread_mutex_t mut; /* Mutex to prevent multiple write. */
int size = 0;
int main () /* the main function*/
{
struct sockaddr_in sarver_ad; /* to store server local ip and port */
struct sockaddr_in client_ad; /* to store client ip and port */
int server_fd, client_fd; /* socket descriptors */
int port = 9090; /* protocol port number */
int addr_len; /* length of address */
pthread_t thrd_id; /* variable to hold thread ID */
pthread_mutex_init(&mut, NULL);
bzero( &sarver_ad, sizeof(sarver_ad)); /* clear sockaddr struct.*/
/* 1) here you need to set up the sockaddr_in*/
/* set address family */
/* set the local IP address to any local address */
/* set the local port to 9090 */
/* Create a socket */
/* 2) here you need to create a socket*/
/* 3) here you need to create a socket Bind a local address to the socket */
/* 4) here you need to make the server listen on server_fd for incoming connections */
/* Main server loop - accept and handle requests */
fprintf(stderr, "Server up and running.\n");
while (1) {
/* 5) here you need to make accept incoming connections before the new thread is created*/
/* Create seperate thread for each client */
pthread_create(&thrd_id, NULL, server_thd, (void *) client_fd );
}
close(server_fd); /* Close socket */
}
int add_user(char name [STRLEN], char ip_addr [STRLEN])
CLIENT.C
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <stdbool.h>
#include <pthread.h>
#define MAXBUFFER 100 /*Maximum buffer size*/
#define MAXSTRINGLEN 100 /*Maximum String length*/
#define SERVERPORTNUM 9090 /*server port number*/
#define HOSTPORTNUM 12345 /* Local port number */
#define PEERPORTNUM 12345 /* peer port number */
char name[MAXSTRINGLEN], /* name used to join the server
*/
peer_name[MAXSTRINGLEN];/* name of opponent */
pthread_t thrid_id; /*thread Id*/
int current_player=0; /* local user score*/
int other_player=0; /* remote user score*/
void tic_tac_toe(int socket, char * buffer, int playerID); /*the
tic tac toe game.*/
void * serverConn(void * parm); /* Thread function to handle
communication with the server */
void * peerConn(char * ip); /* Thread function used when we want to
open a connection with$
void print_instraction(); /* to print the game instructions */
int server_socket, peer_socket, listn_socket, consocket; /* All
socket descriptors are stored as globa$
int ingame, turn; /* Some variables to handle the flow of the game.
*/
int main(int argc, char *argv[])
{
printf("Enter Server's IP: ");
const char server[30]; /* store IP address of server */
scanf("%s",server);
/* Establish connection with the server */
struct sockaddr_in dest;
/* 1) here you need to create a socket named
'server_socket' to connect to the server */
memset(&dest, 0, sizeof(dest));
/* 2) here you need to creat sockaddr_in to store server
info.*/
/*connect to the server*/
/* 3) here you need to 'server_socket' to the
server.*/
pthread_create(&thrid_id, NULL, serverConn, (void*) &server_socket);
/* For Invitation */
/* Bind to a socket and start listening for incomming connections.
peer-to-peer*/
struct sockaddr_in peer;
struct sockaddr_in serv;
socklen_t socksize = sizeof(struct sockaddr_in);
memset(&serv, 0, sizeof(serv));
/* 4) here you need to set up the sockaddr_in*/
/* 5) here you need to create a socket*/
/* 6) here you need to create a socket Bind a local address to the
socket */
/* 7) here you need to make the server listen on server_fd for
incoming connections, Only accept o$
/* 8) here you need to make accept incoming connections before the
new thread is created*/
char buffer[MAXBUFFER]; /* Buffer to hold data exchanged
*/
int len;
/* handle peer connection request */
while(consocket)
{
pthread_cancel(thrid_id);
/* Receive peer's name and store it as current opponent */
len = recv(consocket, buffer, MAXBUFFER, 0);
buffer[len] = '\0';
strcpy(&peer_name, buffer);
printf("\n%s has challenged you. Accept challenge? (y/n) ",
peer_name);
/* Ask for approval */
fgets(buffer, sizeof(buffer), stdin);
buffer[strlen(buffer)-1] = '\0';
if (strcmp(buffer, "y") == 0)
{
current_player=0;
other_player=0;
printf("\nYour Score: %d", current_player);
printf("\nOpponent's Score: %d",other_player);
ingame = 1;
send(consocket, buffer, strlen(buffer), 0);
}
else
{
current_player=0;
other_player=0;
send(consocket, buffer, strlen(buffer), 0);
printf("\nYou declined...\n");
ingame = 0;
}
/* Play game until one of the player declines. */
turn = 0;
int playerID = 2;
/* Close all sockets before the program exits */
close(listn_socket);
close(consocket);
close(peer_socket);
close(server_socket);
return EXIT_SUCCESS;
}
In: Computer Science
1. In Benbunan-Fich (2001), the three main parameters used to
evaluate website usability are:
display, layout, buttons
content, organization, links
display, navigation,
interfaces
content, layout, format
content, navigation,
interactivity
2.One of these methods creates different versions of a system to
test which one is better:
Think aloud
A/B Testing
Retrospective
Surveys
Walkthrough
3. Which of the following method(s) allows to evaluate usability
indirectly?
Interviews
Observations
Focus Groups
Think Aloud
Only A and C
4.
Observer effect describes:
when a researcher identifies herself as a researcher and watches
when the user interacts with a system
the influence of the presence of an person has on the behavior of
participants
when the subjects may or may not realize they are being
observed
when researchers do not participate in the activity being observed
but sit on the sidelines and watch
when participants observe what other participants are doing
5. A sequence of interactions between a user and a system is
called a(n):
Interface
Graphical User Interface
Dialogue
Navigation
All of the above
In: Computer Science
As you analyze any modern corporate setup, you will see that companies want to ensure that all users are aware of their own individual responsibility to help protect the enterprise. Social engineering (SE) is becoming a more prevalent threat at all levels of business. To combat it, you first need to understand it. Therefore, you must complete the following: Describe what social engineering is and explain its existence and prevalence. Explain why SE is an important part of an information technology security course. Discuss employee and management responsibilities with regard to information security and combating SE. Make sure your work clarifies your opinion as to who carries more responsibility for preventing SE-the employees or management. Provide examples to back up your statements. Prepare a 1-2 page Word document that covers the above areas.
In: Computer Science
Write a report about cache memory
The report should contain the folowing information.
In: Computer Science
This is a three part question. For each part the answer requires identifying an asymmetric encryption technique, hashing or both. As part of each question you need to discuss the technique to demonstrate your understanding of how the functionality (confidentiality, authenticity, integrity) is supported. You need to discuss the details of what the sender and receiver do and the key usage if applicable.
What technique is used to exchange messages between two parties ensuring confidentiality? Discuss.
What technique is used to exchange messages between two parties ensuring authenticity? Discuss
c. What technique is used to exchange messages between two parties ensuring integrity? Discuss.
In: Computer Science
Alameen is a railway system and wants to install Ticket Vending Machines (TVMs) on the platforms of all rail stations in Peshawar. The TVMs will allow the passenger to buy a ticket/pass using cash, coins, debit cards, or credit cards. The interface of the TVMs should be very easy for the passengers to buy their tickets.
This system should be designed in such a way that the passenger first selects the ticket type, transaction mode, and then get a pass/ticket. Passengers can be adult, senior/disabled citizens, child (5-14 years old), high school, or college students. Ticket type can be either a two-hour pass, midday pass, or AM pass (Monday through Friday from 09:30 am to 02:30 pm), a PM pass (noon through the end of service on the date purchased), a day pass, a 7-day pass, or a 31-day pass. There will be no ticket fare for senior or disabled citizens. The only thing they have to show during traveling is the valid ID and ticket. The ticket fare for a child (5-14 years old), high school or college students will be reduced, and they will have to show valid Id along with ticket (reduced fare) to the ticket checking authority.
The system should restrict the unauthorized users from using the system. The system should be fast enough that it should accept the input from the user in less than 1 second. The system should be fast enough to print the ticket to the user within 3 to 5 secs when user inserts all the required information. The system should be available 24 hours a day and 7 days a week. The system will also be used by the operator to know the cash and coins inside the machine and withdraw or deposit cash when required. The system is designed in such a way to allow admin to generate reports. The reports include how many tickets are sold, the number of transactions, cash or coins collected, change fares, cash, or coins dispensed.
To understand the operation of Ticket Vending Machines (TVMs) and how to buy a ticket through TVMs, please watch the following short tutorials (one is 4:52 and other is 2:35 min: secs) as listed below:
Read the above-mentioned scenario and answer the following questions which are as follows:
In: Computer Science
What program would you write to solve the following problems and why does it work? Please also comment on other students’ code at least three times. 1) Write code to partition a linked list around a value x, such that all nodes less than x come before all nodes greater than or equal to x. If x is contained within the list, the values of x only need to be after the elements less than x. The partition element x can appear anywhere in the “right partition”; it does not need to appear between the left and right partitions. Input: 3à5à8à5à10à2à1 (partition=5) Output: 3à1à2à10à5à5à8. 2) Write a method that finds the maximum of two numbers. You should not use if-else or any other comparison operator. 3) Write methods to implement the multiply, subtract and divide operations for integers. The results of all of these are integers. Use only the add operator.
In: Computer Science
The purpose of this lab is to manipulate an array of integers. The assignment is to write a program that: 1. Declares an array of integers of size equal to constant int SIZE = 10. 2. Implements the following methods: A method that displays a menu. The menu should be displayed after each completed menu selection. A method that prompts the user to initialize the array. The entire array does not need to be initialized. The user may enter only as many (or as few) values as they would like in the array. The user will enter a negative value to indicate no more to be added. Hint: This implies that the number of elements in the array does not necessarily have to be the same as the maximum size of the array. A method that displays the contents of the array. Only elements currently contained in the array should be horizontally displayed. A method that displays the minimum, maximum, sum and average of all the elements currently contained in the array. A method that accepts a number and determines how many times (if any) that number appears as an element in the array. A method that allows the user to add a number to the end of the array. A method that allows you to insert a specified number at a specified index within the currently filled portion of the array. Hint: In order to accomplish this, the method must first check to see if there is room in the array to accept a new number. If the array is currently full (e.g. number of elements equals the maximum size of the array) then the user has to first delete an element from the array. Think carefully about what an insert into the array implies. The physical size of the array cannot change, therefore what must happen if a value is to be inserted somewhere in the middle of the array without losing any of the existing elements. A method that removes an element at a specified index in the array. Hint: As with the insert method, the physical size of the array cannot change, therefore how could we simulate an element of the array being deleted? CSCI 125 Array Manipulation Prof. Kadri Page 2 of 4 Sample run: Menu only displayed once here. Your program should display the menu after each completed menu selection. 1. Initialize Array 2. Display Array 3. Add element to the end 4. Add an element at a specific index 5. Remove an element at specific index 6. Show min, max, sum and average 7. Search 8. Exit 1. Initialize Array Enter integer values to fill the array -ve value to stop: 1 2 3 4 5 6 8 -9 2. Display Array 1 2 3 4 5 6 8 6. Show min, max, sum and average Min=1 Max=8 Sum=29 Average=4.14 7. Search Enter number to search for: 2 2 occurs 1 time. 5. Remove an element at specific index Enter index between 0 and 6 7 Invalid index Enter index between 0 and 6 1 2. Display Array 1 3 4 5 6 8 4. Add an element at a specific index Enter index between 0 and 5 6 Invalid index Enter index between 0 and 5 3 Enter number to insert 9 CSCI 125 Array Manipulation Prof. Kadri Page 3 of 4 2. Display Array 1 3 4 9 5 6 8 1. Initialize Array Enter integer values to fill the array -ve value to stop: 1 2 3 4 5 6 7 8 9 10 11 -9 Array is full. One or more numbers could not be inserted 2. Display Array 1 2 3 4 5 6 7 8 9 10 3. Add element to the end Array is full. 8. Exit Goodby
import java.util.Scanner;
public class ArrayMenu
{
static int count;
static Scanner kb = new Scanner(System.in);
public static void main()
{
int item=0;
int[] numArray=new int[100];
count=0;
while (item !=8)
{
menu();
item=kb.nextInt();
if (item==1)
initializeArray(numArray);
else if (item==2)
printArray(numArray);
}
System.out.println("Goodby!");
}
public static void menu()
{
System.out.println("1. Initialize Array");
System.out.println("2. Display Array");
System.out.println("3. Add element to the end");
System.out.println("4. Add an element at a specific index");
System.out.println("5. Remove an element at specific index");
System.out.println("6. Show min, max, sum and average");
System.out.println("7. Search");
System.out.println("8. Exit");
System.out.print(": ");
}
public static void initializeArray(int[] arr)
{
count=0;
int num;
System.out.print("Enter integer values to fill the array -vevalue to stop: ");
do
{
num = kb.nextInt();
if (num >=0)
{
arr[count]=num;
count++;
}
} while (num > 0);
}
public static void printArray(int[] arr)
{
for (int i=0; i< count; i++)
System.out.print(arr[i]+" ");
System.out.println();
}
}
CODING LANGAUGE JAVA
In: Computer Science
In java What program would you write to solve the following problems and why does it work? Please also comment on other students’ code at least three times. 1) Implement MyArrayStack (constructor, push, pop, peek and isEmpty), and MyLinkedQueue with both next and previous pointers (constructor, enqueuer/offer, dequeuer/poll, peek and isEmpty), and write the following two program to test them. You must use MyArrayList or MyLinkedList for the implementation. 2) For stack testing, write a program to check if a string has matching parenthesis such as “(())”, but not “)(“. 3) For stack testing, use it to “Evaluating Expressions” using the algorithm given in the class.
What program would you write to solve the following problems and why does it work? Please also comment on other students’ code at least three times. 1) Add support for exponent ~ for the problem in the previous discussion question. 2) An animal shelter, which holds only dogs and cats, operates on a strictly "first in, first out" basis. People must adopt either the "oldest" (based on arrival time) of all animals at the shelter, or they can select whether they would prefer a dog or a cat (and will receive the oldest animal of that type). They cannot select which specific animal they would like. Create the data structures to maintain this system and implement operations such as enqueue, dequeueAny, dequeueDog, and dequeueCat. You may use the myLinkedlist data structure you created in previous discussion question. 3) You have an integer and you can flip exactly one bit from a O to a 1. Write code to find the length of the longest sequence of 1 s you could create. EXAMPLE Input: 1775 (or: 11011101111) Output: 8.
In: Computer Science
How can an information management strategy reduce the costs of IT systems and investments?
In: Computer Science
View 2
Seneca Courses Inc.
Product Spreadsheet
All the course books are maintained on the following Product spreadsheet. SCI is currently having difficulty searching for books written by the same author, and would like the new database system to list each author separately. There can be one or many authors for each book, but there is no limit to the number of authors of a book.
|
PROD ID |
TITLE |
EDITION |
Purchase Cost |
Retail Price |
AUTHOR |
|
100860 |
DATABASE SYSTEMS: DESIGN AND IMPLEMENTATION |
THIRD EDITION |
$84.98 |
$99.98 |
CARLOS CORONEL, PETER ROB |
|
100861 |
DATABASE SYSTEMS: DESIGN AND IMPLEMENTATION |
FOURTH EDITION |
$92.82 |
$109.20 |
CARLOS CORONEL, PETER ROB |
|
100871 |
MODERN RETAILING |
FOURTH EDITION |
$88.36 |
$110.45 |
DANIEL CASTON, JENNY TAPSCOTT |
|
100890 |
UNDERSTANDING MICROSOFT ACCESS |
NINTH EDITION |
$65.52 |
$72.80 |
PIERRE LEBLAND, ROBERT COBB |
|
102130 |
ORACLE: INTRODUCTION TO PL/SQL |
$53.24 |
$59.15 |
PHILIP ROBB |
|
|
200376 |
ORACLE: ADVANCED PL/SQL DEVELOPMENT |
$64.26 |
$71.40 |
PHILIP ROBB, DAN CHEN |
Business Rules:
1. PURCHASE COST the default value is 0.
2. RETAIL PRICE must always have a value.
Normalize the above user view. Document all steps including UNF, 1NF, Dependencies, 2NF, and 3NF and explain or list the primary key and foreign
In: Computer Science
Why is SolarWinds Network Performance Monitoring Tool the best tool?
In: Computer Science
View 3
Seneca Courses Inc.
Employee Forms
All employee information for SCI is maintained on file forms. The following are sample employee information forms:
|
EMP_ID |
7839 |
EMP_ID |
7654 |
|||
|
EMP_NAME |
JOHN CHIU |
EMP_NAME |
ANDRE MARTIN |
|||
|
SOC_INS |
123-234-345 |
SOC_INS |
678-345-123 |
|||
|
POSITION |
MANAGER |
POSITION |
SALES |
|||
|
SUPERVISOR |
SUPERVISOR |
JOHN CHIU |
||||
|
HIREDATE |
November 13, 1999 |
HIREDATE |
September 24, 1999 |
|
EMP_ID |
7434 |
EMP_ID |
7435 |
|||
|
EMP_NAME |
PARVEZ RAI |
EMP_NAME |
DANIEL CHOY |
|||
|
SOC_INS |
234-123-432 |
SOC_INS |
345-312-234 |
|||
|
POSITION |
SALES |
POSITION |
CLERK |
|||
|
SUPERVISOR |
JOHN CHIU |
SUPERVISOR |
||||
|
HIREDATE |
June 24, 1980 |
HIREDATE |
August 4, 1998 |
Business Rules:
1. SOC_INS must always be different for each employee.
2. EMP_NAME must always have a value.
Normalize the above user view. Document all steps including UNF, 1NF, Dependencies, 2NF, and 3NF and explain or list the primary key and foreign
In: Computer Science
How computer Hardware is protected, Explain Dual-Mode Operation concept for Hardware protection?
In: Computer Science