Skip to main content Skip to local navigation

VPL, Vectors and Java

This is an example exercise in VPL. Grade is out of 1. All the students have to do is uncomment the creation of the MathVector object.

The VPL “run” tab should output the results of the two tests run by JUnit.

Want to reproduce this example?

  • PreLabC.java (the template for the student to work on)
  • solution.txt (what the student’s solution _could_ look like)
  • MathVector.java (the class with all the methods that the student should explore)
  • MyTest.java (the JUnit testing file. Student can use this on their own computer if they wish)
  • Main.java (internal to VPL for setting up the test. Student doesn’t need this.)
  • vpl_run.sh (internal to VPL for setting up the test. Student doesn’t need this.)
  • vpl_evaluate.sh (internal to VPL for setting up the test. Student doesn’t need this.)
To complete this activity, the student simply needs to uncomment one of these two object creation sections.

If you’re setting up this activity on your own VPL machine, don’t forget to add the name of the local VPL server to your activity so that it runs in your own department. Also, you likely will need to modify the scripts (.sh) to point to your installation of Java.


a pen

James Andrew Smith is a Professional Engineer and Associate Professor in the Electrical Engineering and Computer Science Department of York University’s Lassonde School, with degrees in Electrical and Mechanical Engineering from the University of Alberta and McGill University.  Previously a program director in biomedical engineering, his research background spans robotics, locomotion, human birth and engineering education. While on sabbatical in 2018-19 with his wife and kids he lived in Strasbourg, France and he taught at the INSA Strasbourg and Hochschule Karlsruhe and wrote about his personal and professional perspectives.  James is a proponent of using social media to advocate for justice, equity, diversity and inclusion as well as evidence-based applications of research in the public sphere. You can find him on Twitter. Originally from Québec City, he now lives in Toronto, Canada.