Questions
Create a structure in C called BarcelonaPlayer with the following members. struct BarcelonaPlayer { char name[20];...

Create a structure in C called BarcelonaPlayer with the following members.
struct BarcelonaPlayer
{
char name[20];
int age;
char country[20];
char Position[20];
double Salary;
double Rating;
};
First, create an array of BarcelonaPlayer structures. Now, write a function that takes an array of BarcelonaPlayer structures as input and find out the highest paid player among all the players.
void highestPaidPlayer(struct BarcelonaPlayer *pl, int size);
Create another function that finds all the players from Argentina.
void findPlayers(struct BarcelonaPlayer *pl, int size);

In: Computer Science

In SQL we are working with functions 1. Write a SELECT statement that returns these columns...

In SQL we are working with functions

1. Write a SELECT statement that returns these columns from the Instructors table:

a. The AnnualSalary column

b. A column named MonthlySalary that is the result of dividing the AnnualSalary column by 12

c. A column named MonthlySalaryRounded that calculates the monthly salary and then uses the ROUND function to round the result to 2 decimal places

2. Write a SELECT statement that returns these columns from the Students table:

a. The EnrollmentDate column

b. A column that returns the four-digit year that’s stored in the EnrollmentDate column

c. A column that returns only the day of the month that’s stored in the EnrollmentDate column

d. A column that returns the result from adding four years to the EnrollmentDate column; use the CAST function so only the year is returned

3. Write a SELECT statement that returns these columns:

a. The DepartmentName column from the Departments table

b. The CourseNumber column from the Courses table

c. The FirstName column from the Instructors table

d. The LastName column from the Instructors table

Add a column that includes the first three characters from the DepartmentName column in uppercase, concatenated with the CourseNumber column, the first character of the FirstName column if this column isn’t null or an empty string otherwise, and the LastName column. For this to work, you will need to cast the CourseNumber column to a character column.

4. Write a SELECT statement that returns these columns from the Students table:

a. The FirstName column

b. The LastName column

c. The EnrollmentDate column

d. The GraduationDate column

e. A column that shows the number of months between the EnrollmentDate and GraduationDate columns

Return one row for each student who has graduated.

5. Write a CTE with a SELECT statement that returns one row for each student that has courses with these columns:

a. The StudentID column from the Students table

b. The sum of the course units in the Courses table

6. Write a SELECT statement that uses this CTE to return these columns for each student:

a.The StudentID column from the CTE

b.The sum of course units from the CTE

An indication of whether the student is fulltime or parttime (Hint: To determine whether a student is fulltime, use the IIF function to test if the sum of course units is greater than 9.) The total tuition (Hint: To calculate the tuition, use the IIF function to determine whether a student is fulltime or partime. Then, multiply the sum of course units by the PerUnitCost column in the Tuition table and add that to either the FullTimeCost or PartTimeCost column in the Tuition table. To do that, use a cross join to join the CTE and the Tution tables. This makes the columns from the Tuition table available to the SELECT statement.)

In: Computer Science

Prove whether the set of all proofs within any formal system is decidable, recognizable, or unrecognizable

Prove whether the set of all proofs within any formal system is decidable, recognizable, or unrecognizable

In: Computer Science

HTML I would like you to create a three paged website, where you can navigate to...

HTML

I would like you to create a three paged website, where you can navigate to any page using a navigation bar.

One page must include an ordered list, one page must include an unordered list.

One page must include a picture. (please keep it appropriate.)

Each page much include a header and a footer, please have your name on each footer with the copyright symbol next to it.

Each page must be styled using CSS, and I would like you to use an external style sheet.

The content of the site can be of your choosing

In: Computer Science

Write the below code to use HTML and JavaScript. 1. a) Write a JavaScript program to...

Write the below code to use HTML and JavaScript.

1.

a) Write a JavaScript program to display the current day and time.
b) Write a JavaScript program to print the contents of the current window.  

