Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help with the missing coding. here are some instructions and what i have

ID: 3759064 • Letter: I

Question

I need help with the missing coding. here are some instructions and what i have so far.

include <iostream>

#include <cstdlib>

using namespace std;

//functions for sample#1 //move these definitions below int main

void drawOddCone(int width)

{

for(int j=1;j<=width;j+=2)

{

for(int i=1;i<=(width-j)/2;i++)

{

cout<<" ";

}

cout<<"*";

if(j>1)

{

for(int h=1; h<=j-2; h++)

{

cout <<" ";

}

cout<<"*";

}

cout<<endl;

}

}

void drawOddBoxFilled(int height,int width)

{

for(int k= 1; k <=height;k++)

{

for(int m=1;m<=width;m++)

{

cout<<"*";

}

cout<<endl;

}

}

void drawOddBoxOpen(int height,int width)

{

for (int i = 0; i < height; i++)

{

for (int j = 0; j < width; j++)

{

if ((j == 0) || (j == width - 1))

{

cout << "*";

}

else if ((i == 0) || (i == height - 1))

{

cout << "*";

}

else

{

cout << " ";

}

}

cout << endl;

}

}

//functions for sample#2 //move these definitions below int main

void drawConeEven(int width)

{

for(int j=1;j<=width/2;j++)

{

for(int i=1;i<=(width/2)-j;i++)

{

cout<<" ";

}

cout<<"*";

if(j>=1)

{

for(int h=1; h<=2*j-2; h++)

{

cout <<" ";

}

cout<<"*";

}

cout<<endl;

}

}

void drawEvenBoxFilled(int height, int width)

{

for(int k= 1; k <=height;k++)

{

for(int m=1;m<=width;m++)

{

cout<<"*";

}

cout<<endl;

}

}

void drawEvenBoxOpen(int height, int width)

{

for (int i = 0; i < height; i++)

{

for (int j = 0; j < width; j++)

{

if ((j == 0) || (j == width - 1))

{

cout << "*";

}

else if ((i == 0) || (i == height - 1))

{

cout << "*";

}

else

{

cout << " ";

}

}

cout << endl;

}

}

void getDiminsions(int &h, int &w , int &s, char &t)

{

cout <<"Please enter a number for the height of the rocket? ";

cin>>h;

  

cout <<"Please enter a number for the width of the rocket? ";

cin>>w;

  

cout <<"Please enter a number for the stages of the rocket? ";

cin>>s;

  

cout<<"Would you like the rocket to be filled or open?(F/O) ";

cin>>t;

}

int main()

{

char again;

int rocketHeight;

int rocketWidth;

int rocketStage;

char rocketType;

  

do

{

  

getDiminsions(rocketHeight,rocketWidth,rocketStage,rocketType);

  

  

if((rocketHeight>3 && rocketHeight<15) && (rocketWidth>3 && rocketWidth<15))

{

  

// displays rocket with odd height and odd width and filled.

if((rocketHeight %2 != 0) && (rocketWidth %2 != 0) && (rocketType == 'F'|| rocketType == 'f'))

{

drawOddCone(rocketWidth);

for (int l =1;l<=rocketStage; l++)

{

drawOddBoxFilled(rocketHeight,rocketWidth);

}

drawOddCone(rocketWidth);

}

  

// displays rocket with odd height and odd width and open.

if((rocketHeight %2 != 0) && (rocketWidth %2 != 0) && (rocketType == 'O'|| rocketType == 'o'))

{

drawOddCone(rocketWidth);

for (int l =1;l<=rocketStage; l++)

{

drawOddBoxOpen(rocketHeight,rocketWidth);

}

drawOddCone(rocketWidth);

}

  

//displays rocket with even height and even width and filled.

if((rocketHeight %2 == 0) && (rocketWidth %2 == 0) && (rocketType == 'F'|| rocketType == 'f'))

{

drawConeEven(rocketWidth);

for (int q =1;q<=rocketStage;q++)

{

drawEvenBoxFilled(rocketHeight,rocketWidth);

}

drawConeEven(rocketWidth);

}

  

//displays rocket with even height and even width and open.

if((rocketHeight %2 == 0) && (rocketWidth %2 == 0) && (rocketType == 'O'|| rocketType == 'o'))

{

drawConeEven(rocketWidth);

for (int q =1;q<=rocketStage;q++)

{

drawEvenBoxOpen(rocketHeight,rocketWidth);

}

drawConeEven(rocketWidth);

}

  

// displays rocket with even height and odd width and filled.

if((rocketHeight %2 == 0) && (rocketWidth %2 != 0) && (rocketType == 'F'|| rocketType == 'f'))

{

drawOddCone(rocketWidth);

for (int l =1;l<=rocketStage; l++)

{

drawEvenBoxFilled(rocketHeight,rocketWidth);

}

drawOddCone(rocketWidth);

}

  

// displays rocket with even height and odd width and open.

if((rocketHeight %2 == 0) && (rocketWidth %2 != 0) && (rocketType == 'O'|| rocketType == 'o'))

{

drawOddCone(rocketWidth);

for (int l =1;l<=rocketStage; l++)

{

drawEvenBoxFilled(rocketHeight,rocketWidth);

}

drawOddCone(rocketWidth);

}

  

// displays rocket with odd height and odd width and filled.

if((rocketHeight %2 != 0) && (rocketWidth %2 == 0) && (rocketType == 'F'|| rocketType == 'f'))

{

drawConeEven(rocketWidth);

for (int l =1;l<=rocketStage; l++)

{

drawOddBoxFilled(rocketHeight,rocketWidth);

}

drawConeEven(rocketWidth);

}

  

// displays rocket with odd height and odd width and open.

if((rocketHeight %2 != 0) && (rocketWidth %2 == 0) && (rocketType == 'O'|| rocketType == 'o'))

{

drawConeEven(rocketWidth);

for (int l =1;l<=rocketStage; l++)

{

drawOddBoxFilled(rocketHeight,rocketWidth);

}

drawConeEven(rocketWidth);

}

}

  

else

{

cout <<"Invalid Input. Please try again or quit. ";

}

  

cout<<"Would you like to do this again?(y/n)"<<endl;

cin>>again;

  

}while(again == 'Y' || again =='y');

  

return 0;

  

}

