84.9k views
0 votes
Program Check List for Program 3

Create a folder to save both Java Classes in and name it YourLastNameProgram3.

IfElseDriver Class Requirements

Name both the Class and the Driver file IfElseDriver.

Include all Prologue Requirements.

Include the Initial Algorithm.

Include the Refined Algorithm.

Create a new object of the IfElseExamples class and name it ifElseTester.

Initialized the new object of IfElseExamples within the parameter list with your name and password from the Driver.

Declared all variables listed in requirements for the Driver.

Prompts User to enter a password.

Sends password to checkPassword method in external class.

Sets up an outer IF/ELSE to only allow access if password is correct.

IF condition tests Boolean value returned by checkPassword.

If the IF condition is false then display error message.

ELSE section contains code if the password is correct.

Beginning and Ending curly brackets are used within the ELSE.

All prompts and method calls to test the external class are within the ELSE.

IfElseExamples Class Requirements

Name both the Class and the external file IfElseExamples.

Include all Prologue Requirements.

Declared all variables as listed in the program requirements for the external class.

Include a Constructor that initializes the User’s name and password.

The Constructor does not have a data type or void.

The Constructor has two parameters in the parameter list: String userName and String userPassword.

The Constructor assigns these parameters to the variables: String name and String password.

Include the method to determine if an integer is positive or negative.

Include the method to determine if an integer is odd or even.

Include the method to determine the largest of two integers.

Include the method to determine if the password is correct.

Include a get method to return the inventory number.

Include a get method to return the cost of the item.

Include a toString method to return the data formatted as one string.

DON’T

Applies to both Java Classes

All global variables must be declared within the Data Declaration Section of each Class.

No input on the same line as a variable declaration.

No equations on the same line as a variable declaration.

No equations on the same line as input.

Do not use the printf statement.

User Kluyg
by
7.6k points

1 Answer

3 votes

Final answer:

The student's query involves creating two Java classes, IfElseDriver and IfElseExamples, for a college programming assignment adhering to specific requirements for constructors, methods, and proper handling of user input for password validation.

Step-by-step explanation:

Checklist for Java Class and Driver Creation

The student's question pertains to the creation of two Java classes for a college-level programming assignment. The first class, named IfElseDriver, serves as the driver file which contains the main method. It includes a prologue, initial algorithm, refined algorithm, and is responsible for creating an object of the second class, IfElseExamples, which contains various methods to perform specific tasks. The driver class handles user input to test the password and gives access to the rest of the program only if the entered password is correct, based on a boolean value returned by the checkPassword method. If the authentication fails, an error message is displayed.

The IfElseExamples class includes a constructor to initialize the user's name and password and additional methods for determining the positivity or negativity of an integer, whether an integer is odd or even, finding the largest of two integers, checking if the password is correct, and getting methods for inventory number and cost of the item, along with a toString method. Both classes must adhere to specific naming and variable declaration conventions, and all prompts and method calls should be placed correctly as per the requirements.

User Jamadri
by
7.3k points