Questions
State two reasons why it is advisable to place the transaction log on a separate disk...

State two reasons why it is advisable to place the transaction log on a separate disk device from the actual data?

In: Computer Science

( Posting the same question for third time. Can I please get answer in C++.( and...

( Posting the same question for third time. Can I please get answer in C++.( and not in C or Java) ..... Please Try and Provide me a complete programm Answer. not just one or two function)

* Declare a single dimensional array of 65 characters. Convert each character into an integer and store it in a linked list. Manipulate the linked list by completing the following task:

Create an additional linked list call greater_List, using the original linked list copy all number greater than 100 into the greater_list and give a total count of the numbers greater than 100. Create an additional array called less_array, copy all the numbers less than or equal to 100 in the original list into less_array give a total count of the numbers that are less than or equal to 100.

In: Computer Science

Write a Java program to do the following with your name. This can all be done...

Write a Java program to do the following with your name. This can all be done in the main() method.

1. Create a String variable called myName and assign your personal name to it. Use proper capitalization for a legal name. I.e. String myName = "Billy Bob";

2. Load myName with the upper case version of itself and display the result.

3. Load myName with the lower case version of itself and display the result.

4. Capitalize the first letter of each given name in the lowercased name and display the result. Load the result into myName. Hint: This is not a single method call. You will need a loop to perform this. Hint: The substring method will be very helpful as you should likely build a new string result. Avoid magic number references. This solution should work with any proper name.

5. Using the value of the variable myName from step 4:

a.Display the Initials of the name. ( This may require a Loop)
b.Use the trim methd on myName and store the results into myName.
c.Display the size of the name
// Using Billy Bob as the name - here are the expected results:

My name in upper case is BILLY BOB.

My name in lower case is billy bob.

My name capitalized is Billy Bob.

My initials are BB.

The length of my name is 9.

In: Computer Science

Im writing a matlab script called vecadd that deals with vectors and is converting them between...

Im writing a matlab script called vecadd that deals with vectors and is converting them between polar and rectangular coordinates. It is supposed to function based upon the following parameters:

vecadd adds two vectors and outputs the resultant vector.

vecadd(A,B) assumes A and B are both in rectangular form. The first element of each vector is the "x" component and the second element is the "y" component. The resultant is output in rectangular form.

vecadd(A,B,'p') assumes A and B are both in polar form. The first element of each vector is the magnitude and the second element is the angle in degrees. The resultant is output in polar form.

vecadd(A,B,'r') is equivalent to vecadd(A,B).

vecadd(A,B,'p','r') assumes A is in polar form and B is in rectangular form.  vecadd(A,B,'r','p') assumes A is in rectangular form and B is in polar form. The resultant is output in rectangular form.

vecadd(A,B,'p','r','p') outputs the resultant in polar form.

vecadd(A,B,'p','r','r') is equivalent to vecadd(A,B,'p','r').

[RES, FORM] = vecadd(A,B,'p','r','p') outputs the resultant and the format of the resultant vector ('polar' if the last input argument is 'p' and 'rectangular' if the last input argument is 'r').

I need some help getting on the right track. Anything will do. Thanks

In: Computer Science

Write a program, using C#, windows forms, that will find the mean and standard deviation of...

Write a program, using C#, windows forms, that will find the mean and standard deviation of a number of data points. The ONE PROGRAM should allow the user to enter data manually OR via a text file. The program should be very easy to use.

I will also need a step by step how to set up window for the answer. Please and thank you!!

In: Computer Science

In this lab, you will be completing a programming exercise through the point of view of...

In this lab, you will be completing a programming exercise through the point of view of both a

contracted library developer and the client that will use the developed code.

In the first part, you will be required to write a class in C++ that will be included in the client’s code.

Your class must be written with defensive programming in mind. It should allow the client to include or

leave out your defensive checks at compile-time.In the second part, you will use your defensively

programmed class methods to guide the revision of the provided user driver program. After

encountering failures from misuse of the library class methods, you will update the driver program,

according to the implementation guidelines in the CWE documentation for the appropriate error.

Note that the code you write does not have to be completely optimized and you will likely see better

ways to write the class and the driver to avoid the problems inherit in the client descriptions.

In Part 1 of the lab you will complete the following:

 Write a class called myArray in a file named “yourlastname_lab2.cpp” where you substitute your

own name

            o Constructor

                       two inputs: int size and string input

                       dynamically create a char* array of int size

                       parse string input (which should be a string of comma-separated characters)

                              and enter the characters in the array in order

           o Destructor should free the memory assigned to your char* array

          o ReadFromArray

                 one input: int index

                 return char at the given index for the array

       o WriteToArray

               two inputs: int index, char replace

               overwrite char at given index with new char replace

    o DeleteArray

                 free the memory for your char*

             set char* to NULL

o PrintArray

                output the contents of the char* array to stdout

o NewArray

               two inputs: int size and string input

              dynamically create a char* array of int size

              parse string input (which should be a string of comma-separated characters)

             and enter the characters in the array in order

               For each class method, provide the contract for proper usage of the method

o enter as comment lines directly after the definition

o List any preconditions (what has to be true immediately before executing the method)o List any postconditions (what has to be true immediately after executing the method)

               Utilize C standard assert() library calls from assert.h to test your preconditions

               Use macros to give the client the option on whether to include the asserts at compile-time

               Use the provided sample client driver program to test your class code

                Take screenshots of your assertions being invoked for each function

In Part 2 of the lab you will complete the following:

• Using the assertions you have placed into your class methods, update the driver code to ensure

calls made to the class methods are in-contract

• Identify what CWE errors, if applicable, are occurring with out-of-contract use of your class

methods

• Review the ‘Potential Mitigation” section for those CWE errors and use the “Phase:

Implementation” entries to guide your revision of the provided program driver.

• Take screenshots of the driver code working without hitting the assertions – be sure to explain

in your word document how you tested the preconditions of each method and what changes

you made to the driver to ensure in-contract calls were made to the methods.

Graduate students should also answer the following:

• Is there a Python equivalent to the C-standard assert() calls used in class with C++?

• How would you approach defensive programming from the point-of-view of python methods?

Submit a zip file to Blackboard which contains your class file and a word document which includes the

screenshots and other information described above.

For full credit your code should compile, run as described, and be appropriately commented. If I need to

know anything in particular about how I should compile your code, include that in your document.

GIVEN cpp code:

============

//Sample client code for interfacing with myArray class
//Use this driver program to test your class and defensive programming assertions

#include <iostream>
#include <string>
#include <stdlib.h>
#include "your_class_here.cpp"   //replace this with your own file

using namespace std;

int main(){
   int size, choice, read, write;
   string input;
   char replace, response;
   char * array;

   cout << "Welcome, please enter a maximum size for your array" << endl;
   cin >> size;

   cout << "Please enter a series of comma-separated characters for your array" << endl;
   cin >> input;

   //create object of class type which should dynamically allocate a char* array
   //of int size and fill it with the comma-separated values from string input

   Array myArray(size, input);

   while(1){

       cout << "Array Menu" << endl;
       cout << "1. Read by index" << endl;
       cout << "2. Write by index" << endl;
       cout << "3. Delete array" << endl;
       cout << "4. Print array" << endl;
       cout << "5. New Array" << endl;
       cout << "6. Exit" << endl;
       cin >> choice;

       switch(choice){
           case 1:
              cout << "Enter an index to read a value from the array" << endl;
              cin >> read;
              //call to library function ReadFromArray(int read)
              //this library call should read a single character from the array and return it
              response = myArray.ReadFromArray(read);
              cout << "The item in index[" << read << "] is " << response << endl;
              break;
           case 2:
              cout << "Enter an index to write a value to the array" << endl;
              cin >> write;
              cout << "What single character would you like to write to the array?" << endl;
              cin >> replace;
              //call to library function WriteToArray(int write, char replace)
              //this library call should write a single character to the array
              myArray.WriteToArray(write,replace);
              cout << "The item in index[" << write << "] is " << myArray.ReadFromArray(write) << endl;
              break;
           case 3:
              //call to library function DeleteArray() which should free the dynamically allocated array
              myArray.DeleteArray();
              break;
           case 4:
              //call to library function PrintArray() which will print the contents of the array to stdout
              myArray.PrintArray();
              break;
           case 5:
              //call to library function NewArray() which will dynamically allocate a new array
              cout << "Welcome, please enter a maximum size for your array" << endl;
              cin >> size;

              cout << "Please enter a series of comma-separated characters for your array" << endl;
              cin >> input;
              myArray.NewArray(size, input);
              break;
           case 6:
              exit(0);
              break;
       }

   }
   return 0;
}

In: Computer Science

Write an application for Lambert’s Vacation Rentals. Use separate ButtonGroups to allow a client to select...

Write an application for Lambert’s Vacation Rentals. Use separate ButtonGroups to allow a client to select one of three locations, the number of bedrooms, and whether meals are included in the rental. Assume that the locations are parkside for $600 per week, poolside for $750 per week, or lakeside for $825 per week. Assume that the rentals have one, two, or three bedrooms and that each bedroom over one adds $75 to the base price. Assume that if meals are added, the price is $200 more per rental. Save the file as JVacationRental.java.

This is also the 3rd time im gonna post it since all the answers im getting has a lot of errors so please help me

In: Computer Science

Using switch statement, write a C program to do the following problems:   [0.5 mark] If the...

  1. Using switch statement, write a C program to do the following problems:   [0.5 mark]
  1. If the user enters 1, the program prints the following structure using while loop:

1
22
333
4444
55555

In: Computer Science

In the Monkey Illusion video, most people who have seen it before look for the gorilla...

In the Monkey Illusion video, most people who have seen it before look for the gorilla but miss other changes such as a play in black leaving and the curtain changing color. https://youtu.be/IGQmdoK_ZfY

What is this phenomena called and explain why it occurs?

List a design implication of this (i.e., what do we have to keep in mind when designing products as a result of this propensity)?

In: Computer Science

Describe, step-by-step, what the Little Man does to execute an UNCODITIONAL BRANCH instruction. If a user...

  1. Describe, step-by-step, what the Little Man does to execute an UNCODITIONAL BRANCH instruction.
  1. If a user wants to enter two numbers, what must the Little Man program do before she enters the second number?  Why?

  1. Write a Little Man program that accepts two numbers as input and outputs the numbers in reverse order.
  1. Even if he runs out of instructions to execute, the Little Man only stops trying to execute instructions under one condition.  What is that condition?  What happens if the Little Man runs out of instructions and that condition is not met?
  1. When a value is copied from one register to another, what happens to the value in the sourceregister?  What happens to the value in the destinationregister?
  1. If the memory register for a particular computer is 32 bits wide, how much memory can this computer support?

In: Computer Science

Can you do this please: the code should be java just give me this and I...

Can you do this please: the code should be java

just give me this and I will finish the rest don't worry about infix or postfix conversion and evaluation.

just I need these two string should give value. and get a new string like this "12+34-/5".

String s = "ab+cd-/e*"

String s1 = "1232451"

I need code giving each character of String s value of strings1 ignoring operators.

example: a = 1, b = 2, c = 32, d = 4, e = 51, then give me new String like "12+324-/51*"

thank you

In: Computer Science

Cloud computing has a litany of necessary requirements. The business case needs to showcase the necessity...

Cloud computing has a litany of necessary requirements. The business case needs to showcase the necessity for moving to the cloud as well as an understanding of the cost benefit analysis. You should showcase a positive outcome for such a move outlining the overall inception and systems lifecycle process. As such, discuss the following questions in order to define what sufficient means and how to interpret a cost benefit analysis:

  • What is required for the business need to be identified and who makes the decision to move forward with a course of action?
  • What is a cost/benefit analysis and how does that factor into the decision to migrate into the cloud?
  • What sort of risks exist and how might those be mitigated?

In: Computer Science

# please answer question asap please Write a program in C to insert new value in...

# please answer question asap please

Write a program in C to insert new value in the array (unsorted list).

Use pointer notation for the array elements

.Test Data:Input the size of array: 4 Input 4 elements in the array in ascending order:

element -0: 2

element -1: 9

element -2: 7

element -3: 12

Input the value to be inserted: 5

Input the Position, where the value to be inserted: 2

Expected Output:The current list of the array:2 9 7 12

After Insert the element the new list is:2 5 9 7 12

In: Computer Science

MINIMUM MAIN.CPP CODE /******************************** * Week 4 lesson:               * *   finding the smallest number * *********************************/...

MINIMUM MAIN.CPP CODE

/********************************
* Week 4 lesson:               *
*   finding the smallest number *
*********************************/

#include <iostream>

using namespace std;

/*
* Returns the smallest element in the range [0, n-1] of array a
*/
int minimum(int a[], int n)
{
   int min = a[0];

   for (int i = 1; i < n; i++)
       if (min > a[i]) min = a[i];

   return min;
}

int main()
{
   int a[10];

   for (int i = 0; i < 10; i++)
   {
       a[i] = rand()%100;
       cout << a[i] << " ";
   }

   cout << endl << "Min = " << minimum(a, 10) << endl;

   return 0;

}

FACTORIAL MAIN.CPP CODE

/************************************************
*   implementing a recursive factorial function *
*************************************************/

#include <iostream>

using namespace std;

/*
* Returns the factorial of n
*/
long factorial(int n)
{
   if (n == 1)
       return 1;
   else
       return n * factorial(n - 1);
}

int main()
{
   int n;

   cout << "Enter a number: ";
   cin >> n;

   if (n > 0)
       cout << n << "!= " << factorial(n) << endl;
   else
       cout << "Input Error!" << endl;   return 0;
}

SORTING ALGORITHMS ARRAYLIST CODE

/********************************************
* Week 4 lesson:                           *
*   ArrayList class with sorting algorithms *
*********************************************/

#include <iostream>
#include "ArrayList.h"

using namespace std;

/*
* Default constructor. Sets length to 0, initializing the list as an empty
* list. Default size of array is 20.
*/
ArrayList::ArrayList()
{
   SIZE = 20;
   list = new int[SIZE];
   length = 0;
}

/*
* Destructor. Deallocates the dynamic array list.
*/
ArrayList::~ArrayList()
{
   delete [] list;
   list = NULL;
}

/*
* Determines whether the list is empty.
*
* Returns true if the list is empty, false otherwise.
*/
bool ArrayList::isEmpty()
{
   return length == 0;
}

/*
* Prints the list elements.
*/
void ArrayList::display()
{
   for (int i=0; i < length; i++)
       cout << list[i] << " ";
   cout << endl;
}

/*
* Adds the element x to the end of the list. List length is increased by 1.
*
* x: element to be added to the list
*/
void ArrayList::add(int x)
{
   if (length == SIZE)
   {
       cout << "Insertion Error: list is full" << endl;
   }
   else
   {
       list[length] = x;
       length++;
   }
}

/*
* Removes the element at the given location from the list. List length is
* decreased by 1.
*
* pos: location of the item to be removed
*/
void ArrayList::removeAt(int pos)
{
   if (pos < 0 || pos >= length)
   {
       cout << "Removal Error: invalid position" << endl;
   }
   else
   {
       for ( int i = pos; i < length - 1; i++ )
           list[i] = list[i+1];
       length--;
   }
}

/*
* Bubble-sorts this ArrayList
*/
void ArrayList::bubbleSort()
{
   for (int i = 0; i < length - 1; i++)
       for (int j = 0; j < length - i - 1; j++)
           if (list[j] > list[j + 1])
           {
               //swap list[j] and list[j+1]
               int temp = list[j];
               list[j] = list[j + 1];
               list[j + 1] = temp;
           }
}

/*
* Quick-sorts this ArrayList.
*/
void ArrayList::quicksort()
{
   quicksort(0, length - 1);
}

/*
* Recursive quicksort algorithm.
*
* begin: initial index of sublist to be quick-sorted.
* end: last index of sublist to be quick-sorted.
*/
void ArrayList::quicksort(int begin, int end)
{
   int temp;
   int pivot = findPivotLocation(begin, end);

   // swap list[pivot] and list[end]
   temp = list[pivot];
   list[pivot] = list[end];
   list[end] = temp;

   pivot = end;

   int i = begin,
       j = end - 1;

   bool iterationCompleted = false;
   while (!iterationCompleted)
   {
       while (list[i] < list[pivot])
           i++;
       while ((j >= 0) && (list[pivot] < list[j]))
           j--;

       if (i < j)
       {
           //swap list[i] and list[j]
           temp = list[i];
           list[i] = list[j];
           list[j] = temp;

           i++;
           j--;
       } else
           iterationCompleted = true;
   }

   //swap list[i] and list[pivot]
   temp = list[i];
   list[i] = list[pivot];
   list[pivot] = temp;

   if (begin < i - 1)
       quicksort(begin, i - 1);
   if (i + 1 < end)
       quicksort(i + 1, end);
}

/*
* Computes the pivot location.
*/
int ArrayList::findPivotLocation(int b, int e)
{
   return (b + e) / 2;
}

SORTING ALGORITHMS ARRAYLIST HEADER

/********************************************
* Week 4 lesson:                           *
*   ArrayList class with sorting algorithms *
*********************************************/

/*
* Class implementing an array based list. Bubblesort and quicksort algorithms
* are implemented also.
*/
class ArrayList
{
public:
   ArrayList ();
   ~ArrayList();
   bool isEmpty();
   void display();
   void add(int);
   void removeAt(int);
   void bubbleSort();
   void quicksort();
private:
   void quicksort(int, int);
   int findPivotLocation(int, int);
   int SIZE;       //size of the array that stores the list items
   int *list;       //array to store the list items
   int length;   //amount of elements in the list
};

SORTING ALGORITHMS MAIN.CPP CODE

/********************************************
* Week 4 lesson:                           *
*   ArrayList class with sorting algorithms *
*********************************************/

#include <iostream>
#include "ArrayList.h"
#include <time.h>

using namespace std;

/*
* Program to test the ArrayList class.
*/
int main()
{
   srand((unsigned)time(0));

   //creating a list of integers
   ArrayList numbersCopy1, numbersCopy2;


    //filling the list with random integers
    for (int i = 0; i<10; i++)
   {
       int number = rand()%100;
       numbersCopy1.add(number);
       numbersCopy2.add(number);
   }

    //printing the list
    cout << "Original list of numbers:" << endl <<"\t";
    numbersCopy1.display();

    //testing bubblesort
    cout << endl << "Bubble-sorted list of numbers:" << endl <<"\t";
    numbersCopy1.bubbleSort();
    numbersCopy1.display();

    //testing quicksort
    cout << endl << "Quick-sorted list of numbers:" << endl <<"\t";
   numbersCopy2.quicksort();
    numbersCopy2.display();

   return 0;
}

QUESTIONS

PART 1

Design and implement an algorithm that, when given a collection of integers in an unsorted array, determines the third smallest number (or third minimum). For example, if the array consists of the values 21, 3, 25, 1, 12, and 6 the algorithm should report the value 6, because it is the third smallest number in the array. Do not sort the array.

To implement your algorithm, write a function thirdSmallest that receives an array as a parameter and returns the third-smallest number. To test your function, write a program that populates an array with random numbers and then calls your function.

PART 2

The following problem is a variation of Exercise C-4.27 in the Exercises section of Chapter 4 in Data Structures and Algorithms in C++ (2nd edition) textbook.

Implement a recursive function for computing the n-th Harmonic number:

Hn=∑i=1n1i/

Here you have some examples of harmonic numbers.

H1 = 1
H2 = 1 + 1/2 = 1.5
H3 = 1 + 1/2 + 1/3 = 1.8333
H4 = 1 + 1/2 + 1/3 + 1/4 = 2.0833

PART 3

In this week's lesson, the algorithms quicksort and bubblesort are described. In Sorting Algorithms (Links to an external site.) you can find the class ArrayList, where these sorting algorithms are implemented. Write a program that times both of them for various list lengths, filling the array lists with random numbers. Use at least 10 different list lengths, and be sure to include both small values and large values for the list lengths (it might be convenient to add a parameterized constructor to the class ArrayList so the size of the list can be set at the moment an ArrayList object is declared).

Create a table to record the times as follows.

List Length Bubblesort Time
(seconds)
Quicksort Time
(seconds)

Regarding the efficiency of both sorting methods, what are your conclusions? In addition to the source code and a screenshot of the execution window, please submit a separate document with the table and your conclusions about the experiment.

Note: To time a section of your source code, you can do this.

#include <chrono>

using namespace std;

int main()
{
    start = chrono::steady_clock::now();
     //add code to time here
    end = chrono::steady_clock::now();
    chrono::duration<double> timeElapsed = chrono::duration_cast<chrono::duration<double>>(end-start);
    cout << "Code duration: "  << timeElapsed.count() << " seconds" << endl;      
}

In: Computer Science

C PROGRAMMIMG I want to check if my 2 input is a number or not all...

C PROGRAMMIMG

I want to check if my 2 input is a number or not

all of the input are first stored in an array if this the right way?

read = sscanf(file, %s%s%s, name, num, last_name);

if(strcmp(num, "0") != 0)

printf("Invalid. Please enter a number.")

In: Computer Science