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 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 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;
};
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 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 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 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.
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 some of the concerns raised.
In: Computer Science
In: Computer Science
For a given two-dimensional array in C as follows (Each int-type element occupies 4 bytes of memory)
int A[8][16];
If the address of A[1][4] is 0x0FFA0040, what is the memory address of A[2][6]?
In: Computer Science
Write a program to demonstrate the implementation of Inter Process Communication (IPC) using shared memory. Single line text.
In: Computer Science
The List method addAll(i,c) inserts all elements of the Collection c into the list at position i. (The add(i,x) method is a special case where c = {x}.) Explain why, for the data structures in this chapter, it is not efficient to implement addAll(i,c) by repeated calls to add(i,x). Design and implement a more efficient implementation.
In: Computer Science
Write a C# Program (using loops) to read temperature of the 7 days of the week (one day at a time) and calculate the average temperature of the week and print it.
In: Computer Science
Build a html form (making use of CSS and Javascript) with the following elements. The form must have validations and within a table format.
• Name: a text box where the content must start
with 1 upper case characters and no special character (i.e. !, @,
#, $, %, &, *). Number is not allowed. The text box must not be
empty.
• Module code: a text box where the content must
start with 3 lower case alphabets and follows by 4 digits where the
first digit cannot be zero. This textbox can be empty.
• Current date: a non-editable textbox and should
be in the format as shown (e.g. 12 October 2020 Monday 05:35
PM)
• Number of weeks till end of the year: a label
showing the total number of weeks from now till 31st Dec 2020.
(e.g. 17 days is 2 weeks and 3 days)
• Source language: a selection list with English,
Chinese, Malay, Indonesian, Japanese and Korean. Use English as the
default.
• Target language: a radio button with English,
Chinese, Malay, Indonesian, Japanese and Korean. Make Japanese as
the default.
• Source language content: a text area with 3 rows
and 20 columns. The default text is “Hello testing”. The text area
cannot be empty.
• Find text: a text box for the user to key in
text he/she wants to find.
• Replacement text: a text box for the user to key
in the replacement text. If the find text is empty, this element
should be disable (i.e. user cannot key in anything here).
• Find and replace button: when click, it will
find the occurrence of the “find text” in the source language text
area and replace it with the “replacement text”. If either find
text or replacement text is empty, this button is disable. After
the replacement, a message showing the number of replacements must
be displayed besides the button.
• Submit button: the button is called “Google
Translate”. When it is clicked, it should invoke the google
translate https://translate.google.com to perform the
translation.
• Reset button: this will reset the content of all
the elements.
All validation error messages must be italic and in
red colour and besides the html element. You are
free to rearrange all the html elements into logic group and
sequence.
In: Computer Science
1) Most police believe that cybercrime is not their responsibility, but 2) when departments dedicate training and investigation resources to online crime, that police can successfully investigate these issues. Are police right - should another agency be responsible for cybercrime? If so, who? If not, why are they incorrect? Write a 150 word response using the readings from this week.
In: Computer Science