Java Lab 13
Java Lab 13
Create a new Java file (empty Java file), save it to your H: drive, call it lab13
Insert the following code to set up your program:
Be sure to copy the test text files to the location where you saved your Java file
import java.util.Scanner;
import java.io.*;
fw.close();
100pt:
You are going to make a character creator for a role playing game. You will write a program which will let the user
determine the following traits of their new character:
1) Name
2) Age
3) Strength
4) Intelligence
5) Dexterity
The user choices for these must be saved into a text document, in a specific format. If they aren’t saved correctly,
the save will be corrupted and all the user’s hard work will be for nothing!
firstname=Ian
secondname=Edgeley
age=30
strength=4
intelligence=1
dexterity=5
There are important boundaries on user choices:
- Character names must be longer than 3 letters and shorter than 20. The user must enter the name as
one input which is then split for the file.
- Age must be between 1 and 200 (hey, I don’t know how long orcs live)
- The combination of strength, intelligence and dexterity must not exceed 10.
The user must be able to continue to enter information until they provide an acceptable answer.
Notes: