Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Background Information: An internet bot , also known as web robot , WWW robot or simply bot , is a software application that runs

Java

Background Information:

  1. An internet bot, also known as web robot, WWW robot or simply bot, is a software application that runs automated tasks (scripts) over the Internet.
  2. Typically, bots perform tasks that are both simple and structurally repetitive, at a much higher rate than would be possible for a human alone. More than half of all web traffic is made up of bots.
  3. It turns out that Bots use passwords similar to the way users do.
  4. Both User and Bots need passwords to access system. The basic objective of Programming Project 2 is to create classes that enable you to develop an application that can manage both types of accounts.
  5. This functionality can be realized by implementing inheritance.
  1. Encryption Algorithm
    1. Implement a simple shift cipher.
    2. A shift cipher is a form of substitution cipher in which each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet. For example, with shift of 3, A would be replaced by D, B would become E, and so on.
    3. The shift for this program will be the key entered by the user.
    4. The password may be any of the characters in the ASCII table from character 33 the exclamation point ! to character 122 the lower case z.
    5. If the shift causes the character to be greater than 122, the shift will continue starting with character 33.
    6. Example:

If the user entered 8 as the key and a letter in the password is lower case x (char 120) a shift of 8 would result in the character & (char 38).

Project Requirements:

  1. Account class
    1. Superclass
    2. Instance variables
      1. clearPassword
        1. String
        2. Must be at least 8 characters long
      2. encryptedPassword : String
      3. key
        1. int
        2. Must be between 1 and 10(inclusive)
      4. accountId - A unique integer that identifies each account
      5. nextIDNum a static int that starts at 1000 and is used to generate the accountID
      6. no other instance variables needed.
    3. Default constructor set all instance variables to a default value.
    4. Parameterized constructor
      1. Takes in clearPassword, key.
      2. Calls encrypt method to create encryptedPassword
    5. setClearPassWord(String newPassword)
      1. Takes in a new clear text password.
      2. Calls encrypt method as the encrypted password would need to change.
    6. no encryptedPassword mutator method
    7. setKey(int newKey)
      1. Takes in a new key
      2. calls encrypt method as the encrypted password would need to change.
    8. accountId mutator - uses the static variable nextIDNum to retrieve the next available userID number
    9. encrypt method
      1. Uses the instance variables clearPassword and key to encrypt the password.
      2. Stores the encrypted password in the encryptedPassword instance variable
    10. toString - returns a nicely formatted String representing the instance variables of the Account class

NOTE: Your Account class should ensure the clearPassword is valid as described in the requirements. If not write an error message to the standard output and continue. Set the clearPassword and encyrptedPassword to the empty String.

  1. User Class
    1. Subclass of Account class.
    2. Instance variables
      1. username String
      2. fullName String
      3. deptCode int representing the department code
      4. No other instance variables are needed.
    3. Methods
      1. Default constructor sets all instance variables to a default value
        1. Call the super class constructor passing appropriate parameters to it.
        2. Set the rest of the variables
      2. Parameterized constructors
        1. Call the super class constructor passing appropriate parameters to it.
        2. Set the rest of the variables to the remaining parameters
      3. Accessor and mutator methods for all variables in this class
      4. toString
        1. Calls super class methods as needed.
        2. Returns a nicely formatted String representing the user to include fullName, username, deptCode, accountID number, clearPassword, encryptPassword and key
  1. Bot Class
    1. Subclass of Account class.
    2. A class that stores information about an application that performs an automated task.
    3. Instance Variables
      1. botFileName String representing the file name of the bot
      2. category String providing the Bot category which will be either IDS, SysAdm, or HelpDesk.
      3. dateUpdated GregorianCalendar object (from the Java API) that shows the date the Bot was last updated.
      4. createdBy String representing the creator name or handle.
    4. Methods
      1. Default constructor sets all instance variables to a default value
        1. Call the super class constructor passing appropriate parameters to it.
        2. Set the rest of the variables
      2. Parameterized Constructor
        1. Takes in all parameters required to set the instance variables.
        2. Call the super class constructor passing appropriate parameters to it
        3. Set the rest of the variables to the remaining parameters
        4. Date is a String in the format mm/dd/yyyy.
        5. Convert the date to a format compatible with creating GregorianCalendar object.
        6. Create the GregorianCalendar object
      3. Accessor and mutator methods for all variables in this class.
      4. toString
        1. Calls super class methods as needed
        2. Returns a nicely formatted String representing the Bot to include Bot file name, purpose, date updated, creator name, accountID number, clearPassword, encryptPassword and key
  1. The AccountTester
    1. This class should consists of a main method that tests all the methods in each class, either directly by calling the method from the Tester or indirectly by having another method call a method.
    2. User and Bot information will be read from a file. A sample file is provided. Use this file format to aid in grading. Using file processing makes entering and testing program with data sets much more efficient.
    3. The file created should include valid and invalid passwords that fully tests the application.
    4. Included is file called data.txt contains Account data. Your project will be graded using a similar input file. Your project must run with an input file formatted as data.txt is formatted. Note the file format is as follows:
      1. Character designation of type of player ( u- User, b - Bot)
      2. User username,fullname,deptCode
      3. Bot botFilename,category,dateUpdated,createdBy
      4. Account data common data for both types
    5. Creates an array of Account objects.
      1. Populate the array with both User and Bot objects.
      2. Retrieves each object stored in the arrau and calls its toString method polymorphically and displays the results.
  1. Create UML Class Diagram for the final version of your project. The diagram should include:
    1. All instance variables, including type and access specifier (+, -);
    2. All methods, including parameter list, return type and access specifier (+, -);
    3. Include Generalization and Aggregation where appropriate.
    4. The AccountTester does not need to be included.
    5. Refer to the UML Distilled pdf on the content page as a reference for creating class diagrams

You should have 10 files for this assignment:

  • User.java - The User class
  • Bot.java - The Bot class
  • Account.java The Account class.
  • AccountTester.java A driver program for your project
  • data.txt - your test file
  • Simply UML Class diagram of your 4 classes, do not include the Tester. (Dia file or image file , jpg, gif, pdf etc)
  • The javadoc files for all the classes except the tester.(Do not turn in)

Account.java has already been implemented

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions