Questions
In this lab, you will write a function that takes five (5) doubles as input and...

In this lab, you will write a function that takes five (5) doubles as input and passes back the mean (average) and the standard deviation. Your function should be named mean_std and it should return the mean (a double) and pass the standard deviation (also a double) back by reference.

The mean and standard deviation are a common calculation in statistics to express the range of "typical" values in a data set. This brief article explains how to calculate the standard deviation: http://www.mathsisfun.com/data/standard-deviation.html (Just the first part, up to where it says "But ... there is a small change with Sample Data".

Use the pow and sqrt functions from the cmath library in your function.

Passing in five separate numbers in five variables is annoying, but we haven't talked yet about passing around sets of numbers. That'll come in the next module.

Pay attention! You are passing back the two calculated values not printing them to the screen! There is no user input/output in this problem! Use what is given.

#include <iostream>
// including cmath to get access to pow and sqrt
#include <cmath>
using namespace std;

// put your function here, and name it mean_std


// main will be called when you are in "Develop" mode, so that you can put testing code here
// when you submit, unit tests will be run on your function, and main will be ignored
int main() {
   return 0;
}

In: Computer Science

Program 3: Give a baby $5,000! Did you know that, over the last century, the stock...

Program 3: Give a baby $5,000! Did you know that, over the last century, the stock market has returned an average of 10%? You may not care, but you’d better pay attention to this one. If you were to give a newborn baby $5000, put that money in the stock market and NOT add any additional money per year, that money would grow to over $2.9 million by the time that baby is ready for retirement (67 years)! Don’t believe us? Check out the compound interest calculator from MoneyChimp and plug in the numbers!

To keep things simple, we’ll calculate interest in a simple way. You take the original amount (called the principle) and add back in a percentage rate of growth (called the interest rate) at the end of the year. For example, if we had $1,000 as our principle and had a 10% rate of growth, the next year we would have $1,100. The year after that, we would have $1,210 (or $1,100 plus 10% of $1,100). However, we usually add in additional money each year which, for simplicity, is included before calculating the interest.

Your task is to design (pseudocode) and implement (source) for a program that 1) reads in the principle, additional annual money, years to grow, and interest rate from the user, and 2) print out how much money they have each year. Task 3: think about when you earn the most money!

Lesson learned: whether it’s your code or your money, save early and save often…

Sample run 1:

Enter the principle: 2000

Enter the annual addition: 300

Enter the number of years to grow: 10

Enter the interest rate as a percentage: 10

Year 0: $2000

Year 1: $2530

Year 2: $3113

Year 3: $3754.3

Year 4: $4459.73

Year 5: $5235.7

Year 6: $6089.27

Year 7: $7028.2

Year 8: $8061.02

Year 9: $9197.12

Year 10: $10446.8

Sample run 2 (yeah, that’s $9.4MM):

Enter the principle: 5000

Enter the annual addition: 1000

Enter the number of years to grow: 67

Enter the interest rate as a percentage: 10

Year 0: $5000

Year 1: $6600

Year 2: $8360

Year 3: $10296

Year 4: $12425.6

Year 5: $14768.2

.

.

Year 59: $4.41782e+06

Year 60: $4.86071e+06

Year 61: $5.34788e+06

Year 62: $5.88376e+06

Year 63: $6.47324e+06

Year 64: $7.12167e+06

Year 65: $7.83493e+06

Year 66: $8.61952e+06

Year 67: $9.48258e+06

please in pseudocode and c++. thank you! sorry about that.

In: Computer Science

Background Information: Global Treps: Many people are familiar with the television show called Shark Tank where...



