Questions
Please write unit tests for the main method below. The unit tests must be used in...

Please write unit tests for the main method below. The unit tests must be used in MSTest for Visual Studio.

C#

//main method
public static void Main(string[] args)
{
//unsorted array
int[] dataSet = new int[5] { 2, 99, 27, 68, 3 };

//sortData method called for sorting the above unsorted array
sortData(dataSet);

//iterating the sorted array
for (int i = 0; i < dataSet.Length; i++)
{
//writing the sorted array to the console
Console.WriteLine(dataSet[i]);
}
}//end method

In: Computer Science

can someone please complete this for me? losing my mind Assignment Overview The Case Assignment in...

can someone please complete this for me? losing my mind

Assignment Overview

The Case Assignment in Module 2 will accomplish three tasks:

  • Demonstrate how to use pseudo code to help programming.
  • Use Scanner class to get user input from a keyboard (allow user interaction).
  • Demonstrate how to use class and objects (OOP concepts).

Case Assignment

Write a java program to help you calculate property tax. The program will perform the following tasks:

  1. Prompt the user to enter the property value of the house.
  2. Prompt the users for the property tax rate.
  3. Display the result.

Your task:

  1. Write pseudo code based on your analysis.
  2. Write a Java application program based on your pseudo code.

In: Computer Science

what is the network administration standards ? briefly course: Network Administration

what is the network administration standards ?
briefly
course: Network Administration

In: Computer Science

Please provide new response Virtualization technology has dramatically changed the landscape of how servers are designed,...

Please provide new response

Virtualization technology has dramatically changed the landscape of how servers are designed, secured, and administered. The hypervisor market has become commoditized due to core feature overlap among most hypervisor vendors. While there are many hypervisor options in the market today–the Big 3 are VMware (ESXi), Microsoft (Hyper-V), and Citrix (XenServer). On the basis of your understanding of Virtualization technology , create a report in a Microsoft Word document addressing the following: Compare and contrast the Big 3 hypervisor options available in the market on the basis of factors such as:

Features Licensing costs Security Support Make a recommendation to Zeus Books on which hypervisor they should use to create a high availability web server environment.

In: Computer Science

Write a Python program that allows the user to perform three operations (implemented as three functions)...

Write a Python program that allows the user to perform three operations (implemented as three functions) on a dictionary:

add_to_dict(): takes a dictionary, a key, a value and adds the <key,value> pair to the dictionary. If the key is already in the dictionary, then the program displays the error message: "Error. Key already exists.".
remove_from_dict(): takes a dictionary and key and removes the key from the dictionary. If no such key is found in the dictionary then the program prints: "Key not found."
find_key(): takes dictionary and key and returns the value associated with the key or None if not found. The program prints the value if found, else prints: "Key not found."
No printing should be done inside these three functions.

The user is presented with a menu and repeatedly offered to perform an operation until he/she quits.

Finally, a list of the key-value pairs in the dictionary is printed out.

The main program is given - do not change it.

Example 1:

Menu: 
(a)dd, (r)emove, (f)ind: a
Key: rich
Value: 1
More (y/n)? y
Menu: 
(a)dd, (r)emove, (f)ind: a
Key: alireza
Value: 2
More (y/n)? n
[('alireza', '2'), ('rich', '1')]

def main():
    more_input = True
    a_dict = {}
  
    while more_input:    
        choice = menu_selection()
        execute_selection(choice, a_dict)
        again = input("More (y/n)? ")
        more_input = again.lower() == 'y'
  
    tuple_list = dict_to_tuples(a_dict)
    print(sorted(tuple_list))

main()

In: Computer Science

What Makes a Successful Programmer

What Makes a Successful Programmer

In: Computer Science

Question(on Python). There is a Python program what could solve the simple slide puzzles problem by...

Question(on Python). There is a Python program what could solve the simple slide puzzles problem by A* algorithm. Please fill in the body of the a_star() function.

