Questions
Display nonduplicate names in ascending order) Given one or more text files, each representing a day’s...

Display nonduplicate names in ascending order) Given one or more text files, each representing a day’s attendance in a course and containing the names of the students who attended the course on that particular day, write a program that displays, in ascending order, the names of those students who have attended at least one day of the course. The text file(s) is/are passed as command-line argument(s). USe language java, ide netbeans

In: Computer Science

Find a 13-bit burst error polynomial that cannot be detected by the CRC-8 check. The burst...

Find a 13-bit burst error polynomial that cannot be detected by the CRC-8 check. The burst error polynomial must have the form E(x) = x^12 + … + 1, and the terms x^k for k = 1, 2, …, 11 can have a coefficient of either 0 or 1. Here is a 13-bit burst error polynomial that can be detected: x^12 + x^8 + x^2 + x + 1. The CRC-8 generator polynomial is x^8 + x^2 + x + 1. (By a 13-bit burst error we mean that there has been a burst of energy that causes noise on the communication channel during the span of 13 bits. For example, the energy may drive the voltage to a high value for all 13 bits. Some of those bits might have been 1’s (and represented by the high voltage), so the energy does not cause those bits to be in error. So, assume the first and thirteenth bits are incorrect, and the bits in between those two end points may or may not be in error.)

In: Computer Science

1. You are the director of operations of a large airport. Discuss the above statement showing...

1. You are the director of operations of a large airport. Discuss the above statement showing how far it is reflected in your day to day work. 2. The Information Super-highway is widely used in modern airports. Discuss how the Information Super-highway is useful in the following domains: a) Communication b) Security

In: Computer Science

We want to develop a sales system for a mobile shop. The system should keep information...

We want to develop a sales system for a mobile shop. The system should keep information about the mobile phones available at the shop. the system should allow the user the ADD new mobile phones, one at a time, along with their features. The system should also allow to search mobile phones , update their information, and delete them (one by one). Try to provide different criteria for search. When the system starts, it should load the information about the mobile phones forma file. if the file doesn't exist, the system should create the file. The system should provide a (console based) menu to interact with it. The system not use any arrays and all the changes should be reflected in the file.

Language: C++

In: Computer Science

Describe the three main types of referential actions (cascade, restrict, set null). How do you use...

Describe the three main types of referential actions (cascade, restrict, set null). How do you use these in your work?

In: Computer Science

I have a problem with the code for my project. I need the two clients to...

I have a problem with the code for my project. I need the two clients to be able to receive the messages but the code I have done only the server receives the messages. I need the clients to be able to communicate with each other directly not throught the server.

The requirements of this "local chat" program must meet are:

1. The chat is performed between 2 clients and a server.

2. The server will first start up and choose a port number. Then the server prints out its IP address and port number.

3. The client then will start up and create a socket based on the information provided by the server.

4. Now the client and the server can chat with each other by sending messages over the network.

5. The client/server MUST be able to communicate with each other in a continuous manner. (e.g. One side can send multiple messages without any replies from the other side)

6. There is no requirement on what language you use to implement this project, but your program should call upon the socket API for UDP to realize the functionality.

7. You should demonstrate your project using two machines (one for the client and one for the server. Pick your virtual machine as the client to communicate with your actual machine, which is server in our project).

8. You need to open at least 2 cmd window in your virtual machine to demonstrate multiple machine communicate with your server machine (actual machine)

My Code

UDPServer.java

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;

public class UDPServer {
   public static void main(String args[]) throws Exception{
       int serverport=6789;
       int clientport=1234;
       byte[] receiveData = new byte[1024];
       byte[] sendData = new byte[1024];
       DatagramSocket serverSocket = new DatagramSocket(serverport);
       System.out.println("SERVER READY");
       while(true){
       DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length);
       serverSocket.receive(receivePacket);
       String msg = new String(receivePacket.getData()).trim();
       System.out.println("Message from CLIENT with ID:"+msg);
        InetAddress IPAddress = receivePacket.getAddress();
       int port = receivePacket.getPort();
       String returnMsg = "Thanks. Received your message!";
       sendData = returnMsg.getBytes();
       DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, IPAddress, port);
       serverSocket.send(sendPacket);
       }
   }
}