Background Information:
Global Treps: Many people are familiar with the television show called Shark Tank where entrepreneurs (sometimes called “treps”) present their business ideas to a group of investors or sharks. Several colleges, high schools, and even elementary schools throughout the world hold unique versions of a shark tank like event. You believe that creating a non-profit organization with one central mobile-friendly website/application to assist groups in organizing these types of events would spark even more entrepreneurs throughout the world. You would plan to hold several shark tank like events during the term of the project and create a site and applications to help continue developing more global treps. This site/application would include the following capabilities:
Provide guidelines and templates for running a shark tank type of event
Accept donations from potential investors targeted toward specific schools or organizations wishing to host an event (similar to the popular DonorsChoose.org site where people can fund teacher’s requests)
Accept ideas for needed new products or services
Provide the ability for organizations to create their own custom site to solicit local participants and sharks, accept applications, and promote the winners as well as losers
Research ideas for a mechanism where a certain percentage of all donations and profits earned by contestants are donated back to the Global Treps organization
Provide an online version of the events by showing videos of contestants and live reactions of the sharks while also getting live inputs and donations from viewers
Change the Laws Campaign: Launch a global campaign to change laws to reduce further income inequality and promote social responsibility. This project would also involve creating a mobile-friendly website/application that would include information about current and proposed laws, allow discussions of potential ideas to change laws, organize people to contact appropriate lawmakers, etc.
Wealthy Unite: Develop a system to enable the richest people in the world to provide their input on how they can make the world a better place. Provide information on what several people are currently doing (i.e., Bill Gates, Warren Buffet, famous celebrities, etc.) to promote philanthropy. Allow others to donate to suggested causes and recommend other ways to reduce economic inequality.
Global Smart Shoppers: Develop a mobile app and website that recommends products and services produced by organizations that promote social responsibility. Customize the app so it works in any country in the user’s desired language. Work with large companies that do not currently sell products or services in certain countries to expand to regions in need. Allow small companies to easily add their products and services to the shopping network.

Questions
1. Summarize each of the proposed projects in the Running Case section using a simple table format suitable for presentation to top management. Include the name of each project, identify how each one supports business strategies, assess the potential financial benefits and other benefits of each project, and provide your initial assessment of the value of each project. Write your results in a one- to two-page memo to top management, including appropriate back-up information and calculations.

In: Computer Science

C programming - Implement a dynamic array, please read and implement the dynarray.c file with what...

C programming - Implement a dynamic array, please read and implement the dynarray.c file with what is given

dynarray.h

/*
* This file contains the definition of the interface for the dynamic array
* you'll implement. You can find descriptions of the dynamic array functions,
* including their parameters and their return values, in dynarray.c. You
* should not modify anything in this file.
*/

#ifndef __DYNARRAY_H
#define __DYNARRAY_H

/*
* Structure used to represent a dynamic array.
*/
struct dynarray;

/*
* Dynamic array interface function prototypes. Refer to dynarray.c for
* documentation about each of these functions.
*/
struct dynarray* dynarray_create();
void dynarray_free(struct dynarray* da);
int dynarray_size(struct dynarray* da);
void dynarray_insert(struct dynarray* da, void* val);
void dynarray_remove(struct dynarray* da, int idx);
void* dynarray_get(struct dynarray* da, int idx);
void dynarray_set(struct dynarray* da, int idx, void* val);

#endif

dynarray.c

#include

#include "dynarray.h"

/*
* This is the definition of the dynamic array structure you'll use for your
* implementation. Importantly, your dynamic array implementation will store
* each data element as a void* value. This will permit data of any type to
* be stored in your array. Because each individual element will be stored in
* your array as type void*, the data array needs to be an array of void*.
* Hence it is of type void**.
*
* You should not modify this structure.
*/
struct dynarray {
void** data;
int size;
int capacity;
};

/*
* This function should allocate and initialize a new, empty dynamic array and
* return a pointer to it. The array you allocate should have an initial
* capacity of 2.
*/
struct dynarray* dynarray_create() {
return NULL;
}

/*
* This function should free the memory associated with a dynamic array. In
* particular, while this function should up all memory used in the array
* itself (i.e. the underlying `data` array), it should not free any memory
* allocated to the pointer values stored in the array. In other words, this
* function does not need to *traverse* the array and free the individual
* elements. This is the responsibility of the caller.
*
* Params:
* da - the dynamic array to be destroyed. May not be NULL.
*/
void dynarray_free(struct dynarray* da) {
return;
}

