Question: 1 0 points - comment statements to document each program 1 0 points - use of descriptive variable names in each program ( beangame )

10 points - comment statements to document each program
10 points - use of descriptive variable names in each program
(beangame) Create a program to estimate the number of jelly beans in a jar. Assume the jar is a cylinder. You may also assume the jellybeans are cylinders that measure 2 cm long by 1.5 cm diameter (or 0.75 cm radius). VolumeOfCylinder =3.14159* height * radius2
radius2 can be represented as pow(radius,2) or radius * radius
Use the pow function since this is about modules/functions. Use
#include
in your program. It is the library that has the pow (power) function.
10 points - correct include libraries
10 points - correct use of pow function
(pick3) Create a pick 3 lottery helper program to select a set of lottery numbers for the user. The program should randomly pick three single-digit numbers from "0" to "9" and display them on the screen. Duplicate numbers are allowed. It should also calculate and display the "sum it up" value by adding the three numbers together.
Use number1= rand()%(max - min +1)+ min; with 0 as the min and 9 as the max for this problem. The following example code picks and displays a number from 1 to 100.
#include .
#include
#include
int main()
{
int number1;
srand(time(0));
//randomize the number generation
number1= rand()%100+1;
cout << "The computer picked number "<< number1;
return 0;
}
10 points - correct use of rand function
10 points - correct output
(guess) Write a program that accepts a number as a guess between 1 an 100 as input and outputs if the guess is "too high", "too low", or "correct". When the guess is correct the program should output how many guesses it took.
10 points - correct use of loop statement
10 points - correct use of if statements
10 points - correct #include statements
10 points - correct outputs

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!