Write the program in Java (with a graphical user interface) and have it calculate and display the mortgage payment amount from user input of the amount of the mortgage, the term of the mortgage, and the interest rate of the mortgage. Allow the user to loop back and enter new data or quit. You need to include Calculate, Reset, and Exit buttons on your GUI. Please insert comments in the program to document the program. Allow the user to enter the values of the loan, term, and rate. Do not add any additional touches, keep it simple.
In: Computer Science
In Java write an application that calculates total retail values for 5 different shoes entered by the user.
Shoe 1 $15.50
Shoe 2 $27.30
Shoe 3 $34.50
Shoe 4 $42.11
Shoe 5 $54.25
Application must read shoe number and quantity sold for each product stdin, compute the total value of that sale, and add the value of that sale to a grand total for that shoe. After all data has been entered, display the total value of each of the five shoe items. Must have two classes, must use a switch structure to which shoes sales to update, must use a sentinel controlled loop to determine when the program should stop looping and display result.
Methods
One 1 argument constructor, getters and setters for each field, and
updateTotalSales method(uses one parameter representing quantity
sold and does not return a value) . must use getter and setter
methods t access the fields do not access them directly.
Sample run
Shoe number: 2
Quantity sold: 4
Shoe number: 1
Quantity sold: 3
Shoe Number: 5
Quantity sold: 2
Shoe number: 1
Quantity sold: 2
Shoe number: 5
Quantity sold: 3
Shoe Number: 4
Quantity sold: 2
Shoe Number: 0
Total Sales
Shoe 1 : $31.00
Shoe 2: $109.20
Shoe 3: $0
Shoe 4: $84.22
Shoe 5: $271.25
In: Computer Science
Determine the output of the following pseudo-code. Also, explain how did you get this output.
fun(int n){ if (n==1) then return; println(n); if (n%2=0) then fun(n/2); else fun(3*n + 1); } Main(){ fun(14); }
In: Computer Science
In: Computer Science
Solve the following linear programming problem using both geometric method and simplex:
MIN 12X1 + 16X2
S.T. X1 + 2X2 >= 40
X1 + X2>= 30
X1, X2>= 0,
In: Computer Science
What are the parts of a routine request and the best practices for explaining and justifying a routine request?
In: Computer Science
Answer ONLY in C language.
Server program:
The server program provides a search to check for a specific value in an integer array. The client writes a struct containing 3 elements: an integer value to search for, the size of an integer array which is 10 or less, and an integer array to the server through a FIFO. The server reads the struct from the FIFO and checks the array for the search value. If the search value appears in the array, the server indicates the index of the first occurrence of that value in the array. The server writes back to the client a struct that contains the search value and its array position. If the value does not occur in the array, the search value and an appropriate return code are returned to the client. (An appropriate return code for not finding the search value could be -1)
The server program needs to:
Client Program:
The client program requests an integer value to search for, an array size and array elements to fill the array. The client program should:
In: Computer Science
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