/*
* This function should return the size of a given dynamic array (i.e. the
* number of elements stored in it, not the capacity).
*/
int dynarray_size(struct dynarray* da) {
return 0;
}

/*
* This function should insert a new value to a given dynamic array. For
* simplicity, this function should only insert elements at the *end* of the
* array. In other words, it should always insert the new element immediately
* after the current last element of the array. If there is not enough space
* in the dynamic array to store the element being inserted, this function
* should double the size of the array.
*
* Params:
* da - the dynamic array into which to insert an element. May not be NULL.
* val - the value to be inserted. Note that this parameter has type void*,
* which means that a pointer of any type can be passed.
*/
void dynarray_insert(struct dynarray* da, void* val) {
return;
}

/*
* This function should remove an element at a specified index from a dynamic
* array. All existing elements following the specified index should be moved
* forward to fill in the gap left by the removed element. In other words, if
* the element at index i is removed, then the element at index i+1 should be
* moved forward to index i, the element at index i+2 should be moved forward
* to index i+1, the element at index i+3 should be moved forward to index i+2,
* and so forth.
*
* Params:
* da - the dynamic array from which to remove an element. May not be NULL.
* idx - the index of the element to be removed. The value of `idx` must be
* between 0 (inclusive) and n (exclusive), where n is the number of
* elements stored in the array.
*/
void dynarray_remove(struct dynarray* da, int idx) {
return;
}

/*
* This function should return the value of an existing element a dynamic
* array. Note that this value should be returned as type void*.
*
* Params:
* da - the dynamic array from which to get a value. May not be NULL.
* idx - the index of the element whose value should be returned. The value
* of `idx` must be between 0 (inclusive) and n (exclusive), where n is the
* number of elements stored in the array.
*/
void* dynarray_get(struct dynarray* da, int idx) {
return NULL;
}

/*
* This function should update (i.e. overwrite) the value of an existing
* element in a dynamic array.
*
* Params:
* da - the dynamic array in which to set a value. May not be NULL.
* idx - the index of the element whose value should be updated. The value
* of `idx` must be between 0 (inclusive) and n (exclusive), where n is the
* number of elements stored in the array.
* val - the new value to be set. Note that this parameter has type void*,
* which means that a pointer of any type can be passed.
*/
void dynarray_set(struct dynarray* da, int idx, void* val) {
return;
}

In: Computer Science

2) You've been hired by Superfluous Stats to write a C++ console application that analyzes a...

2) You've been hired by Superfluous Stats to write a C++ console application that analyzes a string. Prompt for and read from the user a string that may contain spaces. Then prompt for and read from the user a single character. Print the following stats about the string and character inputs. Use formatted output manipulators (setw, left/right) to print the following rows about the string:

          ● The string value.

          ● The string length.

          ● The spot, if any, where the character is found within the string.

And the following rows about the character:

          ● The character value.

          ● Whether the character is an alphabetic character.

          ● Whether the character is a numeric character.

          ● Whether the character is a punctuation character.

And columns:

          ● A left-justified label.

          ● A right-justified value.

Define constants for the column widths. The output should look like this:

Welcome to Superfluous Stats

----------------------------

Enter a string: Detroit Michigan

Enter a character: r

String s

Value:                  Detroit Michigan

Length:                               16

Index:                                 3

Character c

Value:                                 r

Is alpha?                              2

Is digit?                              0

Is punctuation?                        0

End of Superfluous Stats

Note that you may get a value for true that is not 1. Do not use this sample input for the final run that is pasted below.

In: Computer Science

