Escolar Documentos
Profissional Documentos
Cultura Documentos
The aim is to get each of the three C# programs converted to Java and running as Java
projects in NetBeans. Skeleton projects have been provided. More detailed instructions are
given below.
1. HelloDogs from week 3 of AWD
1.1Download the zipped C# and Java projects and unzip them in separate folders.
1.2Start Visual Studio and NetBeans (NetBeans is on the Start Menu under Programming>Java) and open the two projects (File->Open Project in NetBeans).
1.3In NetBeans open the skeleton classes for Dog.Java and DogChorus.java.
1.4In Visual Studio open Dog.cs. Select all the code from within the Dog class and copy
and paste it into the Java Dog class.
1.5Make the changes to the code in Dog.java so that it will compile as a Java class.
1.6Do the same for DogChorus i.e. copy the code in the DogChorus class in DogChorus.cs
from Visual Studio into the corresponding Java class in NetBeans and convert the code.
1.7Check that there are no errors by cleaning and building the project in NetBeans. To do this
you can right-click the project name in the Projects panel and select Clean and Build.
Any error messages will appear in the Output panel at the bottom.
1.8If there are no errors run the project. You can do this by right-clicking the project name
and selecting Run. This will execute the main() method in the class HelloDogs. This
creates an instance of DogForm which provides the GUI for the program. With luck the
program will run and behave in a similar way to the equivalent C# program.
1.9Note that if you double click DogForm.java it will open in the GUI builder where you can
create Java in a similar way to in Visual Studio.
2.3OPTIONAL EXERCISE If you are interested do the same for the web application. The
NetBeans web project is called CatExampleWithInheritanceJavaWebSkeleton. This time
when you run the application it will start a web server plugged in to NetBeans and a web
browser to access the web application. The GUI is defined in the Java Sever Page (JSP) file
called index.jsp in the Web Pages folder. Note that JSP is outside the scope of this course
and this version is just provided for your interest.
3.2OPTIONAL EXERCISE If you are interested do the same for the web application. The
NetBeans web project is called GenericsExampleJavaWebSkeleton.