Question

in c++ : i need three test cases, that test both mass & velocity. Already have...

in c++ :

i need three test cases, that test both mass & velocity. Already have written code.

mass

velocity

Expected Kinetic Energy

10

9

405

20

5

250

30

7

735

This is what I have, however I'm not sure how to properly write it so its testing both.

TEST_CASE("Verify Test Configuration", "verification") {

  REQUIRE(true == true);

}

TEST_CASE("test")

{

  REQUIRE(test_config() == true);

}

TEST_CASE(mass, velocity)

{

  REQUIRE(mass(10) && velocity(9) == 405);

}

TEST_CASE(mass, velocity)

{

  REQUIRE(mass(20) && velocity(5) == 250);

}

TEST_CASE(mass, velocity)

{

  REQUIRE(mass(30) && velocity(7) == 735);

}

Homework Answers

Answer #1

Greetings!!

Code:

#include <iostream>
using namespace std;
void test_case(int,int);
void require(int,int);
int main()
{
cout << "mass\tvelocity\tkinetic energy" << endl;
test_case(10,9);
test_case(20,5);
test_case(30,7);
return 0;
}
void test_case(int a, int b)
{
require(a,b);
}
void require(int a,int b)
{
cout << a << "\t";
cout << b << "\t\t";
cout << a*b*b/2 << endl;
}

Output screenshot:

Hope this helps

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
In relation to Susan's Special Sauces: MIS Cases. How do I determine the overall cost if...
In relation to Susan's Special Sauces: MIS Cases. How do I determine the overall cost if all orders were filled? OrderNo PNo Quantity CustNo 1 4 100 123 1 11 50 123 2 8 10 234 3 7 75 56 4 1 20 45 4 4 150 45 5 20 120 12 6 1 12 119 6 14 15 119 7 10 200 80 8 20 10 32 9 17 10 22 10 16 20 10 11 5 12 17...
Finding the Spring Constant We can describe an oscillating mass in terms of its position, velocity,...
Finding the Spring Constant We can describe an oscillating mass in terms of its position, velocity, and acceleration as a function of time. We can also describe the system from an energy perspective. In this experiment, you will measure the position and velocity as a function of time for an oscillating mass and spring system, and from those data, plot the kinetic and potential energies of the system. Energy is present in three forms for the mass and spring system....
What would the pseudocode be for this? The code for this has already been answered. I...
What would the pseudocode be for this? The code for this has already been answered. I need the pseudocode. Credit card numbers typically consist of 13, 15, or 16 digits. For example, 4690 3582 1375 4657 is a hypothetical credit card number. The first digit designates the system. In (3.1.1), the first digit, 4, shows that the card would be a Visa card. The following digits specify other information such as the account number and bank number. (The precise meaning...
9.11 Table C.13 Anorexia data Ben-Tovim et al. (1979) report a case-control study to test hypothesis...
9.11 Table C.13 Anorexia data Ben-Tovim et al. (1979) report a case-control study to test hypothesis that anorexic people tend to overestimate their true waist measurements.Eight anorexic women were identified from a hospital in-patient unit and compared with 11 non-anorexic adolescent schoolgirls. The outcome variable used to compare cases and controls was the body perception index, BPI = 100 * (perceived waistwidth)/ (true waist width) The data collected were as follows: Subject number Waist width (cm) Cases True Perceived BPI...
•• R5.9We have seen three kinds of variables in C++: global variables, parameter variables, and local...
•• R5.9We have seen three kinds of variables in C++: global variables, parameter variables, and local variables. Classify the variables of Exercise •• R5.8 according to these categories. 1 int a = 0; 2 int b = 0; 3 int f(int c) 4 { 5 int n = 0; 6 a = c; 7 if (n < c) 8 { 9 n = a + b; 10 } 11 return n; 12 } 13 14 int g(int c) 15 {...
You have been hired to test whether the demand for a product that your client produces...
You have been hired to test whether the demand for a product that your client produces varies between two demographic markets – the Urban and Rural markets. As such, in each market, you run a short survey that gauges customers demand for your product and assigns them to one of three categories – (i) High (ii) Medium or (iii) Low. You survey 70 people in the “Urban” market and find that their demand falls into the following “buckets” High                32...
1. Motion of an object depends on its velocity only. True False 2. A car with...
1. Motion of an object depends on its velocity only. True False 2. A car with a mass of 2500 kg is traveling at a speed of 30 m/s due east. Choose the most appropriate answer to its momentum. a. 30 m/s due east b. 30 m/s c. 75,000 kgm/s d. 75,000 kgm/s due east 3. A car is traveling at 70 mph and then is involved in an accident with a head-on collision into a very solid wall. As...
I have solved everything except for the t-statistic and p-value Final test scores for a sample...
I have solved everything except for the t-statistic and p-value Final test scores for a sample of 20 students in a managerial accounting class are shown (a) At α = .05, is there a difference in the population median scores on the two tests? Fill in the right side of the worksheet below. (Round your Rank, R+, and R– answers to 1 decimal place. Negative values should be indicated by a minus sign.) Student Test 1 Test 2 d |d|...
1. A 25 kg skydiver has a speed of 20 m/s at an altitude of 350...
1. A 25 kg skydiver has a speed of 20 m/s at an altitude of 350 m above the ground. Determine the kinetic energy possessed by the skydiver. 2. If a cruise ship travels 150 km to the south and then 250 km to the west, what is the ship’s displacement from its starting point? 3. A train is accelerating at a rate of 5 m/s . If its initial velocity is 15 m/s, what is its speed after 10...
I need the actual code for this... I found a similar response but it was not...
I need the actual code for this... I found a similar response but it was not thorough enough. Problem Prerequisites: None Suppose that a scientist is doing some important research work that requires her to use rabbits in her experiments. She starts out with one adult male rabbit and one adult female rabbit. At the end of each month, a pair of adult rabbits produces one pair of offspring, a male and a female. These new offspring will take one...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT