0

hey guys, ok ive got a program ive got to hand in fast, practicaly works just got to errors so a quick reply would be greatly appreciated.

import java.util.*;
import java.io.*;

class Assignment7{
	public static void main(String[] args)throws Exception{
			
		File input1 = new File (args[0]);
		File input2 = new File (args[1]);
		File input3 = new File (args[2]);
		Scanner reader1 = new Scanner(input1);
		Scanner reader2 = new Scanner(input2);
		Scanner reader3 = new Scanner(input3);
		

		Point[] PointArray = new Point[25];
		Vector[] VectorArray = new Vector[35];
					

		for (int i = 0; i < 25; i++){
			String moveLine = reader1.nextLine();
			String[] value = null;
			value = moveLine.split(" ");
			int x = Integer.parseInt(value[0]);
			int y = Integer.parseInt(value[1]);
			PointArray[i] = new Point(x,y);
		}
		
		for (int i = 0; i < 35; i++){
			String moveLine = reader2.nextLine();
			String[] value = null;
			value = moveLine.split(" ");
			int x = Integer.parseInt(value[0]);
			int y = Integer.parseInt(value[1]);
			VectorArray[i] = new Vector(PointArray[x],PointArray[y]);
		}
		
		for (int i = 0; i < 10; i++){
			String moveLine = reader3.nextLine();
			String[] value = null;
			value = moveLine.split(" ");
			int x = Integer.parseInt(value[0]);
			int y = Integer.parseInt(value[1]);
			int z = Integer.parseInt(value[2]);

				
			if(i < 5){
				int a = Integer.parseInt(value[3]);
				Rec obj1 = new Rec (VectorArray[x], VectorArray[y], VectorArray[z], VectorArray[a]);
				System.out.println("The area is " + obj1.getarea() + " The perimeter is " + obj1.getperimeter());
			}	
			
			else{
				Tri obj2 = new Tri(VectorArray[x], VectorArray[y], VectorArray[z]);
				System.out.println("The area is " + obj2.getarea() + " The perimeter is "  + obj2.getperimeter());
				}
		}
	}
}

and the errors are ,

Assignment7.java:48: cannot find symbol
symbol : constructor Rec(Vector,Vector,Vector,Vector)
location: class Rec
Rec obj1 = new Rec (VectorArray[x], VectorArray[
y], VectorArray[z], VectorArray[a]);
^
Assignment7.java:53: cannot find symbol
symbol : constructor Tri(Vector,Vector,Vector)
location: class Tri
Tri obj2 = new Tri(VectorArray[x], VectorArray[y
], VectorArray[z]);

3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by Ezzaral
0

change name of your class (line 16) Vector[] VectorArray = new Vector[35]; to avoid confusion with library class java.util.Vector

0

The errors are pretty clear. You're trying to use constructor signatures that don't exist for those classes. You need to examine the parameters for those constructors and use correct form.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.