For the following function, what are the best types for the parameters (can be used for...

For the following function, what are the best types for the parameters (can be used for all parameters)? (best = will not cause errors, will compute what is intended.)

For example, if you select "string" that means that a call with 3 string values—add_and_mult("Hi", "bye", "llama") is a great choice.

def add_and_mult(num1, num2, num3):
    sub_val1 = num1 * 60
    sub_val2 = (sub_val1 + num2) * 60
    answer = sub_val2 + num3
    print("Wow! that's " + str(answer))

A. int

B. float

C. string

D. boolean

In: Computer Science

can you please look at the following code and fix it for me so that it...

can you please look at the following code and fix it for me so that it does not have any syntax errors. also can you tell me what was fixed

/**
* Driver program to demonstrate calling methods of Client class.
*
* @author Doyt Perry/Tina Comston
* @version Fall 2019
*/
public class ClientDemo
{
public static void main()
{
/**
* main method - makes this an executable program.
*/
// create a client with placeholder values
System.out.println("Client with default information");
// Create a client object using first constructor
Client client1 = new Client();
  
// Display information about the client
System.out.println(client1.toString());
  
System.out.println();
System.out.println("Create a client by providing information");
// client last name - Jameson
// client first name - Rebecca
// client age - 32
// client height - 65
// client weight - 130
Client client2 = new Client("Jameson", "Rebecca",
32, 65, 130);
  
// Display information about the client
System.out.println(client2.toString());

// Display the first name
System.out.println("original first name = " +
client2.getfirstname());
  
// set the first name to the value Rachel
client2.setFirstName("Rachel");
  
// Retrieve and dislplay the client first name
System.out.println("new first name = " +
client2.getFirstName());
  
// Display information about the client
System.out.println(client2.toString());

// set their weight to 180
client2.setWeight(180);
  
// Display information about the client
System.out.println(client2.toString());
}
}

In: Computer Science

2) Show how each of the following signed, decimal integers would be stored in 16-bit two's...

2) Show how each of the following signed, decimal integers would be stored in 16-bit two's complement format. Give your answer in hexadecimal.

a) -21 (5 points)

b) 4096 (5 points)

In: Computer Science

* what are some negative consequences of IT security? * what are the 4 ways to...

* what are some negative consequences of IT security?

* what are the 4 ways to respond to risk give example? *

give example of information that an employee should not reveal?

In: Computer Science

You are asked to design a database to support a Instant Recruitment System of casual staff...

