CSCI 200 - Spring 2023
Foundational Programming Concepts & Design

Lab 1B - Random Classification

This lab is due by Tuesday, January 31, 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.


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

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!

Lab Submission


Submit your main.cpp file(s).

You will submit your solution to this lab with the rest of Set1. Detailed instructions for doing this are posted in Assignment 1.


This lab is due by Tuesday, January 31, 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.