In order to solve a specific problem, the a_star function needs to know the problem's start state, the desired goal state, and a function that expands a given node. To be precise, this function receives as its input the current state and the goal state and returns a list of pairs of the form (new_state, h'-score). There is exactly one such pair for each of the possible moves in the current state, with new_state being the state resulting from that move, paired with its h'-score. Note that this is not the f'-score but the h'-score, i.e., an (optimistic) estimate of the number of moves needed to reach the goal from the current state. The expand function does not know g’and therefore cannot compute f'; this has to be done by the a_star function.

The a_star function calls the expand function (in this context, slide_expand) in order to expand a node in the search tree, i.e., obtain the states that can be reached from the current one and their h’-scores. Again, please note that these are not f’-scores but h’-scores;
a_star needs to compute the h’-scores for sorting the list of open nodes. Also, note that slide_expand does not (and cannot) check whether it is creating a search cycle, i.e., whether it generates a state that is identical to one of its ancestors; this has to be done by a_star. The given slide_expand function uses the same scoring function as discussed in class – it simply counts the number of mismatched tiles (excluding the empty tile).

Please add code to the a_star function so that slide_solver can find an optimal solution for Example #1 and, in principle, for any slide puzzle. You are not allowed to modify any code outside of the a_star function. Hints: It is best to not use recursion in a_star but rather a loop that expands the next node, prevents any cycles in the search tree, sorts the list of open nodes by their scores, etc., until it finds a solution or determines that there is no solution. It is also a good idea to keep a list of ancestors for every node on the list, i.e., the list of states from the start that the algorithm went through in order to reach this node. When a goal state is reached, this list of ancestors for this node can be returned as the solution.

A_Star.py

import numpy as np

example_1_start = np.array([[2, 8, 3],
                           [1, 6, 4],
                           [7, 0, 5]])

example_1_goal = np.array([[1, 2, 3],
                           [8, 0, 4],
                           [7, 6, 5]])
 
example_2_start = np.array([[ 2,  6,  4,  8],
                            [ 5, 11,  3, 12],
                            [ 7,  0,  1, 15],
                            [10,  9, 13, 14]])

example_2_goal = np.array([[ 1,  2,  3,  4],
                           [ 5,  6,  7,  8],
                           [ 9, 10, 11, 12],
                           [13, 14, 15,  0]])

# For a given current state, move, and goal, compute the new state and its h'-score and return them as a pair. 
def make_node(state, row_from, col_from, row_to, col_to, goal):
    # Create the new state that results from playing the current move. 
    (height, width) = state.shape
    new_state = np.copy(state)
    new_state[row_to, col_to] = new_state[row_from, col_from]
    new_state[row_from, col_from] = 0
    
    # Count the mismatched numbers and use this value as the h'-score (estimated number of moves needed to reach the goal).
    mismatch_count = 0
    for i in range(height):
        for j in range(width):
            if new_state[i ,j] > 0 and new_state[i, j] != goal[i, j]:
                mismatch_count += 1
   
    return (new_state, mismatch_count)

# For given current state and goal state, create all states that can be reached from the current state
# (i.e., expand the current node in the search tree) and return a list that contains a pair (state, h'-score)
# for each of these states.   
def slide_expand(state, goal):
    node_list = []
    (height, width) = state.shape
    (empty_row, empty_col) = np.argwhere(state == 0)[0]     # Find the position of the empty tile
    
    # Based on the positin of the empty tile, find all possible moves and add a pair (new_state, h'-score)
    # for each of them.
    if empty_row > 0:
        node_list.append(make_node(state, empty_row - 1, empty_col, empty_row, empty_col, goal))
    if empty_row < height - 1:
        node_list.append(make_node(state, empty_row + 1, empty_col, empty_row, empty_col, goal))
    if empty_col > 0:
        node_list.append(make_node(state, empty_row, empty_col - 1, empty_row, empty_col, goal))
    if empty_col < width - 1:
        node_list.append(make_node(state, empty_row, empty_col + 1, empty_row, empty_col, goal))
    
    return node_list
  
