Skip to content

Programming Exercise 1

thebluedirt edited this page Oct 10, 2022 · 1 revision

This exercise is important preparation for the Precision Driving challenge

You're expected to work on it outside practice. Practice is for getting help, and/or learning about the ROMI

In PE1, you'll learn:

*basic Java *using gradle to build and run tests *basic unit testing *basic github *basic object oriented programming

##You cannot compete in the Precision Driving challenge unless you've turned in PE1

Problem Defintion

Write a simple program that computes the perimeter and area of various shapes. Given that a Point is an x and y coordinate, your code must handle these shapes:

  • Circle ( given radius r and a Point for the center )
  • Square (given Point of center and length of a side) *Rectangle ( given Point of bottom left and top right corner)
  • Triangle (given all three corners as Points)

You must also supply unit tests that prove that your code works!

##You must check your solution into github::entech281/2022Training repo as a branch named solution_

Programming Tests

c = Circle(1, new Point ( 0.0, 0.0));
assertEquals ( c.area(), Math.PI, 0.0001 );
assertEquals ( c.perimeter(), .. );
assert????? ( new Circle ( -1, new Point(0,0)))

Clone this wiki locally