UDPClient.java

package socket;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;

public class UDPClient {
   public static void main(String args[]) throws Exception{
       int serverport=6789;
       int clientport=1234;
       byte[] sendData = new byte[1024];
       byte[] receiveData = new byte[1024];       
       BufferedReader inFromUser = new BufferedReader(   new InputStreamReader(System.in));
       String clientId;
       System.out.println("Enter your ID:");
       clientId = inFromUser.readLine();
       while(true) {
           System.out.println("Enter your message:");
           String sentence = inFromUser.readLine();
          
           DatagramSocket clientSocket = new DatagramSocket();
           InetAddress IPAddress = InetAddress.getByName("localhost");
           sendData = (clientId+":"+sentence).getBytes();
           DatagramPacket sendPacket =
                   new DatagramPacket(sendData, sendData.length, IPAddress, serverport);
           clientSocket.send(sendPacket);
           DatagramPacket receivePacket =
                   new DatagramPacket(receiveData, receiveData.length);
           clientSocket.receive(receivePacket);
           String receivedMsg = new String(receivePacket.getData()).trim();
           System.out.println("FROM SERVER:" + receivedMsg);
           clientSocket.close();
       }
   }
}

In: Computer Science

Considering Google Maps as a graph, list four possible weights that can be associated with edges...

Considering Google Maps as a graph, list four possible weights that can be associated with edges of the graph.

In: Computer Science

What encryption/decryption and hashing algorithms are used in PGP and how are they used? write at...

What encryption/decryption and hashing algorithms are used in PGP and how are they used?

write at least 500 words of your explanation and reference.

In: Computer Science

Using C++. For this assignment you will design a set of classes that work together to...

Using C++. For this assignment you will design a set of classes that work together to simulate a police officer issuing a parking ticket. The classes you should design are :

The ParkedCar class: This class should simulate a parked car. The class's responsibilities are:

-to know the car's make, model,color ,license number,and the number of minutes that the car has been parked

The ParkingMeter Class: This class should simulate a parking meter. the class's only responsibility is:

-To know the number of minutes of parking time that has been purchased.

The ParkingTicket Class: This clas should simulate a aprking ticket. The class's responsibilities are:

-To report the make, model, color, and license number of the illegally parked car

-To report the amount of the fine,which is $25 for the first hour or part of an hour that the car is illegal parked, plus $10 for every additional hour or part of an hour that the car is illegally parked

-To report the name and badge number of the police officer issuing the ticket

The PoliceOfficer Class: This class should simulate a police officer inspecting parked cars. This class's responsibilities are:

-To know the police officer's name and badge number

-To examine a ParkedCar object and a ParkingMeter object, and determine whether the car's time expired

-To issue a parking ticket (generate a ParkingTicket object) if the car's time has expired

Write a program that demonstrates how these collaborate.

In: Computer Science

#include <stdio.h> #include <string.h> #include<stdlib.h> #include<conio.h> struct Bank_Account_Holder { int account_no; char name[80]; int balance; };...

#include <stdio.h>
#include <string.h>
#include<stdlib.h>
#include<conio.h>
struct Bank_Account_Holder
{
int account_no;
char name[80];
int balance;
};
int n;
void accept(struct Bank_Account_Holder[], int);
void display(struct Bank_Account_Holder[], int);
void save(struct Bank_Account_Holder[], int);
void load(struct Bank_Account_Holder[], int);
int search(struct Bank_Account_Holder[], int, int);
void deposit(struct Bank_Account_Holder[], int, int, int);
void withdraw(struct Bank_Account_Holder[], int, int, int);
int lowBalenquiry(int,int);

