Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can someone help me with java program? I) (30 pts. ) - Many online and offline services are associated with a user identity and credential.

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

can someone help me with java program?

I) (30 pts. ) - Many online and offline services are associated with a user identity and credential. In this assignment, you will create a rudimentary (and highly insecure) database(data file) for the storage of only the user generated identities. This program will have the following behaviors: ak A) (4/30 pts. ) - Prior to prompting for a new username, the existing list of usernames should be read and loaded to an arrayList (not array). 1 ) Read the list from "users.txt", a prompt is not necessary. Do not change this data file name "users.txt". 2) The existing list of usernames should be displayed to the console (screen). ne De B) (12 / 30 pts. ) - Upon prompting, the following checks must be made against an attempt to create a new username. 1) Duplicate usernames should be disallowed, and the usernames are case sensitive. 2) Usernames must be between 4 and 7 characters in length. 3) Usernames must have lower-case AND upper case. 4) Usernames must start with a letter like [a-z A-Z] 5) Usernames must have at least one number like [0-9] 6) No special character is allowed except _ (underscore) and ! (exclamation mark) 7) If the rules from 1-6 are violated, an appropriate error message informing the user should be displayed. i) The error message should display *all* the reasons why the username is not correct. ii) Do not display merely the first problem the program identifies (unless, of course, the first problem is the only problem). 8) When checking the length of a username, "magic number" is not allowed. 9) Username consists of only one token. ee C) (6/30 pts. ) - When a valid username is provided, this username should be written to an arrayList and displayed back to console. D) (8 / 30 pts. ) - Finally, the "users.txt" database should be updated such that the new username appears should the program be run again. Remember this output file is the same as the input file. II ) A Sample log of execution is as follow (user inputs are in bold and underlined): line List of Usernames April4 March3 June 6 Create a new user: December! Invalid Name. Name too long. Usernames must have at least one number Create a new user: bellevuecollege Invalid Name. Name too long. Usernames must have at least one number. Usernames must have lower-case and upper-case. Create a new user: April4 Invalid Name. Name already in use. Create a new user: 4July@ Invalid Name. Name must start with a letter. Special character is not allowed Create a new user: July_4 User "July_4" added successfully! List of Usernames April4 March3 June 6 July_4 static create an ArrayList for username; static create an array for error messages; static final int max length of username; static final int min length of username; static Scanner for input username; static PrintStream for data file; static boolean valid; public static void main (String args[]) { errorMessages(); // prepare error messages readFile(); // read from data file and save it into ArrayList listUserNames (); // print all usernames on the screen // now, ask for a new username while (...) { id = input.next(); I do not use input.nextLine(); checkLength(id); checkStartWith(id) } addNewUser2ArrayList(); // add new username into the ArrayList listUserNames(); // print all usernames on the screen writeAllUserNames 2 File(); // save usernames to the output file. static void checkLength (String id) { if(id.length()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 19 21 2012 Proceedings Part 3 Lnai 7198

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284922, 978-3642284922

More Books

Students also viewed these Databases questions