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

Write a program that randomly selects from a bag of eight objects. Each object c

ID: 3617849 • Letter: W

Question

 Write a program that randomly selects from a bag of eight objects. 
Each object can be red, blue, orange, or green and it can be a ball
or a cube. Assume the bag contains once object for
each combination, i.e. one red ball, one red cube, etc.
Using one character array for color and one for the shape, write a
program to draw random object from the bag with replacement.


Expected Output:

Enter no. of items to draw (0 to exit): 10
blue ball
orange ball
red ball
blue ball
red cube
red cube
green cube
green cube
red ball
blue ball
Enter no. of items to draw (0 to exit): 15
green ball
blue ball
blue cube
red ball
orange ball
green ball
orange cube
orange cube
blue ball
red ball
green cube
blue ball
green ball
orange ball
blue ball
Enter no. of items to draw (0 to exit): 2
red cube
blue cube
Enter no. of items to draw (0 to exit): 0

Explanation / Answer

please rate - thanks didn't quite get the character array part. hope this is right #include using namespace std; int main() {srand(time(0)); int i,j,num,c,s,starts,ends,startc,endc; char color[]={"redblueorangegreen"}; char shape[]={"ballcube"}; int shapestart[]={0,4,8}; int colorstart[]={0,3,7,13,18}; coutnum; while(num!=0)     {for(j=0;j
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote