When the velocity v of an object is very large, the magnitude of the force due to air resistance is proportional to v squared with the force acting in opposition to the motion of the object. A shell of mass 5 kg is shot upward from the ground with an initial velocity of 500 m/sec. If the magnitude of the force due to air resistance is (0.1)v squared, when will the shell reach its maximum height above the ground? What is the maximum height? Assume the acceleration due to gravity to be 9.81 m divided by s squared.
In: Advanced Math
Trace this code:
1)
#include<iostream>
using namespace std;
class Test {
int value;
public:
Test(int v);
};
Test::Test(int v) {
value = v;
}
int main() {
Test t[100];
return 0;
}
===================================================================
2)
#include <iostream>
using namespace std;
int main()
{
int i, j;
for (i = 1; i <= 3; i++)
{
//print * equal to row number
for (j = 1; j <= i; j++)
{
cout << "* ";
}
cout << "\n";
}
system("pause");
return 0;
In: Computer Science
A real estate expert wanted to find the relationship between the sale price of houses and various characteristics of the houses. He collected data on five variables, recorded in the table, for 12 houses that were sold recently. The five variables arePrice: Sale price of a house in thousands of dollars. Lot Size: Size of the lot in acres. Living Area: Living area in square feet. Age: Age of a house in years. Type of house: town house (T) or Villa (V) Price Lot Size Living Area Age Type of house
Price 255 178 263 127 305 164 245 146 287 189 211 123
Lot Size1.4 0.9 1.8 0.7 2.6 1.2 2.1 1.1 2.8 1.6 1.7 0.5
Living area 2500 2250 2900 1800 3200 2400 2700 2050 2850 2600 2300 1700
Age 8 12 5 24 10 18 9 28 13 9 8 11
Type of the house T T T T T T T V V V V V
Find the regression equation for the town house e) Find the regression equation for the Villa f) What is the price of a town house with a lot size of 1.3, living area of 1800, and is 7 years old?
In: Statistics and Probability
Checking Input File for correct line format.
So for my C++ assignment, my professor says we need to validate the Input File, if there are white lines and spaces, in which it will ignore them, separated by a comma, and that all data items are there. This will be used in a program where i will store these into an Array, and display them in First name, Last name, and Number of Votes.
This is a sample of the txt file. My question is, What do i use to be able to take only the names and number and place them into an array. Please explain what each line is doing, even it is not completely obvious. I am a complete beginner.
F=Michael,L=John,V=3342
F=Danny,L=Red,V=2003
F=Hillary,L=Clinton, V=1588
F=Albert,L=Lee,V=5332
F=Steven,L=JohnV=4429
Correct line for the reference: F=John,L=Smith,V=3342
The line errors that your program needs to detect, are as follows:
incorrect token / separator, example in line 5: F=Steven,L=JohnV=4429
(comma missing) – lines with this error need to be ignored
space in token, example in line 3: F=Hillary,X=Clinton, V=1622
lines with this error need to be read, error fixed, data included in your dataset
empty line, example in line 6 – empty lines need to be ignored
In: Computer Science
Java Language
Add a method (deleteGreater ()) to the LinkedList class to delete the node with the higher value data.
Code:
class Node {
int value;
Node nextNode;
Node(int v, Node n)
{
value = v;
nextNode = n;
}
Node (int v)
{
this(v,null);
}
}
class LinkedList
{
Node head; //head = null;
LinkedList()
{
}
int length()
{
Node tempPtr;
int result = 0;
tempPtr = head;
while (tempPtr != null)
{
tempPtr = tempPtr.nextNode;
result = result + 1;
}
return(result);
}
void insertAt(int v, int position)
{
Node newNode = new Node(v,null);
Node tempPtr;
int tempPosition = 0;
if((head == null) || (position ==0))
{
newNode.nextNode = head;
head = newNode;
}
else {
tempPtr = head;
while((tempPtr.nextNode != null)&&(tempPosition < position -1))
{
tempPtr = tempPtr.nextNode;
tempPosition = tempPosition + 1;
}
if (tempPosition == (position - 1))
{
newNode.nextNode = tempPtr.nextNode;
tempPtr.nextNode = newNode;
}
}
}
public String toString()
{
Node tempPtr;
tempPtr = head;
String result = "";
while(tempPtr != null)
{
result = result + "[" + tempPtr.value + "| ]-->";
tempPtr = tempPtr.nextNode;
}
result = result + "null";
return result;
}
}
public class LinkedListDemoInsDel
{
public static void main(String[] args)
{
LinkedList aLinkedList = new LinkedList();
aLinkedList.insertAt(1,0);
aLinkedList.insertAt(9,1);
aLinkedList.insertAt(13,2);
aLinkedList.insertAt(8,1);
aLinkedList.insertAt(3,2);
System.out.println(aLinkedList);
System.out.println("Largo de lista: " + aLinkedList.length());
}
}
In: Computer Science
Complete the program used on the instructions given in the comments:
C++ lang
#include <string>
#include <vector>
#include <iostream>
#include <fstream>
using namespace std;
vector<float>GetTheVector();
void main()
{
vector<int> V;
V = GetTheVector(); //reads some lost numbers from the file “data.txt" and places it in //the Vector V
Vector<int>W = getAverageOfEveryTwo(V);
int printTheNumberOfValues(W) //This should print the number of divisible values by 7 //but not divisible by 3.
PrintIntoFile(W); //This prints the values of vector W into an output file “output.txt”
}
As you see in the main program, there are four functions. The first function is called “GetVector()” that reads a set of integer, place them into the vector V, and returns the vector to the main program.
The second function is called “GetAverageOfEveryTwoNumber() that takes a vector “V” and finds the average of every two consecutive numbers, place the values into another vector called “W” and returns it to the main program. For example if the Vector is:
10 20 30 40 50 60 70 80 90 100
Then vector “W” should be:
15 25 35 45 55 65 75 85 95
Because (10+20) divided by 2 is 15, and so on.
The next function takes the vector “W” and count how many of the values are divisible by “7” but not divisible by “3”
Finally the last function prints the vector “W” into an output file called “output.txt”
In: Computer Science
In: Statistics and Probability
A study is conducted to look at the time students exercise in average. In a random sample of 115 students, a researcher finds that the mean time students exercise is 11.3hrs/month with a standard deviation of 6.43hrs/month. Using the Critical Value Methodand a 5% significance level, can a researcher conclude that in average students exercise less than 15 hours per month?
In: Statistics and Probability
In: Statistics and Probability
A small university knows the average amount that its students spend on lunch each day. The amount spent on lunches for the population of 500 students is not highly skewed and has a mean of $8 and a standard deviation of $2. Suppose simple random sample of 49 students is taken, what is the probability that the sample mean for the sample of 49 students will be between $7.50 and $8.50?
In: Statistics and Probability