Looks like we are missing the CalcCorrectAnswer, checkAnswer and printReport functions.

Here are the sample function prototypes for the math tutor including the above functions....
// ***function prototypes per program specification and structure design**************************

void getProbsPerSet (/*out*/ int& numProbs);
void doOneSet (/* in */ char problemType,/* in */ int numProbs, /*out */ int& correctCount);
void getMaxNum (/* out */int& maxNum);
void printHeader (/* in */ char problemType);
void doOneProblem (/* in */char problemType,/* in */ int maxNum,/*out */ bool& isCorrect);
void generateOperands (/* out */int& num1, /*out */int& num2,/* in */ int maxNum);
void calcCorrectAnswer (/* in */ char problemType,/* in */ int num1, /* in */int num2, /* inout*/ int& answer);
void checkAnswer (/* in */int num1,/* in */ int num2, /*out */bool& isCorrect);
void printReport (/* in */int probsPerSet, /* in */ int set1Correct, /* in */int set2Correct, /* in */int set3Correct);


(1) Could you include the function prototypes and appropriate function definitions for the missed functions.

Here is a sample version of the calls and processing in doOneProblem...with function documentation, if that will be helpful..

void doOneProblem (/* in */char problemType,/* in */ int maxNum,/*out */ bool& isCorrect)

Explanation / Answer

void doOneProblem (/* in */char problemType,/* in */ int maxNum,/*out */ bool& isCorrect)
{
int num1=0, num2=0,response=0,answer=0;
generateOperands(num1,num2,maxNum);
switch(problemType)
{
case '+' : cout << num1 << problemType << num2;
break;
case '-' : cout << num1 << problemType << num2;
break;
case '*' : cout << num1 << problemType << num2;
break;
}
cout<<" = ";
cin>>response;
calcCorrectAnswer (problemType,num1,num2,answer);
checkAnswer(num1,num2,isCorrect);
}
void generateOperands (/* out */int& num1, /*out */int& num2,/* in */ int maxNum)
{
num1 = rand()% maxNum + 1;
num2 = rand()% maxNum + 1;
}
void calcCorrectAnswer (/* in */ char problemType,/* in */ int num1, /* in */int num2, /* inout*/ int& answer)
169
{
int maxNum;
generateOperands(num1,num2,maxNum);
answer=num1<<problemType<<num2;
}
void checkAnswer (/* in */int num1,/* in */ int num2, /*out */bool& isCorrect)
{
int response, maxNum,answer;
char problemType;
calcCorrectAnswer(problemType,num1,num2,answer);
if(answer==response)
{
cout<<"correct";
cout<<endl;
}
else
{
cout<<"incorrect";
cout<<endl;
}
}
void printReport (/* in */int probsPerSet, /* in */ int set1Correct, /* in */int set2Correct, /* in */int set3Correct)
{
int set1Percent;
int totalPercent;
set1Percent = (100 * set1Correct) / probsPerSet;
cout << endl;
cout << "Set#1: You got " << set1Correct << " correct out of "<< probsPerSet << " for " << set1Percent << "%" << endl;
}