Questions
IN PYTHON 3 LANGUAGE Define a recursive function named immutify; it is passed any data structure...

IN PYTHON 3 LANGUAGE

Define a recursive function named immutify; it is passed any data structure that contains int, str, tuple, list, set, frozenset, and dict values (including nested versions of any of these data structures as an argument). It returns an immutable equivalent data structure (one that could be used for values in a set or keys in a dict). The types int, str, and frozenset are already immutable. Convert a set to a frozenset; convert all the values in a tuple to be their immutable equivalents, in the same order); convert a list to a tuple (with immutable equivalents of its values, in the same order); convert a dict to tuple of 2-tuples (see the association tuple in question 2) but here with the 2-tuples sorted by the dict’s keys. If immutify ever encounters a value of another type (e.g., float) it should raise a TypeError exception.

The following call (with many mutable data structures)

Example 1:

immutify( {'b' : [1,2], 'a' : {'ab': {1,2}, 'aa' : (1,2)}} )

returns the immutable data structure

(('a', (('aa', (1, 2)), ('ab', frozenset({1, 2})))), ('b', (1, 2)))

Example 2:

immutify( [{1,2}, {3,frozenset([4,5])}, {6,7}])

Returns
(frozenset({1, 2}), frozenset({3, frozenset({4, 5})}), frozenset({6, 7}))

In: Computer Science