void main(void)
{
clrscr();
struct Bank_Account_Holder data[20];
int choice, account_no, amount, index;

printf("NHU Banking System\n\n");
printf("Enter the count of records: ");
scanf("%d", &n);
accept(data, n);
do
{

   printf("\nNHU Banking System Menu :\n");
   printf("Press 1 to display all records.\n");
   printf("Press 2 to search a record.\n");
   printf("Press 3 to deposit amount.\n");
   printf("Press 4 to withdraw amount.\n");
   printf("Press 5 to save all records to file.\n");
   printf("Press 6 to load Records from file.\n");
   printf("Press 0 to exit\n");
   printf("\nEnter choice(0-4) : ");
   scanf("%d", &choice);
   switch (choice)
   {
   case 1:
       display(data, n);
       break;
   case 2:
       printf("Enter account number to search : ");
       scanf("%d", &account_no);
       index = search(data, n, account_no);
       if (index == - 1)
       {
       printf("Record not found : ");
       }
       else
       {
       printf("A/c Number: %d\nName: %s\nBalance: %d\n",
           data[index].account_no, data[index].name,
           data[index].balance);
       }
       break;
   case 3:
       printf("Enter account number : ");
       scanf("%d", &account_no);
       printf("Enter amount to deposit : ");
       scanf("%d", &amount);
       deposit(data, n, account_no, amount);
       break;
   case 4:
       printf("Enter account number : ");
       scanf("%d", &account_no);
       printf("Enter amount to withdraw : ");
       scanf("%d", &amount);
       withdraw(data, n, account_no, amount);
       break;
   case 5:
       save(data, n);
       break;
   case 6:
   load(data, n);
   break;
   default:
   printf("\nWrong choice");
   case 0:
   exit(1);
}
}
while (choice != 0);

getche();
}

void accept(struct Bank_Account_Holder array[80], int s)
{
int i;
for (i = 0; i < s; i++)
{
printf("\nEnter data for Record #%d", i + 1);

printf("\n Enter account_no : ");
scanf("%d", &array[i].account_no);
fflush(stdin);
printf("Enter name of account Holder : ");
gets(array[i].name);
array[i].balance = 0;
}
}

void load(struct Bank_Account_Holder array[80], int s)
{
  
int i;
char fname[20];
printf("\nEnter File with extention for loading::");
scanf("%s",&fname);
FILE * fp;
char dataToBeRead[50];
fp = fopen(fname, "r");
if ( fp == NULL )
{
printf( "\n File Cannot Find" ) ;
}
else
{
  
printf("\n The file is now opened.\n") ;
  
// Read the dataToBeRead from the file
// using fgets() method
while( fgets ( dataToBeRead, 50, fp ) != NULL )
{
char *ptr = strtok(dataToBeRead, ",");
  

array[n].account_no=atoi(ptr);
ptr = strtok(NULL, ",");
//printf("'%s'\n", ptr);
strcpy(array[n].name,ptr);
ptr = strtok(NULL, ",");
//printf("'%s'\n", ptr);
array[n].balance=atoi(ptr);
ptr = strtok(NULL, ",");
n=n+1;

}
  
// Closing the file using fclose()
fclose(fp) ;
  
printf("Data successfully read from file\n");
printf("The file is now closed.") ;
}

}

void display(struct Bank_Account_Holder array[80], int s)
{
int i;

printf("\n\nA/c No\tName\tBalance\n");
for (i = 0; i < s; i++)
{
printf("%d\t%s\t%d\n", array[i].account_no, array[i].name,
array[i].balance);
}
}
// save records to file
void save(struct Bank_Account_Holder array[80], int s)
{
int i;
FILE *fp ;
fp = fopen("save.txt", "w");

for (i = 0; i < s; i++)
{
//each line represent single record and field seperated by comma
fprintf(fp, "%d,%s,%d\n", array[i].account_no, array[i].name,
array[i].balance);
}
fclose(fp);
printf("\nSaved Sucessfully to file");
}

int search(struct Bank_Account_Holder array[80], int s, int number)
{
int i;

for (i = 0; i < s; i++)
{
if (array[i].account_no == number)
{
return i;
}
}
return - 1;
}

void deposit(struct Bank_Account_Holder array[], int s, int number, int amt)
{
int i = search(array, s, number);
if (i == - 1)
{
printf("Record not found");
}
else
{
array[i].balance += amt;
}
}

void withdraw(struct Bank_Account_Holder array[], int s, int number, int amt)
{
int i = search(array, s, number);
if (i == - 1)
{
printf("Record not found\n");
}
else if (lowBalenquiry(array[i].balance,amt))
{
printf("Insufficient balance\n");
}
else
{
array[i].balance -= amt;
}
}
int lowBalenquiry(int bal,int amt){
if(bal < amt)
return 1;
return 0;
}

