Questions
Write a method to return the surface area of a right rectangular prism given the dimensions...

Write a method to return the surface area of a right rectangular prism given the dimensions Example: surface_area(3, 5, 7) returns 142. Java Program (Using Method)

In: Computer Science

Write a Python function that will ask the user for an integer X bigger than 20...

Write a Python function that will ask the user for an integer X bigger than 20 and return a list "ls" of 10 distinct random integers taken between the interval 0, to X. None of the 10 elements of "ls" should be repeated.

In: Computer Science

Show algebraically the payoff of a butterfly spread using calls in the following cases: – ST...

Show algebraically the payoff of a butterfly spread using calls in the following cases:

– ST < K1
– K1 < ST < K2
– K2 < ST < K3
– ST > K3

Assume K2 is the average of K1 and K3: K2 = .5*(K1 + K3) or 2K2 = K1 + K3 (i.e., the butterfly trade is symmetric). You can use this relationship to simplify the final expressions quite a bit.

In: Computer Science

Write a Python function that will return the index of an element in a list.1- The...

Write a Python function that will return the index of an element in a list.1- The function will receive a list of at least 5 numbers as a single argument when the function is called. 2. The function will ask the user to input a number and will find and return the index of that number in the list.3. If the number is not an element of the list, the function returns the string "unknown."

In: Computer Science

1. Yes or No? Recall the heuristics from the 8-puzzle problem: h1 is the number of...

1. Yes or No? Recall the heuristics from the 8-puzzle problem: h1 is the number of out of place tiles, and h2 is the Manhattan distance. Is a combined heuristic (h1 + h2)/2 also admissible? Provide a justification.

2. In a fully observable, turn-taking, zero-sum game between two perfectly rational players, it does not help the first player to know what move the second player will make.

In: Computer Science

Write a Python program that will ask the user to input a word, will return the...

Write a Python program that will ask the user to input a word, will return the first letter of the input word, and ask the user to put another word, and so on, in the form of a loop. If the user chooses to stop, he or she should input the integer "0" for the loop to stop.

In: Computer Science

1. The minimax algorithm yields sub-optimal utilities against sub-optimal opponents.Yes or No? Provide a justification. 2....

1. The minimax algorithm yields sub-optimal utilities against sub-optimal opponents.Yes or No? Provide a justification.

2. Alpha-beta pruning allows minimax to search deeper into the game tree by obtaining a more accurate estimate of the evaluation function, i.e. by calculating better bounds. Yes or No? Provide a justification.

In: Computer Science

Write a Python function that will do the following:1. Ask the user to input an integer...

Write a Python function that will do the following:1. Ask the user to input an integer which will be appended to a list that was originally empty. This will be done 5 times, meaning that when the input is complete, the list will have five elements (all integers).2. Determine whether each element is an even number or an odd number3. Return a list of five-string elements "odd" and "even" that map the indexes of the elements of the input list, according to whether these elements are even or odd numbers. For example: if the input sequence is 10, 7, 9, 51, and 100, the function will return the list ["even", "odd", "odd", "odd", "even"].

In: Computer Science

Create a database for PAINTER and PAINTING entities/tables; Decide on your own what will be the...

Create a database for PAINTER and PAINTING entities/tables;

Decide on your own what will be the attributes of PAINTER and PAINTING tables;

Insert at least 5 records on each table

Deliverables:

Screenshot of PAINTER and PAINTING table structures using the describe command

Screenshot of PAINTER and PAINTING table records/entries using select command.

Submit your file in PDF format.

In: Computer Science

In this programming question, n integers ranging from 0 to n-1 are stored randomly in A,...

In this programming question, n integers ranging from 0 to n-1 are stored randomly in A, an array of size n. In the class Sort.java, you are supposed to implement the following two sorting algorithms: Insertion-sort and Heap-sort. You have to work directly on the given starter code.

  • Download the starter code from the course web site. Read the starter code and make sure you understand how it works before attempting to modify it. In the given class Sort.java, Selection-sort is already implemented and is used to sort an array of numbers from 0 to 9.

    Initially, the array is: 0123456789

    After randomization, the array becomes: 8201954367

         SELECTION SORT...
    

    The array is now sorted: 0123456789

  • Implement Insertion-sort and Heap-sort in the Sort class.

  • ////////

  • import java.util.Random;

    public class Sort {
          
       // swap the ith element with the jth elements.
       private void swap(int[] a, int i, int j){
           int temp;
           temp = a[i]; a[i] = a[j]; a[j] = temp;
       }
      
       // initialize the array a with elements from 0 to size-1.
       public void initializeArray(int[] a, int size){
           for (int i=0; i            a[i]=i;
           }
       }
      
       // display the elements in the array a, rowSize elements per row.
       public void displayArray(int[] a, int size){
           int rowSize=100;
           for (int i=0; i            if(i%rowSize==0){
                   System.out.println();
               }
               System.out.print(a[i]+ " ");
           }
           System.out.println();
       }
      
       // randomly swap two elements in a for SWAPTIMES times.
       public void randomizeArray(int[] a, int size){
           final int SWAPTIMES = 10000;
           Random r = new Random();
    int j, k;
    for(int i=0; i< SWAPTIMES; i++){
       j = r.nextInt(size);
       k = r.nextInt(size);
       this.swap(a, j, k);
    }
       }
      
      
       // selectionSort
       public void selectionSort(int a[], int size){
           int i, j, min, minIndex;
           for (j=0; j            minIndex=j; min = a[j];
               for (i=j+1; i                if(a[i] < min ){minIndex=i; min = a[i];}
               }
               this.swap(a, j, minIndex);
           }
       }
      
    }   

  • ////

  • public class Starter{
       public static void main(String[] args) {
    final int SIZE = 10;
    int[] array = new int[SIZE];
      
    Sort s = new Sort();
      
    s.initializeArray(array, SIZE);
    System.out.print("Initially, the array is:");
    s.displayArray(array, SIZE);
      
    System.out.println();
    System.out.print("After randomization, the array becomes:");

    s.randomizeArray(array, SIZE);
    s.displayArray(array, SIZE);
    System.out.println("\nSELECTION SORT...\n");
    System.out.print("The array is now sorted:");

    s.selectionSort(array, SIZE);
    s.displayArray(array, SIZE);

      
    }
    }

