SENG6110 Programming Assignment 1
SMART FARMS - Help to Start
This document aims to provide some initial steps to help you start assignment 1. Note that you do not have to follow these steps exactly. There are many other ways to complete the assignment.
It is suggested that, each time you implement a new method, you test it before proceeding. Bug-finding can be much harder if your code is built on untested methods.
Step 1
Write an initial version of Sensor.java. There is a template available on Canvas that may help. Declare instance variables using the assignment specification. Compile, and fix any errors. Implement some get and set methods. Again, compile, and fix any errors.
Step 2
Write an initial version of Interface.java. There is a template available on Canvas that may help. Test your Sensor class using Interface. Here is some example code:
Scanner console = new Scanner(System.in);
System.out.println("Enter Type: ");
String type = console.nextLine();
Sensors = new Sensor();
s.setType(type);
System.out.println("Type: " + s.getType());
Compile and run. Implement more methods of Sensor, and test them.
After testing, remember to delete the above lines. They were used only for testing.
Step 3
Write an initial version of Farm.java. There is a template available on Canvas that may help. Test your Farm class using Interface.java. Here is some example code.
Scanner console = new Scanner(System.in);
System.out.println("The name of the farm is Farm1 and my lastname: " ) ;
//please put your last name here
String name = “ Farm1LASTNAME”;
Farm f = new Farm();
f.setName(name);
System.out.println("Name: " + f.getName());
Compile and run. Implement more methods of Farm, including ones that add and remove Sensor objects, and test them.
Step 4
Add code to Interface.java that presents a menu of options to the user, and queries for a positive integer. Make the program exit for a certain selected option. Compile and test before proceeding.
Step 5
Add code to your program, implementing each functionality in the assignment specification. Compile, run, and test your program as you go. As stated above, these steps just provide a starting point.
Remember to use the discussion board to post your questions, but DO NOT post your code.