Create a report of this program
and Explain each section of code ( I need this for semester project report file )

In: Computer Science

Understanding the distinction between the vector and raster data representations is fundamental to the use of...

Understanding the distinction between the vector and raster data representations is fundamental to the use of GIS. What are both the pros and cons of vector and raster datasets?

In: Computer Science

#include <stdio.h> #include <stdint.h> char sz_1[] = "Upper/LOWER."; char sz_2[] = "mIXeD CaSe.."; /* copies psz_2...

#include <stdio.h>
#include <stdint.h>

char sz_1[] = "Upper/LOWER.";
char sz_2[] = "mIXeD CaSe..";


/* copies psz_2 to psz_1, downcases all letters */
void dostr (char* psz_1,char* psz_2) {
uint8_t u8_c;

while (*psz_2 != 0) {
u8_c = *psz_2;
if (u8_c > 0x2F) {
/* make sure it is not a special char */
*psz_1 = u8_c | 0x20; /* sets this bit */
} else {
/* leave special chars alone */
*psz_1 = u8_c;
}
psz_1++;
psz_2++;
}

}

int main(void) {
// Bug: MPLAB X v1.80 printf bug means strings vis %s don't print correctly.
// So, break printf into two statements.
printf("Before...\n");
printf("sz_1: '"); printf(sz_1); printf("'\n");
printf("sz_2: '"); printf(sz_2); printf("'\n");
dostr(sz_1,sz_2);
printf("After...\n");
printf("sz_1: '"); printf(sz_1); printf("'\n");
printf("sz_2: '"); printf(sz_2); printf("'\n");
return 0;
}
convert it in assembly

In: Computer Science

Please solve using simple python programming language and make it easy to understand explain your code...

Please solve using simple python programming language and make it easy to understand explain your code as I am a beginner, use appropriate variable names which make the code easy to understand and edit if needed.

A subsystem responsible for delivering priority numbers to an automated irrigation system has stopped working and you need to deliver a quick fix that will work until the actual subsystem is fixed by senior developer.

As you are the newest addition to the development team you have not fully grasped the complete picture of how all the systems work yet but you are confident you can solve this as you got a few hints from a senior developer.

Here is what the senior developer told you as he was running out the door.

  • There are two files with numbers in them
  • Each line in the files can contain one or more numbers, if there are more than one number on a line, they are separated by spaces
  • Both files will contain both odd and even numbers
  • You need to create a filter that can pick all odd numbers from one file and all even numbers from the other file
  • You then need to combine all the filtered out odd and even numbers (from the two files), and sort them in a reversed order using something called Bubble Sort.

He did not say it explicitly but you also understood that when you are done with the above steps, you need to display the sorted list of numbers on the screen.

When it comes to the design of the script there are a few requirements, there needs to be a main function that parses two command line arguments to file paths. From the first file (first argument) all odd numbers are read, and from the second file (second argument) all even numbers are read. The two lists of numbers are then combined and reverse sorted. The result from the sort is displayed on screen. Besides the main function the following functions must be present, and used.

read_file(filename)
Reads all the numbers in the specified file and adds them to a list as integers. The list is returned from the function.

filter_odd_or_even(numbers, odd)
The first parameter is a list of numbers and the second parameter is a Boolean value specifying if the filter function shall keep the odd numbers (True) or the even numbers (False). The function shall create a new list that is filled with either the odd or even numbers from the parameter list depending on the odd parameter. The new, filtered, list shall be returned from the function.

reversed_bubble_sort(numbers)
Takes a list of integer numbers as parameter and sorts it in place. Sorting it in place means there is no need to return anything from the function, the calling function will already have access to the sorted list. The sorting shall be done using Bubble Sort (Links to an external site.), but in reverse order. Reverse order means that the biggest number shall be first and the smallest last. The implementation of Bubble Sort shall not be optimized using the optimization described in the link above.  

In: Computer Science

. Do some research about the first handgun printed using a 3-D printer and report on...

. Do some research about the first handgun printed using a 3-D printer and report on some of the concerns raised.

In: Computer Science

What is Cloud Infrastructure? Explain in a short paragraph.

  1. What is Cloud Infrastructure? Explain in a short paragraph.

In: Computer Science