Skip to content

Create a project that asks the user for a minimum integer, then a maximum integer, then a value between those two numbers. The program needs to validate that the second number is greater than the first number, and it also needs to validate that the third number is between the first two numbers. Use 3 While loops, which will repeat over and over …

License

Notifications You must be signed in to change notification settings

bell-kevin/InputValidationProject

Repository files navigation

InputValidationProject

Create a project that asks the user for a minimum integer, then a maximum integer, then a value between those two numbers. The program needs to validate that the second number is greater than the first number, and it also needs to validate that the third number is between the first two numbers. Use 3 While loops, which will repeat over and over until the input value meets the criteria. Do not use any IF structures. Do not prompt for the input first, then test it in a While loop (priming the input) – instead, prompt for the data and read it from the scanner inside the loop. To do that, set the values for the 3 variables to something that is clearly invalid (like -1), so that the test in the While loop will always start out true. For example, if a variable named “minimum” is set to -1 when it is declared, then a While loop that tests if the minimum is less than 1 will be true, and the code inside the While loop will execute, which should prompt the user for the value, then read the data from the scanner. Note that there must be a title and your name at the top of the output. The prompts must allow the user to enter input to the right of the same line as the prompt. Note that the same prompt is repeated if the input was invalid. Once a valid number is input, the next prompt asks for new data. Be sure to include the minimum and maximum values in the prompt for the middle value. Echo the values as shown above once valid values have been entered. Take a screenshot of the running program that matches the sample session, and include the code above it. Run the program again and enter different values, with at least one invalid entry in each section, then take a screenshot of the results. Pay careful attention to the rubric for this assignment. Even if not specifically mentioned in the assignment, you are responsible for the following: Use descriptive names for all variables Add comments describing the use or meaning of variables Do NOT include literal values in any calculations, always use variables Always include a header in the output with a descriptive title and your name If asking for input, make sure the user types on the same line as the question Where sample sessions are provided, output from your project must match it Note that you must use correct formatting in the code -- appropriate indentation is most important. You can use Shift-Alt-F to have NetBeans automatically format the code correctly. If the formatting is incorrect, it will be returned to you for changes with a grade of zero. Submission: the specified screenshots and the root folder for the project Note: You need to submit the whole project for these assignments. In File Explorer, go to the location where you created the project. There will be a folder with the name of your project -- that is the root folder of the project. If you submit the root folder of the project, the instructor can run it on a different machine to grade it. If you don't submit the proper folder, it won't run on another machine, and the assignment will be marked with a zero.

== We're Using GitHub Under Protest ==

This project is currently hosted on GitHub. This is not ideal; GitHub is a proprietary, trade-secret system that is not Free and Open Souce Software (FOSS). We are deeply concerned about using a proprietary system like GitHub to develop our FOSS project. We have an open {bug ticket, mailing list thread, etc.} where the project contributors are actively discussing how we can move away from GitHub in the long term. We urge you to read about the Give up GitHub campaign from the Software Freedom Conservancy to understand some of the reasons why GitHub is not a good place to host FOSS projects.

If you are a contributor who personally has already quit using GitHub, please check this resource for how to send us contributions without using GitHub directly.

Any use of this project's code by GitHub Copilot, past or present, is done without our permission. We do not consent to GitHub's use of this project's code in Copilot.

Logo of the GiveUpGitHub campaign

About

Create a project that asks the user for a minimum integer, then a maximum integer, then a value between those two numbers. The program needs to validate that the second number is greater than the first number, and it also needs to validate that the third number is between the first two numbers. Use 3 While loops, which will repeat over and over …

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages