Java求助帖,学校作业,求助大佬们

Java求助帖,学校作业,求助大佬们

标题

In this assignment, you will create the Shape and Point classes to answer questions about a Shape that is made up of a collection of points from the x-y plane, as shown in this lesson. The shape is defined by drawing a line between two adjacent points, for every pair of adjacent points, and also a line between the first and last point.

Create class Point

This class must contain two fields with x and y 

Create constructor that accepts two arguments x and y

Create setter and getter functions for x and y

Create function distance that accepts another point and return distance between two points

Create class Shape

This class must contain field points that stores all points of the shape

Create addPoint function that accepts a Point and add it to a field points

Create getPoints that return points

 Create calculatePerimeter function that calculate perimeter of the shape

 Create function that returns that longest side of the shape

 Create function that returns average length of all sides

 Create class AssignmentOne, read all points from the file

 Create objects of Point and Shape classes

 Check every function from Point and Shape classes

points:

file1.txt

-3, 9

-8, 7

-12, 4

-6, -2

-4, -6

2, -8

6, -5

10, -3

8, 5

4, 8

file2.txt

-4, -3

4, -2

12, 2

6, 5

-3, 3

-8, 1

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值