c) Write a JavaScript program where the program takes a random integer between 1 to 10
d) Write a JavaScript program to calculate multiplication and division of two numbers (input from the user).
e)Write a JavaScript program to create a new string from a given string changing the position of first and last characters. The string length must be greater than or equal to 1.
f)Write a JavaScript program to check whether a string starts with 'Java' and false otherwise

In: Computer Science

Develop a program that asks a user to enter the number 10, and then it outputs...

Develop a program that asks a user to enter the number 10, and then it outputs COUNT-DOWN from 10 to 0.

In: Computer Science

During the semester we studied IT Project Management. List the five attributes of a project. [1...

During the semester we studied IT Project Management. List the five attributes of a project. [1 x 5 = 5] List and describe the four generic phases of a project life cycle of development. [ 2.5 x 4 = 10]

In: Computer Science

import math print("RSA ENCRYPTION/DECRYPTION") print("*****************************************************") #Input Prime Numbers print("PLEASE ENTER THE 'p' AND 'q' VALUES BELOW:")...

import math

print("RSA ENCRYPTION/DECRYPTION")
print("*****************************************************")

#Input Prime Numbers
print("PLEASE ENTER THE 'p' AND 'q' VALUES BELOW:")
p = int(input("Enter a prime number for p: "))
q = int(input("Enter a prime number for q: "))
print("*****************************************************")

#Check if Input's are Prime
'''THIS FUNCTION AND THE CODE IMMEDIATELY BELOW THE FUNCTION CHECKS WHETHER THE INPUTS ARE PRIME OR NOT.'''
def prime_check(a):
if(a==2):
return True
elif((a<2) or ((a%2)==0)):
return False
elif(a>2):
for i in range(2,a):
if not(a%i):
return false
return True

check_p = prime_check(p)
check_q = prime_check(q)
while(((check_p==False)or(check_q==False))):
p = int(input("Enter a prime number for p: "))
q = int(input("Enter a prime number for q: "))
check_p = prime_check(p)
check_q = prime_check(q)

#RSA Modulus
'''CALCULATION OF RSA MODULUS 'n'.'''
n = p * q
print("RSA Modulus(n) is:",n)

#Eulers Toitent
'''CALCULATION OF EULERS TOITENT 'r'.'''
r= (p-1)*(q-1)
print("Eulers Toitent(r) is:",r)
print("*****************************************************")

#GCD
'''CALCULATION OF GCD FOR 'e' CALCULATION.'''
def egcd(e,r):
while(r!=0):
e,r=r,e%r
return e

#Euclid's Algorithm
def eugcd(e,r):
for i in range(1,r):
while(e!=0):
a,b=r//e,r%e
if(b!=0):
print("%d = %d*(%d) + %d"%(r,a,e,b))
r=e
e=b

#Extended Euclidean Algorithm
def eea(a,b):
if(a%b==0):
return(b,0,1)
else:
gcd,s,t = eea(b,a%b)
s = s-((a//b) * t)
print("%d = %d*(%d) + (%d)*(%d)"%(gcd,a,t,s,b))
return(gcd,t,s)

#Multiplicative Inverse
def mult_inv(e,r):
gcd,s,_=eea(e,r)
if(gcd!=1):
return None
else:
if(s<0):
print("s=%d. Since %d is less than 0, s = s(modr), i.e., s=%d."%(s,s,s%r))
elif(s>0):
print("s=%d."%(s))
return s%r

#e Value Calculation
'''FINDS THE HIGHEST POSSIBLE VALUE OF 'e' BETWEEN 1 and 1000 THAT MAKES (e,r) COPRIME.'''
for i in range(1,1000):
if(egcd(i,r)==1):
e=i
print("The value of e is:",e)
print("*****************************************************")

#d, Private and Public Keys
'''CALCULATION OF 'd', PRIVATE KEY, AND PUBLIC KEY.'''
print("EUCLID'S ALGORITHM:")
eugcd(e,r)
print("END OF THE STEPS USED TO ACHIEVE EUCLID'S ALGORITHM.")
print("*****************************************************")
print("EUCLID'S EXTENDED ALGORITHM:")
d = mult_inv(e,r)
print("END OF THE STEPS USED TO ACHIEVE THE VALUE OF 'd'.")
print("The value of d is:",d)
print("*****************************************************")
public = (e,n)
private = (d,n)
print("Private Key is:",private)
print("Public Key is:",public)
print("*****************************************************")

#Encryption
'''ENCRYPTION ALGORITHM.'''
def encrypt(pub_key,n_text):
e,n=pub_key
x=[]
m=0
for i in n_text:
if(i.isupper()):
m = ord(i)-65
c=(m**e)%n
x.append(c)
elif(i.islower()):   
m= ord(i)-97
c=(m**e)%n
x.append(c)
elif(i.isspace()):
spc=400
x.append(400)
return x


#Decryption
'''DECRYPTION ALGORITHM'''
def decrypt(priv_key,c_text):
d,n=priv_key
txt=c_text.split(',')
x=''
m=0
for i in txt:
if(i=='400'):
x+=' '
else:
m=(int(i)**d)%n
m+=65
c=chr(m)
x+=c
return x

#Message
message = input("What would you like encrypted or decrypted?(Separate numbers with ',' for decryption):")
print("Your message is:",message)

#Choose Encrypt or Decrypt and Print
choose = input("Type '1' for encryption and '2' for decrytion.")
if(choose=='1'):
enc_msg=encrypt(public,message)
print("Your encrypted message is:",enc_msg)
print("Thank you for using the RSA Encryptor. Goodbye!")
elif(choose=='2'):
print("Your decrypted message is:",decrypt(private,message))
print("Thank you for using the RSA Encryptor. Goodbye!")
else:
print("You entered the wrong option.")
print("Thank you for using the RSA Encryptor. Goodbye!")

this answer is posted by one of the expert and the issue is:

#e Value Calculation
'''FINDS THE HIGHEST POSSIBLE VALUE OF 'e' BETWEEN 1 and 1000 THAT MAKES (e,r) COPRIME.'''
for i in range(1,1000):
if(egcd(i,r)==1):
e=i
print("The value of e is:",e)
print("*****************************************************")

this certain part doesn't execute as it shows the error that r is not defined. And Can you please provide the ans with indentation? im sure im making mistake in indentation. thanks

In: Computer Science

PYTHON PLEASE!! ALSO: if you can include an explanation of what the code means that would...

PYTHON PLEASE!!

ALSO: if you can include an explanation of what the code means that would be appreciated

8.19 LAB*: Program: Soccer team roster (Dictionaries)

This program will store roster and rating information for a soccer team. Coaches rate players during tryouts to ensure a balanced team.

(1) Prompt the user to input five pairs of numbers: A player's jersey number (0 - 99) and the player's rating (1 - 9). Store the jersey numbers and the ratings in a dictionary. Output the dictionary's elements with the jersey numbers in ascending order (i.e., output the roster from smallest to largest jersey number). Hint: Dictionary keys can be stored in a sorted list. (3 pts)

Ex:

Enter player 1's jersey number:
84
Enter player 1's rating:
7

Enter player 2's jersey number:
23
Enter player 2's rating:
4

Enter player 3's jersey number:
4
Enter player 3's rating:
5

Enter player 4's jersey number:
30
Enter player 4's rating:
2

Enter player 5's jersey number:
66
Enter player 5's rating:
9

ROSTER
Jersey number: 4, Rating: 5
Jersey number: 23, Rating: 4
Jersey number 30, Rating: 2
...

(2) Implement a menu of options for a user to modify the roster. Each option is represented by a single character. The program initially outputs the menu, and outputs the menu after a user chooses an option. The program ends when the user chooses the option to Quit. For this step, the other options do nothing. (2 pts)

Ex:

MENU
a - Add player
d - Remove player
u - Update player rating
r - Output players above a rating
o - Output roster
q - Quit

Choose an option:

(3) Implement the "Output roster" menu option. (1 pt)

Ex:

ROSTER
Jersey number: 4, Rating: 5
Jersey number: 23, Rating: 4
Jersey number 30, Rating: 2
...

(4) Implement the "Add player" menu option. Prompt the user for a new player's jersey number and rating. Append the values to the two vectors. (1 pt)

Ex:

Enter a new player's jersey number:
49
Enter the player's rating:
8

(5) Implement the "Delete player" menu option. Prompt the user for a player's jersey number. Remove the player from the roster (delete the jersey number and rating). (1 pt)

Ex:

Enter a jersey number:
4

(6) Implement the "Update player rating" menu option. Prompt the user for a player's jersey number. Prompt again for a new rating for the player, and then change that player's rating. (1 pt)

Ex:

Enter a jersey number:
23
Enter a new rating for player:
6

(7) Implement the "Output players above a rating" menu option. Prompt the user for a rating. Print the jersey number and rating for all players with ratings above the entered value. (2 pts)

Ex:

Enter a rating:
5

ABOVE 5
Jersey number: 66, Rating: 9
Jersey number: 84, Rating: 7
...

In: Computer Science

What type of application programs are not suitable for multi-threading? Explain.

What type of application programs are not suitable for multi-threading? Explain.

In: Computer Science

Using Java with NO imports,    Method arrayOfSums returns an ArrayList of the same size as...

Using Java with NO imports,

   Method arrayOfSums returns an ArrayList of the same size as the largest ArrayList
       This method needs to be overloaded so that it works for 2 to 4 sent Arraylists.

       arrayOfSums([2,4,7], [3,7,14]) returns [5,11,21]
       arrayOfSums([6,13,4,8], [7,5,9], [2,5,8,3]) returns [15, 23, 21, 11]
       arrayOfSums([6,13,4,8], [7,5,9], [2,5,8,3], [3,5,4,1,2]) returns [18, 28, 25, 12, 2]
       arrayOfSums([8,6], [2,4,10]) returns [10,10,10]
       arrayOfSums([2,2,2,2,2], [3,2,5,2,3], [1,3,1,3,1]) returns [6, 7, 8, 7, 6]
       arrayOfSums([11,12,13,14], [14,13,12,11], [10,10,10,10], [5,6,7,6,5]) returns [40, 41, 42, 41, 5]
       @param nums1 ArrayList of integers of varying sizes
       @param nums2 ArrayList of integers of varying sizes
       @param nums3 ArrayList of integers of varying sizes
       @param nums4 ArrayList of integers of varying sizes
       @return an array of the sums of the corresponding elements from each array
   */
public static ArrayList<Integer> arrayOfSums(ArrayList<Integer> nums1, ArrayList<Integer> nums2, ArrayList<Integer> nums3, ArrayList<Integer> nums4 )
{
       ArrayList<Integer> numsSums = new ArrayList<Integer>();
       return numsSums;

}// end arrayOfSums

   /**
   * Do overloaded methods here.
   * to compile, I am adding the method line.
   */

       public static ArrayList<Integer> arrayOfSums(ArrayList<Integer> nums1, ArrayList<Integer> nums2, ArrayList<Integer> nums3)
{
           ArrayList<Integer> numsSums = new ArrayList<Integer>();
        return numsSums;

}// end arrayOfSums
       public static ArrayList<Integer> arrayOfSums(ArrayList<Integer> nums1, ArrayList<Integer> nums2)
       {
           ArrayList<Integer> numsSums = new ArrayList<Integer>();
       return numsSums;
       }// end arrayOfSums

In: Computer Science

JAVA WITH NO IMPORTS Method changeWords executes a find and replace like you would with ctrl+f...

JAVA WITH NO IMPORTS

Method changeWords executes a find and replace like you would with ctrl+f
           or command+f on here
           The first value provided is the text that you search
           Turn the text into an array of strings
           find the string that is sent in the second position (find) and
           replace it with the

          changeWords("never have I ever", "ever", "cheated") returns ["never", "have", "I", "cheated"]
           changeWords("Why why Why", "Why", "because") returns ["becasue", "because", "because"]
           changeWords("What is up bro", "hi", "hello") returns ["what", "is", "up", "bro"]
           changeWords("Hi nice to meet you", "hi", "hello") returns ["hello", "nice", "to", "meet", "you"]
           changeWords( "", "", "") returns []

          @param String text, String of multiple words
           @param String find, the string to be replaced
           @param String replace, the string to be inserted in place of find
          @return String array, where words is the array of words after the edit is made
      */
public static String[] changeWords(String text, String find, String replace)
{
       //your code here
       String[] words = new String[0];//you are free to edit this line
return words;
}//end changeWords

In: Computer Science

Write a short text based game using C++ were you can chose the gender of the...

Write a short text based game using C++ were you can chose the gender of the character, than choose between two location, desert or forest. If either location is chosen than you can choose to either stay at your spot or travel to find help. If player chose desert, than choosing either to stay or travel can be led to death by heat exhaustion or saved randomized, or if forest is chosen, than it can be either death of starvation or saved also randomized. Winner lives, loser dies.

In: Computer Science

In java P4.6 Following Section 4.9 develop a program that reads text and displays the average...

In java P4.6 Following Section 4.9 develop a program that reads text and displays the average number of words in each sentence. Assume words are separated by spaces, and a sentence ends when a word ends in a period. Start small and just print the first word. Then print the first two words. Then print all words in the first sentence. Then print the number of words in the first sentence. Then print the number of words in the first two sentences. Then print the average number of words in the first two sentences. At this time, you should have gathered enough experience that you can complete the program.

In: Computer Science

Part A: Simple array algorithms With your buddy, read through this problem statement. Be sure to...

Part A: Simple array algorithms

  1. With your buddy, read through this problem statement. Be sure to read the Javadoc comments for the evenOdd method.
  2. Scribe: What is the return type of the evenOdd method?
  3. Scribe: How do you create an int array that can hold two numbers?
  4. The problem of coding the evenOdd method decomposes into three simpler problems. Scribe: What are they?
  5. Scribe: Which algorithm in section 7.3 of your textbook will be helpful?
  6. Scribe: Assuming that you have the counts for the odds and evens (say in oddCount and evenCount), what is the Java code for creating an array of length 2 and returning both counts in the array?
  7. Scribe: You really do not have to compute two counts. How can you calculate one given the other?
  8. Solve the problem in BlueJ. Make sure your code passes the test cases in this tester. Driver: Paste your code into the lab report.Part B: Removing duplicate
    public class Numbers
    {
       /**
          Computes the number of even and odd values in a given array
          @param values an array of integer values
          @return an array of length 2 whose 0 entry contains the count
          of even elements and whose 1 entry contains the count of odd
          values
       */
       public static int[] evenOdds(int[] values)
       {
          // your work here
    
    
    
       }
    }
    
    Code tester
    
    public class NumbersTester
    {
       public static void main(String[] args)
       {
          int[] a = { 1, 2, 3 };
          int[] r = Numbers.evenOdds(a);
          System.out.println(r[0] + " " + r[1]);
          System.out.println("Expected: 1 2");
          a[1] = 5;
          r = Numbers.evenOdds(a);
          System.out.println(r[0] + " " + r[1]);
          System.out.println("Expected: 0 3");
          a = new int[0];
          r = Numbers.evenOdds(a);
          System.out.println(r[0] + " " + r[1]);
          System.out.println("Expected: 0 0");
       }
    }

    Part B: Removing duplicates

    Step1
    A common typo is to accidentally duplicate a word, which can be be rather embarrassing.

    Your task is to design and implement a program that removes adjacent duplicates. This class reads a file and puts all words into an ArrayList<String> called words. Your task is to complete the method removeAdjacentDuplicates to remove all adjacent duplicates in words. Develop a plan and write pseudocode for this task. Questions to think about. Scribe: How do you plan to find duplicates? Scribe: What will you do when you find them? Pay special attention to what happens at the beginning or end of the array list. Show your lab instructor your pseudocode before doing the next step.

    Step 2
    Implement your solution. To test, download and unzip this zip file. Copy each file into the same directory that contains your BlueJ project. Do not copy the folder.

    You must unzip the zip file. Don't simply move the zip into your BlueJ directory.

    Make a Text object on the BlueJ workbench. Right-click and call pick. Pick the file typo.txt. Right-click and call removeAdjacentDuplicates (i.e. your method). Right-click and call explore. . Scribe: Is the duplicate “be” removed?

    Step 3
    Run this tester. Scribe: Did you pass all tests? If not, what did you do to fix your code?

    Driver: In your lab report, paste the correct solution.

    Step 4
    Now suppose you want to remove all duplicates, whether adjacent or not. The result will be a list of unique words. For example, if the array list contains these immortal words

    Mary had a little lamb little lamb little lamb
    Mary had a little lamb whose fleece was white as snow
    And everywhere that Mary went Mary went Mary went
    And everywhere that Mary went the lamb was sure to go

    you should produce the array list

    Mary had a little lamb
    whose fleece was white as snow
    And everywhere that went
    the sure to go

    Decide upon an algorithm and write down the pseudocode.

    Scribe: Ask yourselves:

  9. How do we know when a word is duplicated?
  10. Should we first check for duplication, or should we proactively remove all duplicates of every word?
  11. How can we be sure to leave one copy of the word in place?
  12. How do we remove all those duplicates?
  13. When removing a word and traversing an array at the same time, how does that affect the array index?
  14. Step 5
    When you are satisfied that you can implement it, add a method removeAllDuplicates to the Text class.

    Implement the method and test it as described above.

    Step 6
    Run this tester.

    Scribe: Did you pass all tests? If not, what did you do to fix your code

    Step 7
    Driver: In your lab report, paste the correct solution.

    Part C: Swapping

    Step 1
    Run this program.

    The code on lines 20 to 24 is intended to swap neighboring elements. For example,

    1 4 9 16 25 36

    is supposed to turn into

    4 1 16 9 36 25

    But as you can see, it doesn't work. Now launch the BlueJ debugger. Put a breakpoint at line 20. Click Step. And then keep clicking Step and observe the program behavior until you can tell why it fails to swap the values.

    Tip: To see the contents of the array, double-click on it in the Local Variables pane.

    Step 2
    Discuss what you learned from observing the program

    How you can fix your program so that the swapping actually works? Scribe: What did you decide?

    Step 3
    Implement your fix and test it.

    Driver: Put the fixed code in your lab report.

    Part D: More Swapping with Pictures

    Step 1
    Unzip this file and open the project in BlueJ. Run the program.

    Look at the main method in the Lab11D class. Note that a VisualArrayList is exactly like an ArrayList, except it shows you in slow motion what goes on inside.

    Step 2
    Come up with an algorithm for the following task. We want to swap the first half and the second half of the array list.

    For example, A B C D E F should turn into D E F A B C.

    You should assume that the array list has an even number of elements (not necessarily 6).

    One solution is to keep removing the element at index 0 and adding it to the back.

    A B C D E F
    B C D E F A
    C D E F A B
    D E F A B C

    Write pseudocode for this algorithm.

    Ask yourselves:

  15. Which actions need to be carried out in each loop iteration?
  16. How many iterations are there (for arbitrary even lengths, not necessarily 6)
  17. Which actions need to be carried out in each loop iteration?
  18. How do you know the positions of the elements to be swapped?
  19. How many iterations are there (for arbitrary even lengths, not necessarily 6)
  20. Step 5
    Implement your pseudocode and run it.

    Driver: Paste the main method into your lab report. Watch how much faster it runs. (This should be pretty obvious since the movement of the array elements takes time.)

    Add four more letters and run the program again to double-check that it works with any even number of letters.

    Step 3
    Implement your pseudocode and run it.

    Driver: Paste the main method into your lab report.

    Step 4
    When you run the code, you will find that there is a lot of movement in the array. Each call to remove(0) causes n - 1 elements to move, where n is the length of the array. If n is 100, then you move 99 elements 50 times, (almost 5000 move operations). That's an inefficient way of swapping the first and second halves.

    Come up with a better way in which you swap the elements directly. Hint: How do you swap elements at index1 and index2?

    A B C D E F
    D B C A E F
    D E C A B F
    D E F A B C

    Write pseudocode for this algorithm.

    Ask yourselves (Scribe: record the answers):

In: Computer Science