Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Analysis In Microsoft Excel

Authors: Alex Holloway

1st Edition

B0CCCPKTTX, 979-8852388452

More Books

Students also viewed these Databases questions

Question

a . What are the minimum and maximum numbers of levels? in a BST

Answered: 1 week ago

Question

Find dy/dx if x = te, y = 2t2 +1

Answered: 1 week ago