Menu

First Picture Requirements Program Second Picture Details Requirements Third Forth Picture Q43881274

Youre responsible for writing two functions and testing them: fizzbuzz fizzbuzz2 Fizzbuzz is a function that will take a num

The first picture is the requirements for program.

For this assignment, you must log on to the server and go into the ~/fizzbuzz_tdd directory. You must implement 4 things for

The second picture is the details of therequirements.

chude <iostream> using namespace std; YOU: Write fiz buzz Return Fizz X 15 divisible by 3 Return Buzz 11x is divisible by

MADE your own tests to check bad inputs here SESS (Fizzbuzz, BadTests) YOU: Weite your own tests to check edge inputs here YO

The third and forth pictures are comments given byinstructor.
Using C++ please

You’re responsible for writing two functions and testing them: fizzbuzz fizzbuzz2 Fizzbuzz is a function that will take a number between 1 and 100, and will return a string containing one of four values based on which case it is: Case 1) “Fizz” if the number passed in is divisible by 3 (for example, 12). Case 2) “Buzz” if the number passed in is divisible by 5 (for example, 20). Case 3) “Fizzbuzz” if the number passed in is divisible by both 3 and 5 (for example 30). .. . . Case 4) “<The number>” otherwise., (for example, passing in 7 will return *7″). This is a string, not an int. To convert from an int to a string in C++, use the to_string() function. For example, to_string(2) returns “2”. Fizzbuzz2 is exactly the same, but with one additional check. Prior to Case 4, you must add the digits of the number together, and apply the same checks to the sum. In other words, if you pass in 41, you will return “Buzz” because even though 41 isn’t divisble by 3 or 5, 4+1 = 5. You will add this check after Case 3 and before Case 4. You must write a series of tests for your code to verify that your code is working properly. I recommend starting with the simplest tests possible, and writing as little code as possible to answer those tests, and continuing to go back and forth until you can’t think of anything else to test. Use “make” to compile this code, rather than trying to compile it manually. For this assignment, you must log on to the server and go into the ~/fizzbuzz_tdd directory. You must implement 4 things for 100% on this assignment: 1) You must write a fizzbuzz function that takes in an int and returns a string according to the rules for fizzbuzz (found in the README file). 2) You must write a fizzbuzz2 function that functions just like fizzbuzz, but between Case 3 and Case 4 adds another check where it adds the two digits of the number together, and if they are divisible by 3, returns “Fizz”, divisible by 5 returns “Buzz” and if it is divisible by both returns “Fizzbuzz”; 3) Write test cases for them, to guarantee your implementation is correct. 4) Inside of main, write a loop that prints the results of fizzbuzz() and fizzbuzz2() from 1 to 100. If you ever forget where you need to write code, I’ve helpfully put comments with “YOU:” in main.cc at each place you need to write code. chude <iostream> using namespace std; YOU: Write fiz buzz Return “Fizz” X 15 divisible by 3 Return “Buzz 11x is divisible by S // Return “Fizzbuzz” if x is divisible by both 3 and 5 // Return a string containing the number otherwise /Return “Error” 1 x is less than 1 or greater than 100 string fizzbuzz (int x) //This won’t compile, since it’s not returning anything 1/YOU: Write tests to test your fizzbuzz implementation TEST (Fizzbuzz, GoodTests) EXPECT EQ(fizzbuzz (33). “Fizz”); EXPECT_EQ(fizzbuzz (50), “Buzz”); EXPECT EQ(fizzbuzz (13). “13”): EXPECT EQ (fizzbuzz (45), “Fizzbuzz”); EXPECT_EQ(fizzbuzz (42). “Fizz”): //YOU: Write your own tests to check bad inputs here TEST (Fizzbuzz, BadTests) //YOU: Write your own tests to check edge inputs here J //YOU: Now write a function called fizzbuzz2, that is exactly the same as fizzbuzz, but with one important change, Before returning a number, add the digits of the number together, and use the result from that sum with the same ules. For example, 23 would return “Buzz” because 2+3 = 5. string fizzbuzz2(int x) return ; 1/YOU: Now write good, bad, and edge cases for fiz buzz2 as well. int main(int arge, char * argv) testing::InitGoogleTest (Gargc, argv); Sifndef Foo 1/Stop people from compiling this code using ‘compile’ static assert(false, “type make to build this, not compile fendit cout << “Welcome to Fizzbuzz 2000 ™. Choose one of the following options: n”: cout << “tizzbuzz – will run fizzbuzz from 1 to 100. In INSERT — her toch E MADE your own tests to check bad inputs here SESS (Fizzbuzz, BadTests) YOU: Weite your own tests to check edge inputs here YOU: Now write a function called the bus 22 that is exactly the same as fizzbuzz, but with one important change. Before returning a number, add the dirts of the number together, and use the result from that sum with the same tules. For example, 23 would return “BUER” because 2+3 5. string fizzbuzz2 (int x) return ; //YOU: Now write good, bad, and edge cases for fizzbuzz2 as well. int main(int argc, char** argv) testing :: InitGoogleTest (Gargc, argv); Findef FOO VISCOD people from compiling this code using compiler static assert(false, “type ‘make to build this, not compile’ fendit – cout << “Welcome to Fizzbuzz 2000 ™. Choose one of the following options: cout << “izzbuzz – will run fizzbuzz from 1 to 100.0 cout << “Fizzbuzz2 – will run fizzbuzz2 from 1 to 100. na cout << “(a number) – will run fizzbuzz and fizzbuzz2 on just that number. cout << “test – will run the test suite you’ve created. In strings: getline (cin, s); if (s = “test”) return RUN ALL TESTS(); else if (s == “fizzbuzz”) { //YOU: Weite code that will output the result of the fizzbuzz function from 1 to 100 here: else if(s == “fizzbuzz2”){ //YOU: Write code that will output the result of the fizzbuzz2 function from 1 to 100 here: else // Just a number, so feed it to each function and output the result nt x = stoi (s): cout << “Eizzbuzz (” << x << << tizzbuzz (x) << endl; cout << “Eizzbuzz2(” << X <<“) << tizzbuzz2(x) << endl; INSERT – Show transcribed image text You’re responsible for writing two functions and testing them: fizzbuzz fizzbuzz2 Fizzbuzz is a function that will take a number between 1 and 100, and will return a string containing one of four values based on which case it is: Case 1) “Fizz” if the number passed in is divisible by 3 (for example, 12). Case 2) “Buzz” if the number passed in is divisible by 5 (for example, 20). Case 3) “Fizzbuzz” if the number passed in is divisible by both 3 and 5 (for example 30). .. . . Case 4) “” otherwise., (for example, passing in 7 will return *7″). This is a string, not an int. To convert from an int to a string in C++, use the to_string() function. For example, to_string(2) returns “2”. Fizzbuzz2 is exactly the same, but with one additional check. Prior to Case 4, you must add the digits of the number together, and apply the same checks to the sum. In other words, if you pass in 41, you will return “Buzz” because even though 41 isn’t divisble by 3 or 5, 4+1 = 5. You will add this check after Case 3 and before Case 4. You must write a series of tests for your code to verify that your code is working properly. I recommend starting with the simplest tests possible, and writing as little code as possible to answer those tests, and continuing to go back and forth until you can’t think of anything else to test. Use “make” to compile this code, rather than trying to compile it manually.
For this assignment, you must log on to the server and go into the ~/fizzbuzz_tdd directory. You must implement 4 things for 100% on this assignment: 1) You must write a fizzbuzz function that takes in an int and returns a string according to the rules for fizzbuzz (found in the README file). 2) You must write a fizzbuzz2 function that functions just like fizzbuzz, but between Case 3 and Case 4 adds another check where it adds the two digits of the number together, and if they are divisible by 3, returns “Fizz”, divisible by 5 returns “Buzz” and if it is divisible by both returns “Fizzbuzz”; 3) Write test cases for them, to guarantee your implementation is correct. 4) Inside of main, write a loop that prints the results of fizzbuzz() and fizzbuzz2() from 1 to 100. If you ever forget where you need to write code, I’ve helpfully put comments with “YOU:” in main.cc at each place you need to write code.
chude using namespace std; YOU: Write fiz buzz Return “Fizz” X 15 divisible by 3 Return “Buzz 11x is divisible by S // Return “Fizzbuzz” if x is divisible by both 3 and 5 // Return a string containing the number otherwise /Return “Error” 1 x is less than 1 or greater than 100 string fizzbuzz (int x) //This won’t compile, since it’s not returning anything 1/YOU: Write tests to test your fizzbuzz implementation TEST (Fizzbuzz, GoodTests) EXPECT EQ(fizzbuzz (33). “Fizz”); EXPECT_EQ(fizzbuzz (50), “Buzz”); EXPECT EQ(fizzbuzz (13). “13”): EXPECT EQ (fizzbuzz (45), “Fizzbuzz”); EXPECT_EQ(fizzbuzz (42). “Fizz”): //YOU: Write your own tests to check bad inputs here TEST (Fizzbuzz, BadTests) //YOU: Write your own tests to check edge inputs here J //YOU: Now write a function called fizzbuzz2, that is exactly the same as fizzbuzz, but with one important change, Before returning a number, add the digits of the number together, and use the result from that sum with the same ules. For example, 23 would return “Buzz” because 2+3 = 5. string fizzbuzz2(int x) return ; 1/YOU: Now write good, bad, and edge cases for fiz buzz2 as well. int main(int arge, char * argv) testing::InitGoogleTest (Gargc, argv); Sifndef Foo 1/Stop people from compiling this code using ‘compile’ static assert(false, “type make to build this, not compile fendit cout

Expert Answer


Answer to The first picture is the requirements for program. The second picture is the details of the requirements. The third and…

OR