== Prototype ==
Part of the design process is creation of a PROTOTYPE. That is a== Starting ==
(1)
Look at the EXISTING PAPER VERSION of the check-out system.
(2) Draw
a diagram of the ENTIRE EXISTING SYSTEM.
(3) Run the prototype.
(4)
Write down a few ideas related to the following questions:
CONVENIENCE
-
Compare the
prototype and paper in terms of convenience.
Suggest
some changes that would improve convenience.
RELIABILITY
-
Compare the
prototype and paper in terms of reliability.
Suggest
some changes that would improve reliability.
SECURITY
-
Are there any
security issues in this system?
Compare
the prototype and paper in terms of security.
Suggest
some changes that would improve security.
********/
import java.awt.*;
import java.io.*;
public class CheckOut extends EasyApp
{
public static void main(String[] args)
{
new CheckOut();
}
Button bSignOut = addButton("Sign out", 50,50,100,50,this);
Button bSignIn = addButton("Sign in ",150,50,100,50,this);
Button bReadLog = addButton("Read log",250,50,100,50,this);
public void actions(Object source, String command)
{
if (source == bSignOut)
{ signOut(); }
else if (source == bSignIn)
{ signIn(); }
else if (source == bReadLog)
{ readLog(); }
}
public void signOut()
{
try
{
String name = input("Name:");
String time = input("Time:");
String reason = input("Reason:");
PrintWriter file =
new PrintWriter(new FileWriter("log.txt",true)); // append
file.println("~~ Leaving ~~");
file.println(name);
file.println(time);
file.println(reason);
file.close();
}
catch (IOException ex)
{ output(ex.toString()); }
}
public void signIn()
{
try
{
String name = input("Name:");
String time = input("Time:");
PrintWriter file =
new PrintWriter(new FileWriter("log.txt",true)); // append
file.println("~~ Returning ~~");
file.println(name);
file.println(time);
file.close();
}
catch (IOException ex)
{ output(ex.toString()); }
}
public void readLog()
{
runProgram("explorer.exe log.txt");
}
}