In: Computer Science

Overview The purpose of this assignment is to give you experience designing a database and building...

Overview

The purpose of this assignment is to give you experience designing a database and building an Entity Relationship Diagram in a business scenario. Submit all tasks in one document. Include headings in your document.

The organization is a dentist's office. When new patients are seen for the first time, they complete a patient information form that asks for their name, address, phone number, and brief medical history, which are stored in the patient information file. When a patient calls to schedule a new appointment or change an existing appointment, the receptionist checks the appointment file for an available time. Once a good time is found for the patient, the appointment is scheduled. If the patient is a new patient, an incomplete entry is made in the patient file; the full information will be collected when the patient arrives for the appointment. Because appointments are often made far in advance, the receptionist usually mails a reminder postcard to each patient 2 weeks before the appointment.

Consider the information needed for the patient billing system:

• Patient information - The system should be able to retrieve their contact information as well as their age, blood type, occupation, employer information, and insurance carrier information.

• Insurance carrier information -The system should be able to retrieve the number of patients on plan and the carrier's contact information.

• Dentist information - The system should be able to retrieve information about the dentist.

Instructions

After completing the learning activities for this module, use what you have learned to complete this assignment:

1. Create a Class diagram. Draw a conceptual class diagram with a minimum of 7 classes.

2. Create an Entity Relationship Diagram (ERD). Include a minimum of 7 entities and 50 attributes.

3. Create a CRUD Matrix.

In: Computer Science

Write a Python code that will ask a user to input a year and return "Leap...

Write a Python code that will ask a user to input a year and return "Leap Year" if the year is a leap year, or "No Leap Year" if it is not a leap year. The program then asks for another year and performs the same task in the form of a loop, until the user inputs the then integer "-1." At that point, the program will exit the loop.

In: Computer Science

Program to implement in c++ dont forget to implement the 2D array and print whether the...

Program to implement in c++

dont forget to implement the 2D array and print whether the vehicle is available or not! This is the main part that I dont know how to implement! no good rating if this isnt done.

Define a class Vehicle that has the following data members:  Model of the vehicle (e.g., Ford, Toyota) as a standard library string.  The date that vehicle has joined to the fleet use the class Date that has the following data members:month, day, year. The mileage of the vehicle as an integer.  A four digit id of the vehicle as a standard library string, such as string vehicle_id = "2345";  A two-dimensional 12-by-30 array of Boolean variables that shows whether the vehicle is available or has been rented out for each day of the year. If the vehicle is available on a given date then Boolean variable is true and if rented out is false. Each row of the array corresponds to a month and for simplicity we assume that the number of days in each month is 30.

In: Computer Science

Provider Department Hospitalization MaxAmount MinAmount Pro1 Dep1 12 12 10 Pro1 Dep1 10 12 10 Pro1...

Provider Department Hospitalization MaxAmount MinAmount
Pro1 Dep1 12 12 10
Pro1 Dep1 10 12 10
Pro1 Dep1 11 12 10
Pro2 Dep2 22 32 19
Pro2 Dep2 32 32 19
Pro2 Dep2 19 32 19
Pro3 Dep3 34 34 10
Pro3 Dep3 10 34 10
Pro3 Dep3 17 34 10
Pro4 Dep4 23 23 23

Using Windows Functions

a) Write a query that will produce the table above as an outcome

b) Why are all the values equal in the last tuple of the table

c) Write a second query that will add a column to the table that will also provide the max amount of hospitalization for all providers.

In: Computer Science

Answer the following questions and provide a brief explanation: How many values does it take to...

Answer the following questions and provide a brief explanation:

  1. How many values does it take to represent a joint distribution p(x, y) of 4 boolean variables?
  2. How many of these values can be chosen independently?
  3. What are the answers for the above question if we know that x and y are independent?

In: Computer Science