CS210 Programming Assignment #7 Solution

$30.00

Category:

Description

This assignment focuses on reading/writing file, on using array structures and string class. Be sure to include a short comment at the beginning of your program as well as a short comment for each method describing what it does. For this assignment you are limited to the language features in Chapters 1-7 shown in lecture or the textbook.

  1. 1. (40points) Write a Java program to create username. Your program must satisfy the following requirements:
  2. 1. All the usernames must be stored into text file (user.txt)
  3. 2. You have to use array structure in your program.
  4. 3. Username isn’t case sensitive.
  5. 4. Username requires at least 6 characters
  6. 5. You can’t create a username starting with a number.
  7. 6. You can’t create a username starting with question mark `?`
  8. 7. You can’t create a username already in use.

 

Before you create a username, you should read all the usernames from the text file (user.txt), and store the username into an array. After this step, you should display all the usernames from the array (not directly from the text file).

In the case of failure to meet the requirement 4, 5, 6, and 7, you should display an  appropriate warning message for each case and ask user to input a new ID.  If a new username satisfied all the requirements, the

username should be saved into the text file (user.txt). After saving the username, you have to read the text file, store the username into an array, and display a list of usernames once again. You are to introduce at least three methods other than main: for reading a file, for writing a file and for checking “inUse”.

 

Check Point and Deduction:

 

Check point Deduction (points)
No Array or No data file reading/writing or No “at least three methods other than main”  

40

No usernames display (at beginning) 10
No usernames display (after saving  new to user.txt) 10
Requirement 4 (not work) 10
Requirement 4 (work but no warning message) 5
Requirement 5 (not work) 10
Requirement 5 (work but no warning message) 5
Requirement 6 (not work) 10
Requirement 6 (work but no warning message) 5
Requirement 7 (not work) 10
Requirement 7 (work but no warning message) 5
No comment  (program head) 4
No comment  (each method) 4

 

Late Work (just for this assignment):  your_points *= (0.6 – late_days * 0.2)

 

 

 


error: Content is protected !!