CS 115 / IT 115 Java Programming 2
Programming
Assignment 2
For this assignment, we
will work with the SysInventory program we are/will
be discussing in class; see the provided files.
Here is a run of the provided system. Output like this is what I mean by the results of “interactive tests”.
Welcome to Departmental Network Systems
Enter how many systems: 2
Enter the system's room no: 10
System is assigned number 1
Enter the system's room no: 20
System is assigned number 2
Enter system inventory number, 0 to quit: 2 ß for #4 Enter id number or room number preceded by “room”
System 2 selected
Actions: exit, help, print, record-problem
Enter action: print
ITSystem@1a758cb ß note useless toString() output: fix this in #1.
Enter action: record-problem
The system now has 1 recorded problems
Enter action: help
Actions: exit, help, print, record-problem
Enter action: exit
Enter system inventory number, 0 to quit: 0
Goodbye from Departmental Network Systems
After this edit, the system should
run (after same setup, so only one system in the same room):
Enter system inventory number, 0 to quit: 2
System 2 selected
Actions: exit, help, print, record-problem, in-same-room
Enter action: in-same-room
Systems in the
same room as system 2:
Id 2 room 20
problems 0 (toString
output for system 2, can be different in detail)
Enter Action: …
This can be one “interactive test”
result, but clearly we need to test with multiple systems in the same room for
full testing.
Enter system inventory number, 0 to quit: 2
System 2 selected
Actions: exit, help, print, record-problem, in-same-room, move
Enter action: move
Enter room
for system 2 to move to: 10
Systems now
in old room 20:
None
Systems now
in new room 10:
Id 1 room 10
problems 0
Id 2 room 10
problems 0
Enter Action: …
In the case of the original setup,
no move later, the room number simply specifies a system, like this:
Enter system inventory number, 0 to quit, or room
<n>: room 10
System 1 selected
Actions: exit, help, print, record-problem, in-same-room, move
In the case of the original setup
followed by the move specified above in 3, the room number selects 2 systems,
and we need the user to choose between them, like this:
Enter system inventory number, 0 to quit, or room
<n>: room 10
Room 10 has 2 systems:
Id 1 room 10
problems 0
Id 2 room 10
problems 0
Enter system inventory number from above list, 0 to quit: 2
System 2 selected
Actions: exit, help, print, record-problem, in-same-room, move
Create a subdirectory p2 (not P2) in your it115 subdirectory on your CS Unix
network account, and transfer a copy of your resulting Java files and narrative
there, in plain text file memo.txt
Delivery files: Make sure the names are the same as specified here, including their case (Not Memo.txt for example)
1. ITSystem.java with added toString() method, and possibly another method.
2. SysInventory.java with added code as specified above. Make helper methods so as to avoid duplicating code.
3. SystemInventoryMain.java: needs no change.
4. memo.txt, with interactive tests shown.