Question: interface-based programming C++ header file /** * Specification of class BullsAndCows. * * @author converner * @version v5 (SWE20004, 2017) * */ #pragma once #include

interface-based programming C++

interface-based programming C++ header file /** * Specification of class BullsAndCows. *

* @author converner * @version v5 (SWE20004, 2017) * */ #pragma once

#include class BullsAndCows { private: int fSecretNumbers[9]; int fBulls; int fCows; public:

header file /** * Specification of class BullsAndCows. * * @author converner * @version v5 (SWE20004, 2017) * */ #pragma once #include class BullsAndCows { private: int fSecretNumbers[9]; int fBulls; int fCows; public: /** * Constructor: Instantiates an object of class BullsAndCows. * The constructor sets up an array of 9 unique * integers between 1 and 9. In addition, the * instance variables fBulls and fCows are set to 0. */ BullsAndCows(); /** * This method rearranges the numbers in the internal * integer array. This way we create a new "secret number." * We use the Fisher&Yates shuffling method for this purpose, where * n is 9. */ void start(); /** * This method determines the number of Bulls and Cows in the player's * 4-digit guessed number. * * @param aNumberString The player's guessed 4-digit number. * */ void guess( std::string aNumberString ); /** * Getter for number of bulls in last guess. * * @return The number of bulls (correctly placed digits). */ int getBulls() const; /** * Getter for number of cows in last guess. * * @return The number of cows (correctly guessed digits). */ int getCows() const; }; 

cpp file

/** * Implementation of class BullsAndCows. * * @author convener * @version v5 (SWE20004, 2017) * */ // 2/2 #include "BullsAndCows.h" // 2 #include // 2 #include // 2/6 using namespace std; /** * Constructor: Instantiates an object of class BullsAndCows. * The constructor sets up an array of 9 unique * integers between 1 and 9. */ // 2 BullsAndCows::BullsAndCows() { for ( int i = 0; i  1) { // new random index in the range 0 to n int k = rand() % n; n--; // n last pertinent index swap( fSecretNumbers[n], fSecretNumbers[k] ); // algorithm library } // 5/7 } /** * This method determines the number of Bulls and Cows in the player's * 4-digit guessed number. * * @param aNumberString The player's guessed 4-digit number. * */ // 2 void BullsAndCows::guess( string aNumberString ) { // fresh start fBulls = 0; // 2 fCows = 0; // 2 for ( int i = 0; i  

Problem Set 4: Interface-based Programming In problem set 3, you developed a console-based version of the paper and pencil game Bulls and Cows. The solution consisted of one class BullsAndcows and a main function defining the game loop. The approach works nicely, but did not follow the Model-View-Controller paradigm The task for this problem set is to develop an interface-based solution for Bulls and Cows. In particular, you are asked to implement a console view for the application that satisfies the following specification pragma once include

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!