Threesuns

Email the Instructor

Contact

All Semesters

Semesters

All Courses

Courses

2017Spring

01.09.17 - 05.07.17

Introduction to Computer Programming

CSYS1203

Tuesday Thursday
01:00 PM - 02:20 PM

Rename a File

Lab05

Objective: To practice with nested programming structures

pastdue

Submit Your Solution

Lab05

Request a Copy of your Solution

Lab05

Requirements

Pseudocode is structured and in proper form15 pts
Program allows required prompts and inputs5 pts
All required validations are performed correctly20 pts
Specific and informative error messages are displayed when validations fail10 pts
Total50 pts

Instructions

For this lab the goal is to design a program using pseudocode that has the ability to safely rename a file.

Available Commands

We can assume that our program will have a "change" command that can be given an existing filename and a new name and can then cause the filename to become the new name.

For example, we might have a file called test1.txt and we want to change it's name to sample.txt. We could, in our program design, say "change test1.txt to sample.txt" and the program would change the name of the file for us. Either of the two names could be represented with variable data.

Our program will also have the ability to tell if a specific name already exists. For example, "x1 exists?" would give a boolean value. Again, the filename used could be variable.

Validation

For our program to make the process of renaming a file safe, we need for it to not allow the user to rename a file in four situations.

  • When the original file name doesn't exist (name given but there is no file in existence by that name)
  • When the new file name does exist (there is already a file with that name so renaming the file will cause a collision)
  • When the original file name is blank (ambiguous, we don't know what to rename from)
  • When the new file name is blank (ambiguous, we don't know what to rename to)

If any of these conditions are found to exist the program should display a specific and informative error message and then exit. The user will NOT be give a second opportunity to enter the information. (no loops)

If none of those conditions exist then the filename should be changed.