CSCE 145:  Homework 1

 

1.      Use Java to write and run a simple console-window program for checking passwords.  The program must satisfy the following requirements:

·         When the program runs, it should first print its name, e.g., Password Checker

·         The program should next prompt the user to enter a username, e.g.,
Please enter your username:

·         The program should next prompt the user to enter a password, e.g.,
Please enter your password:

·         If the user enters a correct password, i.e., one that matches an internal secret password, the program responds
You are approved by access control!, and quits.

·         If the user enters an incorrect password, the program responds
Sorry, and quits.

2.      Your source code must conform to the following style:

·         There must be a header that contains: (1) your name as author, (2) the date the program was written, (3) the version number of the program, and (4) a short description of the purpose of the program.  This is an opportunity for you to be creative, and no two headers should be alike.  For example,


/**
 *  @author  Dr. Michael N. Huhns                      *
 *  @version  1.2, 20 August 2011                     *
 *  This program confirms a password typed into a      *
 *    console window                                   *
 */

·         The source code must be indented properly and contain comments that describe the important parts of the algorithm.

3.      Upload a copy of your source code to the CSCE 145 dropbox at https://dropbox.cse.sc.edu. 

4.      The grades for this assignment will be based on the following

30%

Style: comments and indentation

70%

Functionality: Does it compile? Does it run? Does it work for all inputs?