Questions
Write a python program to create a list of integers using random function. Use map function...

Write a python program to create a list of integers using random function. Use map function to process the list on the series: x + x2/2! + x3/3! + ….n and store the mapped elements in another list. Assume the value of n as 10

In: Computer Science

For this lab you will implement the class Ball which represents a toy ball. Ball should...

For this lab you will implement the class Ball which represents a toy ball. Ball should have a method bounce() whose return type is void, and should have an integer member bounces that counts the number of times the ball has been bounced. Ball should also have a static method named getTotalBounces which counts the total number of times that any Ball object has been bounced. To do this, you will want to include a static integer member totalBounces which counts the total number of bounces. Once implemented the following code in the main of UseBall should output the number 2 (You should create UseBall.java as well, right?): Ball b1 = new Ball(); Ball b2 = new Ball(); b1.bounce(); b2.bounce(); System.out.println(Ball.getTotalBounces()); Next, we will add some functionality to Ball. First, implement a method void reset(int count) which sets bounces to the value provided in count. How does this affect totalBounces? Next, include an integer variable to keep track of the total number of balls which have been created. Should this variable be static or dynamic? Use this variable to implement the static method getAverageBounces() which returns the average of the number of times that any ball has been bounced. Finally, as a challenge, try to implement the static method bounceAll() which bounces each of the balls at once. This will be difficult unless you include one more static integer member in the class - and even then it might be a bit tricky. Give it your best shot, and don't hesitate to ask the lab assistants for help!

In: Computer Science

In Java: 1) Create a new eclipse project. 2) Create a basic SWING window 3) Create...

In Java:

1) Create a new eclipse project.

2) Create a basic SWING window

3) Create a Label Called Name

4) Create a Text Field for entering the name

5) Create a Text Field for entering and email

5) Create a text area to push the results to

6) Create two buttons, one that says submit and the other that says clear.

7) When the user enters their name and email, they should press submit and see the Text area populate with the data they submitted.

8) When the user presses clear it should clear any text from all fields.

In: Computer Science

Translate following C# code into MIPS assembly language int recursive(int x) { return (x >= 0xFF)...

Translate following C# code into MIPS assembly language