You are asked to design a database to support a Instant Recruitment System of casual staff for a school. The major business requirements are summarised below in the Mini Case: An Instant Recruitment System. You are asked to develop a detailed Entity-Relationship model for this mini case. Your ER model should consist of a detailed ER diagram integrated with itemised discussions on the features of the entities and relationships and all the assumptions you made where applicable. The ER diagram and the accompanying document should identify keys, constraints, entity types, relationship types, specialisation/generalisation if any, etc. You must use the same notation scheme for the ER diagram as the textbook (use UML notations as shown in the last page of the textbook, and don't use Crew Foot notations), and the ER diagram should be strictly in the way the textbook uses for.

  1. The ER diagram should include, among others, representative attributes for all entity types, proper subclassing if any, and correct participation multiplicities for the relationship types. It should be meaningfully and well designed, and should also include all relevant and necessary aspects, and indicate any supplementary business rules if you decide to introduce.
  2. Map the above ER diagram into a global relation diagram (GRD) All the attributes should be kept there too. Include in the diagram all the primary keys, foreign keys, and the multiplicity constraints. (
  3. Please note that an ERD is the artefact of the conceptual database design phase, while a GRD is the artfact of the logical database design phase which relates to the relational models. As such, a good ERD should be conceptually more concise and the relationships there should in general remain so rather than becoming extra entities as in a relational model.

In: Computer Science

write a python script to calculate the return of a stock with 10years of historical data/returns

write a python script to calculate the return of a stock with 10years of historical data/returns

In: Computer Science

Please solve all parts of the following question on MATLAB. 1. Penn State football travels to...

Please solve all parts of the following question on MATLAB.

1. Penn State football travels to Ohio State to play the Buckeyes on Nov 23, 2019. The official capacity of Ohio Stadium is 104,944. Let’s say that the stadium is filled at the beginning of the game, but every time Penn State scores a touchdown half of the fans leave. How many touchdowns does Penn State have to score until there is just one fan left in the stadium?

a. construct a two-column matrix in which one column is number of touchdowns and the other column is number of people in the stadium.

b. plot touchdown number vs. number of fans on linear axes. The satisfactory plot will include: a title, and labeled axes. Since you are plotting discrete data points, please plot them with a symbol and connect the symbols with a line. All fonts should be large enough to be legible. You may choose the aspect ratio of your plot and what kind of symbol and line style to use.

c. redo the plot, but this time with a logarithmic y axis.

In: Computer Science

Describe the difference between classification, clustering, and association rules. Be specific and provide details.

Describe the difference between classification, clustering, and association rules. Be specific and provide details.

In: Computer Science

Python Problem Problem 1: In this problem you are asked to write a Python program to...

Python Problem

Problem 1:

In this problem you are asked to write a Python program to find the greatest and smallest elements in the list.

The user gives the size of the list and its elements (positive and negative integers) as the input.

Sample Output:

Enter size of the list: 7

Enter element: 2

Enter element: 3

Enter element: 4

Enter element: 6

Enter element: 8

Enter element: 10

Enter element: 12

Greatest element in the list is: 12

Smallest element in the list is: 2

Hit enter to end program

------------------------------------------------------------------------------------------

Problem 2:

In this problem you are asked to write a Python program you are asked to perform multiple operations on a list.

What you need to do:

  1. Ask the user what is the length of the list.

  2. Ask the user to enter string values into a list.

  3. Print the first 4 and last 4 elements in the list.

  4. Ask the user if he/ she wants to insert elements to the list or delete the elements from the list.

  5. Repeat step 4 until the user chooses a ‘NO’.

Sample Output:

Enter size of list: 5
Enter a string value: john Enter a string value: mary

Enter a string value: steve

Enter a string value: julia

Enter a string value: jake

The elements in the list:
['john', 'mary', 'steve', 'julia', 'jake']

The first four elements in the list: ['john', 'mary', 'steve', 'julia']

The last four elements in the list: ['mary', 'steve', 'julia', 'jake']

Want to insert (i) or delete (d) elements in the list: i Enter the position to insert: 5
Enter the value to insert: lara

The modified list:
['john', 'mary', 'steve', 'julia', 'jake', 'lara']

Want to insert or delete more elements (y/n): y

Want to insert (i) or delete (d) elements in the list: i Enter the position to insert: 2
Enter the value to insert: Jacob

The modified list:
['john', 'mary', 'jacob', 'steve', 'julia', 'jake', 'lara']

Want to insert or delete more elements (y/n): y

Want to insert (i) or delete (d) elements in the list: d Enter the index of the value to be deleted: 4

The modified list:
['john', 'mary', 'jacob', 'steve', 'jake', 'lara']

Want to insert or delete more elements (y/n): n

Hit enter to end program

In: Computer Science

# print out the steps to make chex mix, taking into account whether or not to...

# print out the steps to make chex mix, taking into account whether or not to include peanuts

# Here is the pseudo code we developed earlier:
#
#Get Bowl
#Add wheat Chex
#Add cheez-its
#Add Pretzels
#Add m & ms (why? – just taking it from the video…)

#If no peanut allergy
# Add peanuts
#else (there was a peanut allergy)
# if we have another bowl
# get second bowl
# put some of the mix so far into the second bowl
# add peanuts to second bowl
# else (at this point there was a peanut allergy, but no second bowl)
# don’t do anything. We’re done.

# Here is the start of the Python code

print("Get Bowl")
print("Add wheat chex to bowl")
print("Add cheez-its to bowl")
print("Add pretzels to bowl")
print("Add m & ms to bowl")

# Note that the string in the following prompt has embedded single quotes inside double quotes
peanut_allergy = input("Is there a peanut allergy? (enter 'yes' or 'no')")

# finish the code

# when it's time to ask for the second bowl, use this as the prompt:
# "Is there a second bowl? (enter 'yes' or 'no')"

In: Computer Science