Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Good Morning, I have the task of writing a short application that uses conditionals to create a forked branching structure for the recipe manager. Whenever

Good Morning,

I have the task of writing a short application that uses conditionals to create a "forked" branching structure for the recipe manager.

Whenever a program accepts user input, it is best practice to be sure the input is what you as the programmer expect. As you continue to develop the recipe manager, you will need to be able to validate user input and ensure that the user enters values that are valid. In this lab, you will write a short program that first, tests that the input is numerical, then checks that the number is within a specific range, and checks that the maximum number of cups of our main ingredient is 100 and that the minimum number of cups is 1.

This application uses the Scanner class to accept a number between 1 and 100 from the user. The Scanner class is useful for parsing primitive values, including numbers.

Specifically, you will create a branching structure that leads to the following output:

If the number entered is between 1 and 100 (inclusive), the application will display a message that says, Good job! The number you entered is___.

However, if the number entered is not between 1 and 100 (inclusive), an error message will be displayed to inform the user that the entry does not fit the expected range: The number entered was not between 1 and 100!

Needs to be completed as a Java file

Extending This Lab for Your Final Project For your final project, adapt your Ingredient Java file to include data-type validation steps for each of the variables in the class: ingredientName (String) ingredientAmount (float) unitMeasurement (String) Number of calories (double)

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

Graph Database Modeling With Neo4j

Authors: Ajit Singh

2nd Edition

B0BDWT2XLR, 979-8351798783

More Books

Students also viewed these Databases questions

Question

What is linear transformation? Define with example

Answered: 1 week ago