Please use R studio Dataset: IBM HR Analytics Employee Attrition & Performance dataset (you can download...

Please use R studio

Dataset: IBM HR Analytics Employee Attrition & Performance dataset (you can download the dataset from kaggle)

Name

Description

ATTRITION

Employee leaving the company (0=no, 1=yes)

BUSINESS TRAVEL

(1=No Travel, 2=Travel Frequently, 3=Tavel Rarely)

DEPARTMENT

(1=HR, 2=R&D, 3=Sales)

EDUCATION FIELD

(1=HR, 2=LIFE SCIENCES, 3=MARKETING, 4=MEDICAL SCIENCES, 5=OTHERS, 6= TEHCNICAL)

GENDER

(1=FEMALE, 0=MALE)

JOB ROLE

(1=HC REP, 2=HR, 3=LAB TECHNICIAN, 4=MANAGER, 5= MANAGING DIRECTOR, 6= REASEARCH DIRECTOR, 7= RESEARCH SCIENTIST, 8=SALES EXECUTIEVE, 9= SALES REPRESENTATIVE)

MARITAL STATUS

(1=DIVORCED, 2=MARRIED, 3=SINGLE)

OVER 18

(1=YES, 2=NO)

OVERTIME

(0=NO, 1=YES)

The Variable Attrition is what we plan to use as our dependent variable. The variable contains a Yes if they stay with IBM and ‘No’ if they do not. We need to create this into a binary dummy variable with 0 if they do not stay with IBM (Attrition = ‘No’) and 1 if they do stay with IBM (Attrition = ‘Yes’). This will also need to be done to the variable Gender and OverTime. Gender we can assign “Male” to zero and “Female” to one. For OverTime we will assign 0 for “No” and 1 for “Yes”.

Create Pivot tables instead of correlation matrixes for categorical variables and do the data analysis.

For data analysis:

  • Describe the data using the techniques above (e.g. “We can see in this scatter plot that there is a positive correlation between the number of hours in which the patient exercised per week and his/her weight loss.”). About one page without the images.

  • Based on these observations, draw some insights. (e.g. “We believe the patient is burning calories when exercising, thus contributing to the loss of weight”). About one page.

  • State actionable experiments based upon your insights. (e.g. “We will use multiple regression that includes hours exercised as an explanatory variable to model weight loss. We expect…”)

In: Computer Science

Considering the following different search trees, binary search trees, AVL trees, red-black trees, and others. Compare...

Considering the following different search trees, binary search trees, AVL trees, red-black trees, and others. Compare their advantages and disadvantages, running times, etc

In: Computer Science

Write a program in C++ to read 10 numbers from keyboard and find their sum, average,...

Write a program in C++ to read 10 numbers from keyboard and find their sum, average, maximum and minimum

In: Computer Science

USING JAVA, PLEASE MAKE THIS AS SIMPLE AS POSSIBLE, THIS IS AN INTRODUCTORY JAVA COURSE 1....

USING JAVA, PLEASE MAKE THIS AS SIMPLE AS POSSIBLE, THIS IS AN INTRODUCTORY JAVA COURSE

1. Design and implement a class called PairOfDice.

The class should include:

a. A non-default constructor, i.e. with parameters

b. A setter method for each instance data

c. A getter method for each instance data

d. A method roll() that rolls both dice

e. A toString() method that returns a string containing the colors of both dice, eg "Colors of both dice: Red,Blue "

f. A method pairSum that returns the current sum of the two die values. (in PairOfDice.java)

2. Write an application TestPairDice that uses the PairOfDice class to create a pair of dice. The application prints to the screen the sum of their face values. The program then rolls the pair of dice and prints to the screen the new sum of their face and the colors of both dice. (TestPairOfDice.java)

SAMPLE OUTPUT: Sum of face values before roll: 7

Sum of face values after roll: 6

Color of both dice: Red,Blue

In: Computer Science

Write a program in C++ to display the multipliaction table vertically from 1 to n (use...

Write a program in C++ to display the multipliaction table vertically from 1 to n (use setw to format the output).
1x1 = 1, 2x1 = 2, 3x1 = 3, 4x1 = 4, 5x1 = 5, 6x1 = 6, 7x1 = 7, 8x1 = 8
...
1x10 = 10, 2x10 = 20, 3x10 = 30, 4x10 = 40, 5x10 = 50, 6x10 = 60, 7x10 = 70, 8x10 = 80

In: Computer Science

Q1. a. Illustrate mathematically how to convert the following Binary number into Decimal Number system. 101112...

Q1. a. Illustrate mathematically how to convert the following Binary number into Decimal Number system.

101112 = ?10

(11.10)2= ?10

(100011.011)2 = ?10

______________________________

b. Illustrate mathematically how to convert following decimal number into binary Number system.

(345)10 = ?2

(45.25)10 = ?2

______________________________

c. Illustrate mathematically how to convert the following Octal number into Decimal Number system.

278 = ?10

308 = ?10

______________________________

d. Illustrate mathematically how to convert the following Hexadecimal number into Decimal Number system.

(2F)16 = ?10

(BCC)16 = ?10

(2F. A2)16 = ?10

______________________________

e. Illustrate mathematically how to convert following Binary number into Octal Number system.

101012 = ?8

(11100.11)2= ?8

______________________________

f. Illustrate mathematically how to convert the following Binary number into Hexadecimal Number system.

101012 = ?16

(11100.11)2= ?16

(100011.011)2 = ?16

_______________________________

g. Solve and write the result of sum for given hexadecimal number

B D 5

+ A A B

--------------------

A D 5

+ F E C

--------------------

Solve and write the result of subtraction for given hexadecimal number

B D 5

- A A B

--------------------

B C 9

- E F C

--------------------

- A F 4

A B C

--------------------

In: Computer Science

Write a program in C++ to display the following patterns: * ** *** **** 1 12...

Write a program in C++ to display the following patterns:
*
**
***
****

1
12
123
1234

1
22
333
4444

1
2 3
4 5 6
7 8 9 10

1
2 3
4 5 6
7 8 9 10

*
***
*****
*******
*********
*******
*****
***
*

In: Computer Science

Write a program in C++ to check whether a number is prime or not

Write a program in C++ to check whether a number is prime or not

In: Computer Science

Pringle et al (2015) experimentally examined the effects of fire and herbivory by elephants on the...

Pringle et al (2015) experimentally examined the effects of fire and herbivory by elephants on the density of geckos that live in trees in Kenya, using 4 ha study plots. They excluded elephants from half of the plots and left the other half unfenced. Then they burned the vegetation in half of the plots and left the other half unburned (see sketch below). Each treatment was replicated once in three different areas used as blocks: Central, North and South. Four months after the treatments were applied, the researchers estimated the density of the gecko species Lygodactylus keniensis in each plot (number of individuals / m2 ).

Block Elephant Treatment Fire Treatment July 2013 lizard density per ha
Central Elephants present Burned 853.33
Central Elephants present Unburned 183.33
Central No elephants Burned 270
Central No elephants Unburned 256.67
North Elephants present Burned 784.44
North Elephants present Unburned 298.89
North No elephants Burned 417.78
North No elephants Unburned 212.22
South Elephants present Burned 661.11
South Elephants present Unburned 356.67
South No elephants Burned 380
South No elephants Unburned 388.89

Using R, calculate the standard deviations of the four treatments

In: Computer Science

Complete the program below in order to make run properly by competing validName methods and add...

Complete the program below in order to make run properly by competing validName methods and add trycatch block in the main method.

public class ExceptionWithThrow {

public static String validName(String name) throws InputMismatchException{

// check here if the name is a valid name

// through InputMismatchException if invalid //throw

// return the name if it is valid

}

public static void main(String[] args) {

// Ask the user to enter a name and their validity through validName method

// Add try and catch block around appropriate statements

}

}

In Java Please!

In Java Please!

In Java Please!

In Java Please!

In Java Please!

In: Computer Science

There are two lights that blink at regular intervals. When each one blinks, it turns on...

There are two lights that blink at regular intervals. When each one blinks, it turns on and then immediately back off; they don’t toggle. They are both off at time t=0t=0. The first one blinks at t=p,2p,3p,…t=p,2p,3p,… seconds; the second one blinks at t=q,2q,3q,…t=q,2q,3q,… seconds. Once they start, they both keep blinking forever. It is very exciting to see them blink at the same time (on the same second). But your patience is going to run out eventually, in ss seconds. Will they blink at same time between t=1t=1 and t=st=s (inclusive)? Write a program that can answer this question, quick, before they start blinking again!

In: Computer Science

Question 4 For a family day function at Wawasan Open University, the computer department is going...

Question 4

For a family day function at Wawasan Open University, the computer department is going to conduct quiz session to give prizes to the participants. They need the sample software to conduct this quiz session. The prototype software contains two sample questions.

First, display question 1. Give 30 seconds to answer the question, showing the countdown.

If answered correctly, move to question 2 else if time out or wrong answer, prompt other participants to try to answer with another 10 second before moving to next question. End the session.

language C

In: Computer Science

Specifications Create an abstract Employee class that provides private attributes for the first name, last name,...

Specifications

  • Create an abstract Employee class that provides private attributes for the first name, last name, email address, and social security number. This class should provide functions that set and return the employee’s first name, last name, email address, and social security number. This class has a function: get_net_income which returns 0.
  • Create a Manager class that inherits the Employee class. This class should add private attributes for years of experience and the annual salary. This class should also provide necessary set and get functions. It should add a bonus ($1,000/year of experience) to the annual salary. The income tax rate should be 30%. This class should override the get_net_income function of the Employee class. Note that the gross income is calculated as follows:
    • bonus = years of experience * 1000
    • gross income = annual salary + bonus
    • tax rate = 30%
    • income tax = gross income * tax rate
    • net income = gross income - income tax
  • Create a Representative class that inherits the Employee class. This class should add private attributes for the weekly hours of work and the pay rate. This class should also provide necessary set and get functions. The income tax rate should be 20%. This class should override the get_net_income function of the Employee class. Note that the gross income is calculated as follows:
    • gross income = weekly hours of work * 52 * pay rate
    • tax rate = 20%
    • income tax = gross income * tax rate
    • net income = gross income - income tax
  • In the main function, the program should create Manager or Representative objects from the data entered by the user and save them in a list named employees. After the user has terminated data entries, your program should display the information of all employees on the output with this format: last name, first name, email, social security number, net income.

Sample Output (Your output should be similar to the text in the following box)

Welcome to my app

EMPLOYEE DATA ENTRY

Manager or Representative? (m/r): d

Invalid selection.

Continue? (y/n): y

Manager or Representative? (m/r): m

First Name: Frank
Last Name: Wilson
Email Address: [email protected]
SSN: 111-22-3333
Years of Experience: 3
Annual Salary: 95000

Continue? (y/n): y

Manager or Representative? (m/r): r

First Name: John
Last Name: Atkins
SSN: 222-33-4444
Email Address: [email protected]
Weekly Hours of Work: 40
Pay Rate: 20

Continue? (y/n): n

EMPLOYEE INFORMATION
Wilson, Frank, [email protected], 111-22-3333, $68600.00
Atkins, John, [email protected], 222-33-4444, $33280.00

Thank you for using my app

In: Computer Science

Subject: Software, Architecture Design and Testing You are to determine the user requirements for a web...

Subject: Software, Architecture Design and Testing

You are to determine the user requirements for a web phone-mail product. The primary purpose of this product is to give phone-mail users (e.g., faculty and staff) the ability to access the functionality of the phone-mail system from a web page. In general, the product should enable users of the phone-mail system to do their usual phone-mail activities via a web page.

  1. Evaluate these requirements. Do your requirements satisfy the eight criteria: Understandable, Verifiable, Independent of implementation, Consistent, Complete, Unambiguous, Realistic, Necessary? Explain your answers. Weed out any requirements that you do not think are good user requirements.
  1. Prioritize the requirements as to whether they are (1) absolutely necessary, (2) desirable, or (3) optional.

In: Computer Science