Using PopG, set the fitness of the aa homozgyote to 0.95 (so s = 0.05). Set the population size to 5. Run the program for 500 generations with 5 populations, no mutation, no migration and a starting allele frequency of 0.50 for the A allele. How many populations at generation 500 were fixed for the A allele?
In: Computer Science
Python
#Exercise 1
#Assign the following first names to a variable name as a list:
peter,paul,mary
#Assign the following last names to a variable name as a list:
ng,lo,lau
#Display each first name in a separate line in turn so that your
screen shows (ignore the #):
#peter
#paul
#mary
#Combine the elements in the list in turn so that you display the
full names of each person in separate lines
#Output should look like the following (ignore the #):
#peter ng
#paul lo
#mary lau
#Exercise 2
#Assign the following grades to a variable name as a list:
80,90,100,70
#Use the sum() function to total up the values in the list and
assign the sum to a variable
#Use the len() function to get the length of the list and assign
the length to a variable
#Compute the average grade using the sum and length of the list and
assign the average to a variable
#Convert the list length, list sum, and average to strings
#Display the results of your calculation in the following format
using the + concatenator
#Your total score for [length of list] grades is [sum of list]
resulting in an average of [average grade]!
#Ask the user for a grade using the prompt: New grade? (include a
space after the ?)
#Convert the new grade into an integer
#Add the new grade to the end of the existing list using the append
method
#Remove the second grade in the list using the pop method
##Use the sum() function to total up the values in the list and
assign the sum to a variable
#Use the len() function to get the length of the list and assign
the length to a variable
#Compute the average grade using the sum and length of the list and
assign the average to a variable
#Display the results of your calculation in the following format
using the + concatenator
#Your total score for [length of list] grades is [sum of list]
resulting in an average of [average grade]!
#Exercise 3
#Ask the user for a student's name using the propmt: Student Name?
(include a space after the ?)
#Assign the following grades to a variable name as a list:
80,90,70,85
#Assign the following requirement codes to a variable name as a
list: HW,MT,IC,HW
#Ask the user for a new requirement code using the prompt:
Requirement Code? (include a space after the ?)
#Ask the user for a new grade using the prompt: Grade? (include a
space after the ?)
#Add the new requirement code to the requirement code list using
the append method
#Convert the new grade to an integer
#Add the new grade to the end of the list of grades using the
append method
#Display the following: Grades for: [student name -- input from
user in first instruction of Exercise 3]
#Combine the information from both lists to display each pair of
requirement code and grade in a separate line
#The output should have the following structure:
#[requirement code] [grade]
#For example, the first two lines should read (ignore the #)
#HW 80
#MT 90
#etc until the last items in the lists -- There should be 5 lines
of code-grade pairings
#Get the sum of the grades list using the sum() function
#Get the length of the grades list using the len() function
#Compute the student's average grade using the sum and length
#Convert the average grade to a string
#Use the + concatenator to display the following statement (ignore
the #):
#[student name]: your average grade is [average grade]!
#If student name is George Smith and average grade is 80, output
should be:
#George Smith: your average grade is 80!
In: Computer Science
Provide the following operations in four-digit 10's complement math. All input is in ten's complement. Provide the output in both ten's complement and decimal sign and magnitude formats.
a) 1818 + 9282 =
b) 1808 + 1188 =
c) 1929 - 1818 =
d) 2828 - 9988 =
In: Computer Science
Python
Pierrette is at Legoland. She enjoys all the rides but hates to wait in lines. Thanks to technology,
she has an app that tells her for each ride i a time ti when there is no line. However, she wants to
take the rides in increasing fun factor order. Pierrette assigns each ride i a fun factor fi . What is
the maximum number of rides she can take?
Make sure that your code runs in O(n2 ) time in order to pass all the test cases (n is the number of
rides)
# [last_name] [first_name], [student_ID]
from typing import List
def max_num_rides(rides: List[List[int]]) -> int:
"""Calculate the maximum number of rides one can take with given constraints.
Pierrette is at Legoland. She enjoys all the rides but hates to wait in lines.
Thanks to technology, she has an app that tells her for each ride a time when
there is no line. However, she wants to take the rides in increasing fun factor
order. Pierrette assigns each ride a fun factor. This function takes pairs of
times and fun factors for all the rides, and returns the maximum number of
rides Pierrette can take.
Arguments:
rides (list): A list of [time, fun factor] pairs. For each ride, the rides
list contains a pair of time and fun factor. Both the time and the fun
factor are integers. Assume that it takes no time to take a ride. You
may further assume that all the time values are distinct and all the
fun factor values are also distinct.
Returns:
int: The maximum number of rides Pierrette can take.
Examples:
>>> print(max_num_rides([[2, 5], [1, 3]]))
2
>>> print(max_num_rides([[4, 2], [42, 3], [59, 8], [12, 4], [1, 5], [5, 7]]))
3
"""
pass # FIXME
In: Computer Science
You are the IT director for XYZ Manufacturing. Your company is a B2B (business-to-business) organization that supplies auto parts to General Motors. There are 200 employees at XYZ Manufacturing with a headquarters in Detroit, Michigan, and field offices in Omaha, Nebraska; Austin, Texas; and Orlando, Florida. There are over 10,000 items in the inventory for XYZ Manufacturing and you receive raw material (i.e. steel, plastic, wiring, etc.) from China.
XYZ Manufacturing has been struggling for years with inadequate computer resources to track inventory and handle user requests from internal management, orders and invoices from General Motors, orders and invoices from your suppliers, and management reports. There is clearly an inability to store and retrieve complex “big data,” and recently there have been frequent security breaches. Your CIO is extremely frustrated with this situation and is looking for an alternative approach to providing IT services. She has asked you for input on this investigation.
Write a paper that describes advantages and disadvantages that cloud computing offers to XYZ Manufacturing. Include a sensible, detailed strategy to migrate to cloud computing, addressing the issues of performance, scalability, and economic factors.
Your paper should be 8-10 pages in length. Include at least five credible references.
In: Computer Science
Learning Objectives
After the successful completion of this learning unit, you will be able to:
Array Practice
I recommend that before you begin the assignment you write as many of these small ungraded programming challenges as you can. You should at least write 2 or 3 of them. They are a good way to gradually build up your confidence and skills. Of course, you'll have to write a program to test each function as well. Note that none of these functions should include any input or output!
Write a function named noNegatives(). It should accept an array of integers and a size argument. It should return true if none of the values are negative. If any of the values are negative it should return false
bool noNegatives(const int array[], int size);
Write a function named absoluteValues(). It should accept an array of integers and a size argument. It should replace any negative values with the corresponding positive value.
void absoluteValues(int array[], int size);
Write a function named eCount. It should accept an array of chars and a size argument. It should return the number of times that the character 'e' shows up in the array.
int eCount(const char array[], int size);
Write a function named charCount. It should be similar to eCount, but instead of counting 'e's it should accept a third argument, a target char. The function should return the number of times the target char shows up in the array.
int charCount(const char array[], int size, char targetChar);
Write a method named isSorted. It should accept an array of integers and a size argument. It should return true if the values are sorted in ascending order. False if they are not.
bool isSorted(const int array[], int size);
Write a method named equalNeighbors. It should accept an array of chars and a size argument. It should return true if there are two adjacent elements in the array with equal values. If there are not, it should return false.
bool equalNeighbors(const char array[], int size);
This is not a homework assignment, so feel free to post your code to one of these (not more than one) to the forum at any time.
For Credit
Assignment 4.1 [45 points]
Write a program that reads five (or more) cards from the user, then analyzes the cards and prints out the category of hand that they represent.
Poker hands are categorized according to the following labels: Straight flush, four of a kind, full house, straight, flush, three of a kind, two pairs, pair, high card.
To simplify the program we will ignore card suits, and face cards. The values that the user inputs will be integer values from 2 to 9. When your program runs it should start by collecting five integer values from the user and placing the integers into an array that has 5 elements. It might look like this:
Enter five numeric cards, no face cards. Use 2 - 9. Card 1: 8 Card 2: 7 Card 3: 8 Card 4: 2 Card 5: 3
(This is a pair, since there are two eights)
No input validation is required for this assignment. You can assume that the user will always enter valid data (numbers between 2 and 9).
Since we are ignoring card suits there won't be any flushes. Your program should be able to recognize the following hand categories, listed from least valuable to most valuable:
| Hand Type | Description | Example |
| High Card | There are no matching cards, and the hand is not a straight | 2, 5, 3, 8, 7 |
| Pair | Two of the cards are identical | 2, 5, 3, 5, 7 |
| Two Pair | Two different pairs | 2, 5, 3, 5, 3 |
| Three of a kind | Three matching cards | 5, 5, 3, 5, 7 |
| Straight | 5 consecutive cards | 3, 5, 6, 4, 7 |
| Full House | A pair and three of a kind | 5, 7, 5, 7, 7 |
| Four of a kind | Four matching cards | 2, 5, 5, 5, 5 |
(A note on straights: a hand is a straight regardless of the order. So the values 3, 4, 5, 6, 7 represent a straight, but so do the values 7, 4, 5, 6, 3).
Your program should read in five values and then print out the appropriate hand type. If a hand matches more than one description, the program should print out the most valuable hand type.
Here are three sample runs of the program:
Enter five numeric cards, no face cards. Use 2 - 9. Card 1: 8 Card 2: 7 Card 3: 8 Card 4: 2 Card 5: 7 Two Pair!
Enter five numeric cards, no face cards. Use 2 - 9. Card 1: 8 Card 2: 7 Card 3: 4 Card 4: 6 Card 5: 5 Straight!
Enter five numeric cards, no face cards. Use 2 - 9. Card 1: 9 Card 2: 2 Card 3: 3 Card 4: 4 Card 5: 5 High Card!
Additional Requirements
1) You must write a function for each hand type. Each function must accept a const int array that contains five integers, each representing one of the 5 cards in the hand, and must return "true" if the hand contains the cards indicated by the name of the function, "false" if it does not. The functions should have the following signatures.
bool containsPair(const int hand[]) bool containsTwoPair(const int hand[]) bool containsThreeOfaKind(const int hand[]) bool containsStraight(const int hand[]) bool containsFullHouse(const int hand[]) bool containsFourOfaKind(const int hand[])
Note that there are some interesting questions regarding what some of these should return if the hand contains the target hand-type and also contains a higher hand-type. For example, should containsPair() return true for the hand [2, 2, 2, 3, 4]? Should it return true for [2, 2, 3, 3, 4]? [2, 2, 3, 3, 3]? I will leave these decisions up to you.
2) Of course, as a matter of good practice, you should use a constant to represent the number of cards in the hand, and everything in your code should still work if the number of cards in the hand is changed to 4 or 6 or 11 (for example). Writing your code so that it does not easily generalize to more than 5 cards allows you to avoid the objectives of this assignment (such as traversing an array using a loop). If you do this, you will receive a 0 on the assignment.
3) You do not need to write a containsHighCard function. All hands contain a highest card. If you determine that a particular hand is not one of the better hand types, then you know that it is a High Card hand.
4) Do not sort the cards in the hand. Also, do not make a copy of the hand and then sort that.
5) An important objective of this assignment is to have you practice creating excellent decomposition. Don't worry about efficiency on this assignment. Focus on excellent decomposition, which results in readable code. This is one of those programs where you can rush and get it done but end up with code that is really difficult to read, debug, modify, and re-use. If you think about it hard, you can think of really helpful ways in which to combine the tasks that the various functions are performing. 5 extra credit points on this assignment will be awarded based on the following criteria: no function may have nested loops in it. If you need nested loops, the inner loop must be turned into a separate function, hopefully in a way that makes sense and so that the separate function is general enough to be re-used by the other functions. Also, no function other than main() may have more than 5 lines of code. (This is counting declarations, but not counting the function header, blank lines, or lines that have only a curly brace on them.) In my solution I was able to create just 3 helper functions, 2 of which are used repeatedly by the various functions.
These additional criteria are intended as an extra challenge and may be difficult for many of you. If you can't figure it out, give it your best shot, but don't be too discouraged. It's just 5 points. And be sure to study the posted solution carefully.
Suggestions
Test these functions independently. Once you are sure that they all work, the program logic for the complete program will be fairly straightforward.
Here is code that tests a containsPair function:
int main() {
int hand[] = {2, 5, 3, 2, 9};
if (containsPair(hand)) {
cout << "contains a pair" << endl;
}
}
Submit Your Work
Name your source code file according to the assignment number (a1_1.cpp, a4_2.cpp, etc.). Execute the program and copy/paste the output that is produced by your program into the bottom of the source code file, making it into a comment. Use the Assignment Submission link to submit the source file. When you submit your assignment there will be a text field in which you can add a note to me (called a "comment", but don't confuse it with a C++ comment). In this "comments" section of the submission page let me know whether the program works as required.
Keep in mind that if your code does not compile you will receive a 0.
In: Computer Science
You have just been put in charge of safety at your plant. The probability of an injury occuring on any given day is p. Your boss says that once the company has 10 totoal days in which at least one injury is reported the insurance premium triples. To plan financially, she wants to know how many days to expect until the insurance premium is going to triple. Write a class called SafetyAnalysis.java that does the following:
a. Reads in a value of p from the user. Checks if it is a double and a feasible probability.
b. Determines if there is an injury each day. To do this, generate a random number between 0 and 1. If the number you generated is less than p then there was an injury. Otherwise, there was not an injury on that day.
c. Continue determining if there was an injury each day until a total of 10 days worth of injuries have occurred (hint: use a loop where you don’t know how many iterations are required).
d. Repeat b. - c. 1000 times (hint: use a loop where you do know how many iterations are required). Return the average number of days it takes until 10 total injuries occur. (hint: each time you complete c., you have a new value to include in your average) e. Report the average number of days over the 1000 experiments that it takes until 10 days of injuries occur. Print this value to the screen with the appropriate labeling information
In: Computer Science
A local biologist needs a program to predict population growth. The inputs would be: The initial number of organisms The rate of growth (a real number greater than 1) The number of hours it takes to achieve this rate A number of hours during which the population grows For example, one might start with a population of 500 organisms, a growth rate of 2, and a growth period to achieve this rate of 6 hours. Assuming that none of the organisms die, this would imply that this population would double in size every 6 hours. Thus, after allowing 6 hours for growth, we would have 1000 organisms, and after 12 hours, we would have 2000 organisms. Write a program that takes these inputs and displays a prediction of the total population. An example of the program input and output is shown below: Enter the initial number of organisms: 10 Enter the rate of growth [a real number > 0]: 2 Enter the number of hours to achieve the rate of growth: 2 Enter the total hours of growth: 6 The total population is 80
i am using python
In: Computer Science
A- Briefly explain what is the purpose of the SW operation in S-DES i.e. How would S-DES be weakened if the SW operation was ommitted.
B- Briefly explain why in DES the key is 56-bits instead of 64-bits?
In: Computer Science
(PYTHON)
A Prime number is an integer greater than 1 that cannot be formed by multiplying two smaller integer other than 1 and itself. For example, 5 is prime because the only ways of writing it as a product, 1 × 5 or 5 × 1.
In this question you will write a program that takes a sequence of integers from the user and display all the prime numbers contained in that sequence.
We will separate this question in 2 steps:
Step 1 (5 pts) Write a script that accepts a sequence of positive integer from the user and display all the prime numbers from that sequence. Your program should accept and save in a list the input from the user until the value -1 is entered. Your program should also make sure that only positive values are entered. You can assume the users only enter integers.
Step 2 (5 pts) We can improve the program usability by adding the following functions:
- A function is_prime that receives an integer as parameter, check if this integer is a prime number and returns a boolean value depending on the result. -
A function find_primes that receives the user sequence as parameter and use the function is_prime to figure out which are the prime values. The function then returns a list containing all the prime values contained in the user sequence.
Your user input script should be similar as in part 1 and use the result of the find_primes function to display the list of prime numbers.
In: Computer Science
You have been appointed as a design engineer and
assigned to design a secured network
for a private organization. Evaluate your approach to improve the
security posture of
your network before, during, and after your network
implementation.
In: Computer Science
several trends and issues that are specifically relevant to the field of instructional design and technology.
In: Computer Science
Goal:
After the manager of a local McDonalds hired several ASU grads to work the cash registers, he realized that they were having trouble figuring out the correct amount of change to return to their customers. The manager wants you to create a VB.NET program that calculates the correct amount of change to be given to a customer following a transaction.
Guidelines:
You should have
Inputs:
Transaction Amount
validation: data must have been entered, data must be numeric, amount cannot be negative or greater than $1000.00
Amount of Cash Provided By The Customer
validation: data must have been entered, data must be numeric,
amount cannot be negative and must be equal to or greater than the Transaction Amount
Outputs:
Total Amount of Change To Be Returned
Number of Twenties To Be Returned
Number of Tens To Be Returned
Number of Fives To Be Returned
Number of Ones To Be Returned
Number of Quarters To Be Returned
Number of Dimes To Be Returned
Number of Nickels To Be Returned
Number of Pennies To Be Returned
In: Computer Science
Guidelines
Look up one of the many sites describing the BMI, and read a bit about how it is used to indicate general health. Create a VB.Net program that, given a user’s height in inches and weight in pounds, will calculate and display his/her BMI. After calculating the user's BMI, indicate the user's health status.
BMI = (weight * 703) / (height * height)
Display the user’s Height Status:
|
BMI |
Health Status |
|
Below 18.5 |
Underweight |
|
18.5 -24.9 |
Normal |
|
25 - 29.9 |
Overweight |
|
30 & Above |
Obese |
Input: Height and Weight.
Output: BMI (to one decimal, like 27.7) and Weight Status (a string, like “Overweight”)
After the remarks at the top of your program, add “Option Explicit On” and “Option Strict On”. The former requires you to explicitly declare each variable used and the latter requires you to explicitly convert data from one type to another, rather than rely on VB.Net to implicitly convert data.
In: Computer Science
describe how prime numbers or quadratic congruence can be used to crack an encryption system?
In: Computer Science