# TO DO: Return either the solution as a list of states from start to goal or [] if there is no solution.               
def a_star(start, goal, expand):
    return []

# Find and print a solution for a given slide puzzle, i.e., the states we need to go through 
# in order to get from the start state to the goal state.
def slide_solver(start, goal):
    solution = a_star(start, goal, slide_expand)
    if not solution:
        print('This puzzle has no solution. Please stop trying to fool me.')
        return
        
    (height, width) = start.shape
    if height * width >= 10:            # If numbers can have two digits, more space is needed for printing
        digits = 2
    else:
        digits = 1
    horizLine = ('+' + '-' * (digits + 2)) * width + '+'
    for step in range(len(solution)):
        state = solution[step]
        for row in range(height):
            print(horizLine)
            for col in range(width):
                print('| %*d'%(digits, state[row, col]), end=' ')
            print('|')
        print(horizLine)
        if step < len(solution) - 1:
            space = ' ' * (width * (digits + 3) // 2)
            print(space + '|')
            print(space + 'V')

slide_solver(example_1_start, example_1_goal)       # Find solution to example_1

In: Computer Science

Give an O(lg n)-time EREW algorithm that determines for each object in an n-object list whether...

Give an O(lg n)-time EREW algorithm that determines for each object in an n-object list whether it is the middle (n/2

th) object.

In: Computer Science

IN JAVA Inheritance Using super in the constructor Using super in the method Method overriding Write...

IN JAVA

Inheritance

Using super in the constructor

Using super in the method

Method overriding

Write an application with five classes Vehicle, Car, Bus, Truck, and Tester class with main method in it.

The following characteristics should be used: make, weight, height, length, maxSpeed, numberDoors, maxPassenges, isConvertable, numberSeats, maxWeightLoad, and numberAxels.

Characteristics that are applicable to all vehicles should be instance variables in the Vehicle class. The others should be in the class(s) where they belong.

Class vehicle should have constructor that initializes all its data. Classes Car, Bus, and Truck will have constructors which will reuse their parents constructor and provide additional code for initializing their specific data.

Class Vehicle should have toString method that returns string representtion of all vehicle data. Classes Car, Bus, and Truck will override inherited toString method from class vehicle in order to provide appropriate string representation of all data for their classes which includes inherited data from Vehicle class and their own data.

Class Tester will instantiate 1-2 objects from those four classes (at least five total) and it will display the information about those objects by invoking their toString methods.

Submit one word document with code for all five classes, picture of program run from blueJ, and picture of UML diagram.

In: Computer Science

please i want solution for this question with algorithm and step by step with c++ language...

please i want solution for this question with algorithm and step by step with c++ language

  1. write a program using for loop that calculates the total grade for N classroom exercises as a percentage. The user should input the value for N followed by each of the N scores and totals. Calculate the overall percentage (sum of the total points earned divided by the total points possible) and output it as a percentage. Sample input and output is shown below.How many exercises to input? 3

    Score received for exercise 1: 10
    Total points possible for exercise 1: 10

    Score received for exercise 2: 7
    Total points possible for exercise 2: 12

    Score received for exercise 3: 5
    Total points possible for exercise 3: 8

    Your total is 22 out of 30, or 73.33%.

In: Computer Science

list and discuss ten shortcomings of artificial neural networks

list and discuss ten shortcomings of artificial neural networks

In: Computer Science

Introduction to Algorithms - Analysis of Algorithms Solve the following recurrence relation: T(n) = T(an) +...

Introduction to Algorithms - Analysis of Algorithms

Solve the following recurrence relation: T(n) = T(an) + T((1 - a)n) + n

In: Computer Science

Which of the following is NOT available with a half adder? Sum Carry In Carry Out...

  1. Which of the following is NOT available with a half adder?
  1. Sum
  2. Carry In
  3. Carry Out
  4. None of the above

  1. For an 8x1 multiplexer, how many control signals/inputs are in need?
  1. 1    
  2. 2
  3. 3
  4. 4

  1. How many outputs are there for a decoder with 4 inputs (assuming no extra control signals/inputs)?
  1. 4
  2. 8
  3. 12
  4. 16

  1. After a logic right-shift (by one position), a given sequence 1100 1110 turns into
  1. 1100 1110
  2. 0110 0111
  3. 1110 0111
  4. 1001 1100

  1. After a logic left-shift (by two positions), a given sequence 1100 1110 turns into
  1. 1001 1100
  2. 1001 1101
  3. 0011 1000
  4. 0011 1001

  1. After an arithmetic right-shift (by one position), a given sequence 1100 1110 turns into
  1. 1100 1110
  2. 0110 0111
  3. 1110 0111
  4. 1001 1100

  1. Which of the following shifting operations may cause an overflow?
  1. Logic left-shift
  2. Logic right-shift
  3. Arithmetic left-shift
  4. Arithmetic right-shift

In: Computer Science

Complete the reading of NIST Special Publication 800-145 (2011). NIST Definition of Cloud Computing, then branch...

Complete the reading of NIST Special Publication 800-145 (2011). NIST Definition of Cloud Computing, then branch out into Internet research on how the term “Cloud Computing” has evolved and what it means now. You can talk about how cloud services are increasingly relevant to businesses today. Feel free to use an example for Infrastructure as a Service (IaaS) or Software as a Service (Saas) and talk about why companies are moving their onsite infrastructure to the cloud in many cases. Think Microsoft Azure, Amazon Web Services, Rackspace, or any number of cloud providers.

Go ahead and have a little fun with it if you like also: Pretend you are an IT manager and need to recommend a solution for moving a piece of software or hardware into the cloud. What provider would you use and why? Or would you instead recommend keeping servers/software in house?

You must post your initial response (with APA 6th ed or higher references) before being able to review other students' responses. Once you have made your first response, you will be able to reply to other students’ posts. You are expected to make a minimum of 3 responses to your fellow students' posts.

In: Computer Science

What would have to be changed in the code if the while statement were changed to:...

What would have to be changed in the code if the while statement were changed to:

while (menu == 5);

Code is as follows

 
  1. #include <stdio.h>

  2. void printHelp ()

  3. {

  4. printf ("\n");

  5. printf ("a: a(x) = x*x\n");

  6. printf ("b: b(x) = x*x*x\n");

  7. printf ("c: c(x) = x^2 + 2*x + 7\n");

  8. printf ("d: shrink(x) = x/2\n");

  9. printf ("q: quit\n");

  10. }

  11. void a(float x)

  12. {

  13. float v = x*x;

  14. printf (" a(%.2f) = %.2f^2 = %.2f\n", x, x, v);

  15. } // end function a

  16. void b(float x)

  17. {

  18. float v = x*x*x;

  19. printf (" b(%.2f) = %.2f^3 = %.2f\n", x, x, v);

  20. } // end function b

  21. void c(float x)

  22. {

  23. float v = x*x + 2*x + 7;

  24. printf (" c(%.2f) = %.2f^2 + 2*%.2f + 7 = %.2f\n",

  25. x, x, x, v);

  26. } // end function c

  27. void shrink(float x){

  28. float v = x/2;

  29. printf("shrink(%.2f) = %.2f/2 = %.2f\n", x, x, v);

  30. }//end of function shrink

  31. int menu ()

  32. {

  33. char selection;

  34. float x;

  35. printHelp ();

  36. scanf ("%s", &selection);

  37. if (selection == 'q')

  38. return 1;

  39. scanf ("%f", &x);

  40. if (selection == 'a')

  41. a(x);

  42. if (selection == 'b')

  43. b(x);

  44. if (selection == 'c')

  45. c(x);

  46. if(selection == 'd')

  47. shrink(x);

  48. return 0;

  49. } // end function menu

  50. int main()

  51. {

  52. while (menu() == 0);

  53. printf ("... bye ...\n");

  54. return 0;

  55. } // end main

In: Computer Science