Write a program that calculates mean and standard deviation for four user entered values. The most common measures of a sample are the mean and the standard deviation. the mean is the sum of the values divided by the number of elements in the data set. The dispersion - or spread in the values - is measured by the standard deviation The equation for the mean is x¯ = x1 + x2 + · · · + xn The equation for the standard deviation is sx = √ (x1 − x¯) 2 + (x2 − x¯) 2 + · · · + (xn − x¯) 2 n − 1 Your program will have the user enter four values (all doubles), You might call them x1, x2,x3,and x4. The program will then pass these four values to a function called mean that will calculate and return the mean of the four values. The mean and the four values will then be passed to a second function called stdev which will calculate and return the standard deviation of the four values. You program should be using functions. There will be a function printHeader that prints the splash screen, a function mean that calculates the mean, a function stdev that calculates the standard deviation, and a function printResults that prints the four values, their mean, and their standard deviation Your program must also include comments with your name, the date, and a short description of the project. It must also print this information as a splash screen at the beginning of the program run. It should print like:
X: 4.00, 7.00, 1.00, 10.00
Mean: 5.50
Std Dev: 3.87
This needs to be done in C++. This is what I have so far.
// Pound includes - will need the string and cmath
libraries
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
using namespace std;
// Function Prototypes - Need to add three more. One
for mean, one for standard deviation, and one for the
printResults
void printHeader(string, string);
double mean(double, double, double, double);
double stdev(double, double, double, double, double);
int main(void) {
// Splash Screen
printHeader("20 October 2020", "Calculating
Statistics");
// Declare and Initialize all of the
variables. Will need doubles for the four data points, as well as a
double for the mean // and one for the standard deviation
double x1, x2, x3, x4;
double mean;
double std;
// Prompt for entering data - you must
enter four values
cout << "Enter the first value: ";
cin >> x1;
cout << "Enter the second value: ";
cin >> x2;
cout << "Enter the third value: ";
cin >> x3;
cout << "Enter the fourth value: ";
cin >> x4;
// Pass the four data variables to a function that
returns the mean
double m = mean (x1,x2,x3,x4);
// Pass the four data variables and the
mean to a function that returns the standard deviation
double std = stdev(m, x1, x2, x3, x4);
// Print the results
// Include the original values and the
mean and the standard
// DO NOT PRINT IT HERE - pass the variables to a printResults
function
return 0;
}
void printResults(double m, double s, double x1, double x2, double
x3, double x4){
cout << setprecision(2) << fixed <<
showpoint;
cout << "Values: " << setw (10) <<
x1 << ", " << x2 << ", " << x3 << ",
" << x4 << endl;
cout << "Mean: " << setw (10) << m
<< endl;
cout << "Standard Deviation: " << setw(10)
<< s << endl;
}
// Name:
// Date: 20 October 2020
// Function Definitions
void printHeader(string dueDate, string description) {
// Print the splash screen
cout << endl;
cout << "Name" << endl;
cout << "Class" << endl;
cout << dueDate << endl;
cout << description << endl;
cout << endl;
return;
}
// Function definition for mean
double mean (double x1, double x2, double x3, double x4) {
return (x1 + x2 + x3 + x4) / 4;
}
// Function definition for standard deviation
double stdev(double m, double x1, double x2, double x3, double
x4){
std = (m-x1)*(m-x1);
std + = (m-x2)*(m-x2);
std + = (m-x3)*(m-x3);
std + = (m-x4)*(m-x4);
std = std/3;
std = sqrt(std);
return std;
}
In: Computer Science
Write a recursive method that takes a String argument and recursively prints out each word in the String on a different line.
Note: You will need to use methods such as indexOf() and substring() within the String class to identify each word and the remaining string.
For example, if the input was “the cat purred”, then the method would print the following to the Java console:
the
cat
purred
Challenge Problem
Write a recursive method that takes a string as an input and returns a boolean value that tells you whether the string is a palindrome. A palindrome is a word/sentence that when read backwards is the same as the original word/sentence.
Some example palindromes: “civic”, “radar”, “deleveled”, “a man, a plan, a canal: Panama” (ignore the punctuation)
PreviousNext
In: Computer Science
When does the operating system assign/allocate resources (i.e. memory) to a process?
a) When the process starts
b) While the process is running
c) When the process is terminated
d) Both a and b
e) a, b and c
Also please give resources so I can look into more in-depth
In: Computer Science
Write a checkbook balancing program. The program will read in,
from the console, the following for all checks that were not cashed
as of the last time you balanced your checkbook: the number of each
check (int), the amount of the check (double), and whether or not
it has been cashed (1 or 0, boolean in the array). Use an array
with the class as the type. The class should be a class for a
check. There should be three member variables to record the check
number, the check amount, and whether or not the check was cashed.
So, you will have a class used within a class. The class for a
check should have accessor and mutator functions as
well as constructors and functions for both input and output of a
check. In addition to the checks, the program also reads all the
deposits (from the console; cin), the old and the new account
balance (read this in from the user at the console; cin). You may
want another array to hold the deposits. The new account balance
should be the old balance plus all deposits, minus all checks that
have been cashed.
The program outputs the total of the checks cashed, the total of the deposits, what the new balance should be, and how much this figure differs from what the bank says the new balance is. It also outputs two lists of checks: the checks cashed since the last time you balanced your checkbook and the checks still not cashed. [ edit: if you can, Display both lists of checks in sorted order from lowest to highest check number.]
In: Computer Science
The first assignment involves writing a Python program to
compute the weekly pay for a salesman. Your program should prompt
the user for the number of hours worked for that week and the
weekly sales. Your program should compute the total pay as the sum
of the pay based on the number of hours worked times the hourly
rate plus the commission. You should choose a value for the hourly
pay. The commission should be computed as a percentage of the
weekly sales. You should choose a value for the percentage. Your
program should output the pay based on the hours worked, the
commission and the total pay for the week.
Your program should include the pseudocode, used to come up with
the program statements, in the comments. Document the values you
chose for the hourly rate and commission percentage in your
comments as well.
You are to submit your Python program as a text file (.txt) file.
In addition, you are also to submit a test report in a Word
document or a .pdf file. 15% of your grade will be based on whether
the comments in your program include the pseudocode and define the
values of your constants, 70% on whether your program executes
correctly on all test cases and 15% on the completeness of your
test report.
In: Computer Science
Your firm maintains a citation index of biomedical journal articles used by a variety of medical research institutes and pharmaceutical firms. Each article is identified by a unique "DOI number"; in addition to this number, you want the database to store each article's title, abstract, date of publication, journal volume number, journal issue number, and journal pages. Each article is authored by one or more researchers. For each researcher, your database should store a family name, given name, date of birth, and current employer. The database should remember which researchers authored each article, and the order they appear in the article writing credits.
Each article appears in a single journal, and each journal is identified by a unique "ISSN" number. The database should be able to identify which journal each article appeared in. Furthermore, for each journal, the database should remember its name and the name of the organization that publishes it. Sometimes journals change names, and one journal "continues' another journal. For example, the ORSA Journal on Biomedical Computation might become the INFORMS Journal on Biomedical Computation when its publishing organization merges with another organization. The name change makes it a different journal but the database should be able to remember which journal (if any) "continues" any given journal.
Finally, articles usually contain multiple citations to other articles. For example, an article about clinical treatment of a particular disease might contain citations to dozens of prior research articles about that disease. This information can be very useful to researcher, so the database should be able to store the full pattern of citations between articles. Note that an article not only usually cites many other articles but may also be cited by many other articles.
In: Computer Science
Why is VLR regarded as a distributed HLR? What particulars about mobile will you like to keep in the VLR data base?
In: Computer Science
In C# using a Console App, create an array that stores 20 integer values. Use the random number generator to select an integer value between 0 and 10. Store the 20 random integers in the array.
Once the array has been created:
In: Computer Science
Variable Length Subnet Mask (VLSM) and basic IP Address Design
Question 1: [40 Marks]
[15]
addresses. Use a suitable table from the VLSM lecture series. [10]
Note: You may design your topology as you find suitable; however, endeavor to keep the number of routers to a maximum of 5.
In: Computer Science
This is from Microsoft Visual C#: An Introduction to Object Oriented Programming by Joyce Farrell (7th Edition)
The provided file has syntax and/or logical errors. Determine the problem(s) and fix the program.
/*
The program requires the user to guess the number of days it takes to make X amount of money when doubling the value every day.
The starting value is $0.01.
The program indicates if the guess is too high, or too low.
*/
using System;
using static System.Console;
using System.Globalization;
class DebugFive4
{
static void Main()
{
const double LIMIT = 1000000.00;
const double START = 0.01;
string inputString;
double total;
int howMany;
int count;
Write("How many days do you think ");
WriteLine("it will take you to reach");
Write("{0 starting with {{1}",
LIMIT.ToString(C), START.ToString("C", CultureInfo.GetCultureInfo("en-US"));
WriteLine("and doubling it every day?");
inputString = ReadLine();
howMany = Convert.ToInt32(inputString);
count = 0;
total = START;
while(total == LIMIT)
{
total = total * 2;
count = count + 1;
}
if(howMany >= count)
WriteLine("Your guess was too high.");
else
if(howMany =< count)
WriteLine("Your guess was too low.");
else
WriteLine("Your guess was correct.");
WriteLine("It takes 0 days to reach {1}",
count, LIMIT.ToString("C", CultureInfo.GetCultureInfo("en-US")));
WriteLine("when you double {0} every day",
START.ToString("C", CultureInfo.GetCultureInfo("en-US")));
}
}
In: Computer Science
Given the following code segment, tell the output if it is part of an executable program. Assume the addresses of the variables, a and b, are 0012A32A and 0012A340, respectively.
int* intPtr1, *intPtr2;
int a = 10, b;
intPtr1 = &a;
cout<< "The data in a is "<<a<<endl;
cout << "The address of a is "<<&a<<endl;
cout <<"The data in intPtr1 is "<< intPtr1 <<endl;
cout <<"The data in the variable pointed by intPtr1 is "<< * intPtr1<<endl;
a++;
cout << "After changing a: "<<endl;
cout <<"The data in the variable pointed by intPtr1 is "<< * intPtr1<<endl;
b = *intPtr1;
cout << "The value in b is "<<b<<endl;
a++;
cout << "After changing a: "<<endl;
cout <<"The data in the variable pointed by intPtr1 is "<< * intPtr1<<endl;
cout << "The value in b is "<<b<<endl;
Output:
Please Use C++
In: Computer Science
For this project, you are to modify the Employee class posted on Blackboard by adding a bonus field. The bonus field should be equal to zero when an Employee object is created. You need to add a setter and a getter method to the new bonus field.
The Dirany’s company saves all employee information in the dirany.txt file (attached). The file saves each employee’s information in a new line and all attributes are separated by tabs. For example, the first employee’s information on the first line in the dirany.txt file is as follows:
John Smith 90000
John is the first name of the employee, Smith is the employee’s last name and 90000 is the employee’s annual salary.
Your program should read the dirany.txt file and create an Employee object for each employee in the file, then add the employees to a queue data structure in the same order you read them from the file. The Dirany’s company saves the employees records according to their longevity in the company.
You need to help the Dirany’s company, to calculate the bonus for each employee according to their longevity rule so the bonus of the first employee will be 20% of his/her salary and for each employee afterwards the percent of the bonus will be 1%less so the second employee will get 19% of his/her salary, the third employee will get 18% of his/her salary and so forth.
Your program should access the Employees’ objects in the queue, calculate the bonus field and set it for each Employee object and display the object status: first name, last name, pay and bonus for each employee.
Also your program should calculate and display the number of the employees in the company and the total bonus that the company will pay for all its employees.
Make sure you break up your code into a set of well-defined functions. Each function should include a comment block that briefly describes it, its parameters and any return values.
John Smith 90000 Mathew Marshal 89000 Nicole Lopaz 88200 Adam Benjamin 83400 Julia Hart 82000 Mary Loveland 79000 Varon Bansel 73400 Ali Hassan 63000 Joseph Murty 52000 Ryan Frankel 43400 Julianne Johnson 38600 Noah Expo 22000 Deven Williams 19300 Richard Peal 15200 Lee Wang 14300
in python
In: Computer Science
Please provide steps in order to obtain an ABSOLUTE url to a google image. This ABSOLUTE url should work in an HTML code
In: Computer Science
IT professionals work with many non-IT business partners whose understanding and support are critical to ensuring that IT strategies are implemented and goals are attained.
Imagine you are working with a non-IT partner who does not understand the differences between an analytics database and a data warehouse; nor does your partner understand the effect that the differences have on how you approach data analytics.
Respond to the following in a minimum of 150 words (worth 20 points):
In: Computer Science
How do you find the key that has the most vlaues in it in a dict() useing python?
Example:
{'Zombies Take the Schoolyard': ['Beavers, Kim', 'Frank, Jordan', 'Goodman, Branden', 'Rivera, David', 'Stettler, Sarah'], 'Zompyres: Texas': ['Beck, Stefan', 'Bourland, Cory', 'Burnett, Chase', 'Dumas, Laura', 'Funderburk, Katie'], "2012 Dick's Oddity": ['Attix, Cathy', 'Belville, Bonnie', 'Graciela, Maritza', 'Jakus, Julia', 'Swarts, Nick'], 'CC 2010': ['Coulston, Sabrina'], 'December 21, 2012': ['Faust, Ricky', 'Keep, Tracey', 'Kehayas, Heather', 'Kimball, Elizabeth', 'Walkow, Brett'], 'Venjaxor: 2012!': ['Hueffmeier, Keith', 'Parmentier, Bill', 'Severson, Robert', 'Stroup, Kevin', 'Warner, Ron'], 'Steel of Fire Warriors 2010 A.D.': ['Clarke, Kevin', 'Furback, Jaqi', 'Sheen, Derek', 'Straw, Owen', 'Vogt, Travis']}
With these movies how do I find the the one that had the most actors in it.
Thanks for the help.
In: Computer Science