CSCI 200 - Fall 2023
Foundational Programming Concepts & Design

Lab 1B - Random Classification

This lab is due by Thursday, September 07, 2023, 11:59 PM.
As with all labs you may, and are encouraged, to pair program a solution to this lab. If you choose to pair program a solution, be sure that you individually understand how to generate the correct solution.

Jump To: Rubric Submission


Generate & Classify a Random Value



In class we went through the process of generating a random number. Modify/extend the class example to accomplish the following steps:

  1. Prompt the user to enter the minimum value
  2. Prompt the user to enter the maximum value
  3. Print a random float in the inclusive range of [min, max]
  4. Print which quartile this value is in (no need to overcomplicate the quartile computation - divide the range into fourths and add this quarter value to the minimum value the appropriate number of times. If the random value falls onto the quartile boundary, classify it in the upper quartile range.)

An example interaction is shown below:

Enter the minimum value: 1
Enter the maximum value: 10
A random value is: 2.1
This is in the first quartile
Enter the minimum value: 4.5
Enter the maximum value: 13.75
A random value is: 12.2
This is in the fourth quartile

Once you have your program generating one number, ask the user if they want to generate another random value. The user is able to enter 'Y' or 'N' as their choice. Continue generating random values and their classification until the user opts to quit.

Enter the minimum value: 1
Enter the maximum value: 10
A random value is: 2.1
This is in the first quartile
Do you want another random value? (Y/N) Y
A random value is: 5.83
This is in the third quartile
Do you want another random value? (Y/N) Y
A random value is: 1.33
This is in the first quartile
Do you want another random value? (Y/N) N
Have a nice day!

For now, we will assume a smart cooperative user that will always enter either 'Y' or 'N'. Any other values do not need to be handled and can safely be ignored.


Grading Rubric


Your submission will be graded according to the following rubric:

PointsRequirement Description
0.70Fully meets specifications
0.15Submitted correctly by Thursday, September 07, 2023, 11:59 PM
0.15Best Practices and Style Guide followed
1.00Total Points


Lab Submission


Always, always, ALWAYS update the header comments at the top of your main.cpp file. And if you ever get stuck, remember that there is LOTS of help available.

Zip together your main.cpp, Makefile files and name the zip file L1B.zip. Upload this zip file to Canvas under L1B.

This lab is due by Thursday, September 07, 2023, 11:59 PM.
As with all labs you may, and are encouraged, to pair program a solution to this lab. If you choose to pair program a solution, be sure that you individually understand how to generate the correct solution.