int recursive(int x) {
return (x >= 0xFF) ? (recursive(x - 3) + recursive(x - 2))

                : ((x >= 0xF) ? recursive(x - 1) + 1 : 1);

In: Computer Science

As I was on a hike the other day I came across a small child in...

As I was on a hike the other day I came across a small child in the woods. He told me his life story, with special mention of his disabled sister who loves flowers, and asked me for a favor. He wanted a way to organize the flowers that he picks for her each day and perform a few basic tasks with them, along with a few restrictions. It is our goal to help him out! • He can only carry 25 flowers as adding any more causes many of them to become crushed. • All flowers should be able to be displayed • He should be able to add and remove flowers by using their name. • He needs to be able to search for a specific type of flower in his pack in case his sister has a special request. • He needs to be able to sort flowers by their names alphabetically in ascending order (A-Z) • He needs to show how many of each flower he has in his pack. Now, I have started a simple program which will serve as guidance for you, please help me finish it. (Please don’t modify the code that I give you, just add your code where required) Submit 1 file: Assignment1.java import java.util.Scanner; public class Assignment01Driver { public static void main(String[] args){ new Assignment01Driver (); } // This will act as our program switchboard public Assignment01Driver (){ Scanner input = new Scanner(System.in); String[] flowerPack = new String[25]; System.out.println("Welcome to my flower pack interface."); System.out.println("Please select a number from the options below"); System.out.println(""); while(true){ // Give the user a list of their options System.out.println("1: Add an item to the pack."); System.out.println("2: Remove an item from the pack."); System.out.println("3: Sort the contents of the pack."); System.out.println("4: Search for a flower."); System.out.println("5: Display the flowers in the pack."); System.out.println("0: Exit the flower pack interfact."); // Get the user input int userChoice = input.nextInt(); switch(userChoice){ case 1: addFlower(flowerPack); break; case 2: removeFlower(flowerPack); break; case 3: sortFlowers(flowerPack); break; case 4: searchFlowers(flowerPack); break; case 5: displayFlowers(flowerPack); break; case 0: System.out.println("Thank you for using the flower pack interface. See you again soon!"); System.exit(0); } } } private void addFlower(String flowerPack[]) { // TODO: Add a flower that is specified by the user } private void removeFlower(String flowerPack[]) { // TODO: Remove a flower that is specified by the user } private void sortFlowers(String flowerPack[]) { // TODO: Sort the flowers in the pack (No need to display them here) - Use Selection or Insertion sorts // NOTE: Special care is needed when dealing with strings! research the compareTo() method with strings } private void searchFlowers(String flowerPack[]) { // TODO: Search for a user specified flower } private void displayFlowers(String flowerPack[]) { // TODO: Display only the unique flowers along with a count of any duplicates /* * For example it should say * Roses - 7 * Daffodils - 3 * Violets - 5 */ } }

In: Computer Science

Project name: Practical1LastFirst You are being asked to create a program related to tracking players on...

Project name: Practical1LastFirst

You are being asked to create a program related to tracking players on a ringette team. It is important to create as per the requirements document. The details of the RingettePlayer class are provided in the following class diagram.

RingettePlayer

-firstName: String

-lastName: String

-allergies: String

-jerseyNumber: int

-birthYear: int

Constructors

+RingettePlayer()    

+RingettePlayer(String, String)

+RingettePlayer(int)

+RingettePlayer(String, String, String, int)   

+getters/setters for all

+getInformation():void

+display():void

+toString(): String

Default Values for Attributes

When values are not provided for attributes, the following are the values that should be set for the attributes. Note that these are the only attributes that are to be in the class.

  • firstName and lastName default: “Unknown”
  • allergies default: “”
    • The default for allergies is an empty string
  • jerseyNumber and birthYear: 0

Constructor Details

Create four constructors in the RingettePlayer class based on the following requirements.

  • Default no-parameter constructor
    • Create a default no-parameter constructor for the RingettePlayer which sets attributes to their default values.
  • RingettePlayer(String, String)   
    • First and last names passed as parameters and set.
    • the jersey number, birthYear and allergies set to their default values
  • RingettePlayer(int)
    • jerseyNumber passed as a parameter
    • Other attributes are set to their default values
  • RingettePlayer(String, String, String int, int)
    • Values for all attributes are passed in as parameters and used to set object attribute values.

Controller Class Functionality

In the main method create three object based on the following specifications. You can use your own name for the variable name.

  • The first object created should be created using the constructor that accepts two Strings to set the first and last name in the instance (example: “Brielle”, “Jones”). The user does not have to be prompted for these values. They are to be set as hard coded values.
  • The second object created should be created with the default constructor and the setters used to set her first name (“Marley”), last name (“Stephens”), allergies (“Dust”) and jersey number (9). The user does not have to be prompted for these values. They are to be set as hard coded values.
  • The third object should be created using the default constructor. The values for this object are to be obtained from the user by using the getInformation() method. The output below shows an example with user entered data.
    • Note that when the program runs, they would be prompted for the values of this object as the first interaction with the user.

Additional Requirements

  • After creating each of these objects in the main method, have the program display their values to the console.

Ringette Players

Name: Brielle Jones Jersey Number: 0 Allergies: Birth Year: 0

Name: Marley Stephens Jersey Number: 9 Allergies: Dust Birth Year: 0

Name: Sarah Miles Jersey Number: 15 Allergies: Nuts Birth Year: 2009

  • After showing each of the players above have an additional output which shows the allergies only.

Allergies for all players:

Dust Nuts

In: Computer Science

Need the slack clone by using react. Create slack clone by using ReactJS library. Use material...

Need the slack clone by using react.

Create slack clone by using ReactJS library. Use material UI for Design improvements and Icons.

Urgently required before evening... Don't give useless answers. I'll downvote if not according to expectations.

In: Computer Science

Comment the question: P = NP

Comment the question: P = NP

In: Computer Science

i need this program to also print out the number of combinations #include <stdio.h> #include <string.h>...

i need this program to also print out the number of combinations

#include <stdio.h>
#include <string.h>
#define N 10

void generate(char *array, int n)
{
   if (n==0)
   {
       printf("%s\n",array);
       return;
   }
   for (int i = 0; i < n; ++i)
   {
       // generate all of the permutations that end with the last element
       generate(array, n-1);
       // swap the element
       char temp = array[n-1];
       array[n-1] = array[(n%2)*i];
       array[(n%2)*i] = temp;
   }
}

int main(int argc, char const *argv[])
{
   char array[N];
   printf("Enter word: ");
   scanf("%s",array);
   generate(array, strlen(array));
   return 0;
}

In: Computer Science

You will be writing the function definition and the main function with the function call. Be...

You will be writing the function definition and the main function with the function call.

Be sure to write the function definition below the main function.

The function prototype has been provided, you may add the prototype to you answer.

You do not need to add the preprocessor directives like #include<stdio.h>.

Write the function definition for UpdateGrade . The function will take two arguments, a double called originalGrade a pointer to a double called newGradePtr.

This function will have a void return type.

Inside the  UpdateGrade function:

  • Declare, ask, and get the number of points to be added to the original grade
  • Add the bonus points to the original grade
  • Store the result in the "value at" newGradePtr

In the main function

  • Declare the local variables(grade, updatedGrade).
  • Ask and get the original grade and pass the grade (by copy) and pass the "address of" the updatedGrade.
  • Print the updatedGrade onto the screen

#include<stdio.h>

//function prototypes

void UpdateGrade(double originalGrade, double *newGradePtr);

in C programming language

In: Computer Science

1. Given a vector, a, of length n, write down the MATLAB expressions that will correctly...

1. Given a vector, a, of length n, write down the MATLAB expressions that will correctly compute the following:

a.        ln (3 + a + a2 )

b.         ea (1 + cos(3a))

c.         cos2 (a) + sin2 (a)

d.         tan-1 (a)

Test that your solution works for a = 1:0.2:2

2. a. Create a vector of odd whole numbers between 10 and 40.

      b. Create a vector of even whole numbers between 25 and 35.

3. Plot a Straight line with slope m=0.5 c=-2 at the following coordinates X=0, 4,5,7,9,10,12,15.

4.   Plot y=sin x, 0<=x<=4pi, taking 50,100 linearly spaced points in the given interval.

In: Computer Science

What do you understand by polymorphism? Why are they useful? Explain each type of polymorphism using...

  1. What do you understand by polymorphism? Why are they useful? Explain each type of polymorphism using a clear example. [15 points]

In: Computer Science

Write a code in arm 8086 keil software version 5 for signed input and perform addition...

Write a code in arm 8086 keil software version 5 for signed input and perform addition and subtraction using both direct and indirect addressing mode.

In: Computer Science

How many race conditions does attackers have to win in the following program? int main() {...

How many race conditions does attackers have to win in the following program?

int main() {

struct stat stat1, stat2;

int fd1, fd2;

if (access("/tmp/XYZ", O_RDWR)) {

fprintf(stderr, "Permission denied\n");

return -1;

}

else fd1 = open("/tmp/XYZ", O_RDWR);

if (access("/tmp/XYZ", O_RDWR)) { '

fprintf(stderr, "Permission denied\n");

return -1;

}

else fd2 = open("/tmp/XYZ", O_RDWR);

// Check whether fd1 and fd2 have the same inode.

fstat(fd1, &stat1);

fstat(fd2, &stat2);

if(stat1.st_ino == stat2.st_ino) {

write_to_file(fd1);

}

else {

fprintf(stderr, "Race condition detected\n");

return -1;

}

return 0;

}

In: Computer Science

Without using extra structures, write a recursive method recursivenumberOfNonZeros (Queue<Integer> q)in Test class (in stacks_queues package)...

Without using extra structures, write a recursive method recursivenumberOfNonZeros (Queue<Integer> q)in Test class (in stacks_queues package) that receives a queue contains integer objects and return total number of non zeros in this queue. Then don’t forget to test the method in the main.
Note: Make sure not to change the order of the other values in queue after calling the method.

In: Computer Science