Randomly generate 0, 1, or 2 in a 100 by 100 2d array.
For each entry in the 2d array, count the number of 0’s and 1’s in
the surrounding entries.
Save the result in two 2d arrays: one for the number of 0’s, one
for the number of 1’s.
For example:
0 0 1
2 1 0
0 0 0
The number of 0’s for a[0][0] is 1; the number of 1’s for
a[0][0] is 1;
The number of 0’s for a[0][1] is 2; the number of 1’s for a[0][1]
is 2;
The number of 0’s for a[0][2] is 2; the number of 1’s for a[0][2]
is 1;
The number of 0’s for a[1][0] is 4; the number of 1’s for a[1][0]
is 1;
The number of 0’s for a[1][1] is 6; the number of 1’s for a[1][1]
is 1;
The number of 0’s for a[1][2] is 3; the number of 1’s for a[1][2]
is 2;
The number of 0’s for a[2][0] is 1; the number of 1’s for a[2][0]
is 1;
The number of 0’s for a[2][1] is 3; the number of 1’s for a[2][1]
is 1;
The number of 0’s for a[2][2] is 2; the number of 1’s for a[2][2]
is 1;
In: Computer Science
3.1 Bratko states that iterative deepening combines the best
properties of breadth-first search and depth-first search and is
therefore, in practice, often the best choice
amongst the basic search methods. Discuss this statement.
3.2 Discuss the concept of the ‘locality’ of the effects of actions
in the context of planning problems.
In: Computer Science
Declare two 2d arrays n0[MAX_ROW][MAX_COL], n1
[MAX_ROW][MAX_COL].
Then, loop through the 2d array and save the results in n0 and
n1:
for (i=0; i<MAX_ROW; i++)
for (j=0; j<MAX_COL;j++){
//calculate number of
zeros around entry a[i][j]
n0[i][j] =
//calculate number of
ones around entry a[i][j]
n1[i][j] =
}
Set the MAX_ROW and MAX_COL to a small number and display all three 2d arrays on the screen to verify that the calculations are correct. You may still use command-line inputs as in the example program to set the actual size of the array (must be less than or equal to MAX_ROW, MAX_COL.
In: Computer Science
You are going to begin the process of data gathering. There are three types of data you will be gathering – Administrative, Technical and Physical. For this assignment, you will be gathering your administrative data. This data will be created by you for your fictitious company. You may use as many resources as you need in order to develop this data. The Internet, data from real companies, and data you just make up on your own may be used. Areas of data that need to be gathered are as follows:
All of the above information will be documented in the risk assessment. In some cases it will be tested and questions to appropriate personnel will be asked.
In: Computer Science
Write C code to approximate Sin(x) and Cos(x) function using Taylor’s series. The angle x is expressed in radians. Use the first FIVE terms of Taylor’s series to approximate Sine/Cosine function.
a. Compare your Taylor’s series approximation of Sine/Cosine function with the math.h implementation of sin and cos function.
b. Determine tan(x) from Taylor’s series approximation of Sine/Cosine functions, for x = 0, PI/4, PI/2, PI. Use PI = 3.14159.
In: Computer Science
write a comprehensive research on
Architectural styles and frameworks that are used in software
development, and complete the following:
From your research, select an architectural style that
is used in a real-world system.
Describe the real-world system and the architectural
style.
Justify why this architectural style is well-suited
for the selected real-world system.
In: Computer Science
In: Computer Science
Describe different techniques for masquerading as a particular host that uses SSL.
In: Computer Science
Q.1 Write a python program that will take in basic information from a student, including student name, degree name, number of credits taken so far, and the total number of credits required in the degree program. The program will then calculate how many credits are needed to graduate. Display should include the student name, the degree name, and credits left to graduate.
Write two print statements in this program. In the first one, use the .format method with pre-specified order of the displayed outputs.
In the second print, using different % operators to display the output. Make sure to display the output in an aligned format (look into a sample of the output below..).
Student name: xyz xyz
Degree name: comp. engineering
Credit taken so far: 13
Total number of credits required: 33
Number of credits needed to graduate: 20
Q.2 Write a python program that will take in the number of call minutes used. Your program will calculate the amount of charge for the first 200 minutes with a rate of $0.25; the remaining minutes with a rate of $0.35. The tax amount is calculated as 13% on top of the total. The customer could have a credit that also has to be considered in the calculation process. Finally, the program displays all these information. Below is a sample run:
Customer account number: 12345
Minutes used: (you provide)
Charge for the first 200 minutes@ 0.25: (you provide)
Charge for the remaining minutes@ 0.35: (you provide)
Taxes: (you provide)
Credits: (you provide)
Total bill: (you provide)
please provide .py program file screenshot and output.
In: Computer Science
Write a program driver that demonstrates that
your additions work. Use the following sets as part of your
demonstration
A {1,3,8}
B {2,3,5,10}
C {4,6}
show
A && B
A - B
A || B
A / B
A && C
A - C
A || C
A / C
In: Computer Science
Write a method that will have a C++ string passed to it. The string will be an email address and the method will return a bool to indicate that the email address is valid.
Email Validation Rules: ( These rules are not official.)
1) No whitespace allowed
2) 1 and only 1 @ symbol
3) 1 and only 1 period allowed after the @ symbol. Periods can exist before the @ sign.
4) 3 and only 3 characters after the period is required.
*****************************
Program will prompt for an email address and report if it is valid or not according to the rules posted above. The program will loop and prompt me to continue.
*****************************
In: Computer Science
There is a single-plank bridge. Only one person can cross the
bridge without any stop. The pedestrian can cross the bridge from
west to east or from east to west. If there is more than 0
pedestrian crossing the bridge from west to east, no pedestrian can
try to cross the bridge from east to west, but more than 1
pedestrian can cross the bridge from west to east, and vice versa.
The pedestrian can cross the bridge immediately if there is no
pedestrian on the bridge. Use Semaphore to solve this
problem.
In: Computer Science
A priority queue can be implemented as a heap because
a. The root can be easily be identified as the topmost priority.
b. The heap is not always sorted so any value can be the top priority.
c. The heap always has a left bottom node that can be the top priority.
d. None of the above.
In: Computer Science
Use JAVAfor this program
Program Description
You work in a local gift shop that is currently running a large sale. You have been asked to create a program to calculate the total of a user’s purchases and determine if they qualify for a discount. Use the following steps to create the program:
Subtotal = Price * Quantity
|
Subtotal |
Discount |
|
Under $25 |
5% discount |
|
$25 but not more than $75. |
10% discount |
|
Over $75 |
15% discount |
Discount Amount = Subtotal * (Discount/100)
Discounted Cost = Subtotal - Discount Amount
Sample Input and Output (formatting, spacing, and indentation should be as shown below)
What is the price of the item you wish to purchase?
17.99
What is the quantity you wish to purchase? 3
What is the name of the item? T-Shirt
Discount Calculation Utility
Item
Name:
T-Shirt
Price: $17.99
Quantity:
3
Subtotal: $53.97
Discount: $5.40
Discounted Cost: $48.57
In: Computer Science
In: Computer Science