Lab07

Objective

Write a program to display a special message if the user enters the correct username and password. If the user enters incorrect information, then display something else.

This lab will require the use of a an if-else statement (see Lab03 if you need a refresher, also note the use of equals() , a method of String objects). Though not strictly necessary, you can use the and (&&) operator.

Example Dialog

A case where an entered value is wrong:

…and when both are right:

Lab Report Questions

1.       Is this a good way to password protect something? Why or why not? You may assume everyone (criminals, etc.) has access to the compiled .class file.

2.       (Not really a question) – be sure to carefully describe the logic your program uses – a flowchart is a good idea here. (See slides or Wikipedia for this).

a.       Diamonds for decisions

b.      Rectangles for steps