I need help on my final...BIG HELP...!

Can anyone plz help me to program this one?

  • (2 Pages)
  • +
  • 1
  • 2

16 Replies - 1735 Views - Last Post: 12 June 2007 - 10:29 AM Rate Topic: -----

#1 amynguyen  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 05-June 07

I need help on my final...BIG HELP...!

Post icon  Posted 05 June 2007 - 01:30 PM

//create a program that takes in 2 sets of x,y,z coordinates..one being a corner of a 3-dimensional box,
//and the other being the OPPOSITE corner. Your program, when given these sets of values, should display the
//volume and surface area of the box. Your program needs to be coded so that it is displayed in a JFrame with
//JTextAreas ( or some other acceptable text area component) - the volume and Surface Area should be displayed
//in a text box of some sort, and the entry values should also be text boxes of some sort ( for example, similar
//in appearance to a form on a webpage). For extra credit, also implement some JRadioButtons that the user can
//select for units ( for example, inches, centimeter, ect...) and have the volume and surface area display the
//correct units in the answer, ( ex: 345 inches cubed or 345 cubic inches ) the volume and surface area should
//update when the user changes the text areas that contain the point information....Your program must use oo design
//standards. I would code a "BOx" class (or something similar named) to represent the box, it should have a constructor
//initialize the box to the starring point values, and it should have methods to calculate the volume and surface area.
//Then have another seperate class to worry about the user interface stuff in a main method.

Is This A Good Question/Topic? 0
  • +

Replies To: I need help on my final...BIG HELP...!

#2 THE_RAM  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 30-March 07

Re: I need help on my final...BIG HELP...!

Posted 05 June 2007 - 02:13 PM

I can't tell exactly where your problem is, because you have not shown at least the bit which you have done.Please try doing that.
Was This Post Helpful? 0
  • +
  • -

#3 alpha02  Icon User is offline

  • Sexy DIC God
  • member icon

Reputation: 47
  • View blog
  • Posts: 803
  • Joined: 20-May 06

Re: I need help on my final...BIG HELP...!

Posted 06 June 2007 - 09:12 AM

Please show me your code and create the GUI yourself, then I will be glad to give you the formulas to find the information you need. GUI tutorials are available in the Tutorials section.
Was This Post Helpful? 0
  • +
  • -

#4 amynguyen  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 05-June 07

Re: I need help on my final...BIG HELP...!

Posted 07 June 2007 - 12:54 PM

View Postalpha02, on 6 Jun, 2007 - 09:12 AM, said:

Please show me your code and create the GUI yourself, then I will be glad to give you the formulas to find the information you need. GUI tutorials are available in the Tutorials section.


import java.awt.*;
import javax.swing.*;
import java.awt.geom.*;
import java.awt.event.*;

public class Final extends JFrame
{
	public Final()
	{
		setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
	}

	public static void main(String[] args)
	{
		Final app = new Final();
		app.setSize(500,500);
		app.setVisible(true);
		app.setTitle("Final box");
	}

	class box
	{
		Array point1 [3][1];
		Array point2 [3][1];

		box(Array p1[3][4], Array p2[3][1])
		{
			Array point1 [3][1] = Array p1[3][1];
			Array point2 [3][1] = Array p2[3][1];
		}

		volume()
		{
			int h;
			int v;
			int l;
			int w;
			h = point[2][1] - point[2][1];
			l = point[2][1] - point[2][1];
			w = point[2][1] - point[2][1];
			v = h*w*l
		}

		sa()
		{
			int sa;
			int h;
			int l;
			int w;
			h = point[2][1] - point[2][1];
			l = point[2][1] - point[2][1];
			w = point[2][1] - point[2][1];

			sa = ((2 * l * w)(2 * w * h)(2 * l * h));

		}
	}

This post has been edited by William_Wilson: 07 June 2007 - 01:04 PM

Was This Post Helpful? 0
  • +
  • -

#5 alpha02  Icon User is offline

  • Sexy DIC God
  • member icon

Reputation: 47
  • View blog
  • Posts: 803
  • Joined: 20-May 06

Re: I need help on my final...BIG HELP...!

Posted 07 June 2007 - 01:02 PM

Can you please comment the code, explain what each variable does and what are your methods used for?
Was This Post Helpful? 0
  • +
  • -

#6 William_Wilson  Icon User is offline

  • lost in compilation
  • member icon

Reputation: 205
  • View blog
  • Posts: 4,807
  • Joined: 23-December 05

Re: I need help on my final...BIG HELP...!

Posted 07 June 2007 - 01:03 PM

You still have not supplied us with a problem or error msg.
Remember to use [code] tags around ALL code.

This is a final project, needs BIG help, and has a beginner label... I love it.
Was This Post Helpful? 0
  • +
  • -

#7 amynguyen  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 05-June 07

Re: I need help on my final...BIG HELP...!

Posted 07 June 2007 - 01:08 PM

View PostWilliam_Wilson, on 7 Jun, 2007 - 01:03 PM, said:

You still have not supplied us with a problem or error msg.
Remember to use [code] tags around ALL code.

This is a final project, needs BIG help, and has a beginner label... I love it.


sorry..im a beginner, and my program is like this
when you put in three numbers and 1 for the length one for height and one for width...my program suppose to calculate out the volume and the surface area....
Was This Post Helpful? 0
  • +
  • -

#8 William_Wilson  Icon User is offline

  • lost in compilation
  • member icon

Reputation: 205
  • View blog
  • Posts: 4,807
  • Joined: 23-December 05

Re: I need help on my final...BIG HELP...!

Posted 07 June 2007 - 01:10 PM

i understand what it is supposed to do.... but what IS it doing?
Was This Post Helpful? 0
  • +
  • -

#9 amynguyen  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 05-June 07

Re: I need help on my final...BIG HELP...!

Posted 07 June 2007 - 01:13 PM

View PostWilliam_Wilson, on 7 Jun, 2007 - 01:10 PM, said:

i understand what it is supposed to do.... but what IS it doing?


What do you mean by "What is it doing ?" sowie....;-)
Was This Post Helpful? 0
  • +
  • -

#10 Programmist  Icon User is offline

  • CTO
  • member icon

Reputation: 252
  • View blog
  • Posts: 1,833
  • Joined: 02-January 06

Re: I need help on my final...BIG HELP...!

Posted 07 June 2007 - 01:17 PM

View Postamynguyen, on 7 Jun, 2007 - 01:13 PM, said:

View PostWilliam_Wilson, on 7 Jun, 2007 - 01:10 PM, said:

i understand what it is supposed to do.... but what IS it doing?


What do you mean by "What is it doing ?" sowie....;-)


He means what error messages or wrong output are you getting?
Was This Post Helpful? 0
  • +
  • -

#11 amynguyen  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 05-June 07

Re: I need help on my final...BIG HELP...!

Posted 07 June 2007 - 01:21 PM

C:\Documents and Settings\Nguyen_thanh\My Documents\final1.java:23: ']' expected
Array point1 [3][1];
^
C:\Documents and Settings\Nguyen_thanh\My Documents\final1.java:24: ']' expected
Array point2 [3][1];
^
C:\Documents and Settings\Nguyen_thanh\My Documents\final1.java:26: ']' expected
box(Array p1[3][4], Array p2[3][1])
^
C:\Documents and Settings\Nguyen_thanh\My Documents\final1.java:57: ')' expected
}
^
C:\Documents and Settings\Nguyen_thanh\My Documents\final1.java:58: '}' expected
^

that is what i got when i try to compiled it
Was This Post Helpful? 0
  • +
  • -

#12 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,507
  • Joined: 12-July 02

Re: I need help on my final...BIG HELP...!

Posted 07 June 2007 - 04:28 PM

		Array point1 [3][1];
		Array point2 [3][1];

		box(Array p1[3][4], Array p2[3][1])
		{
			Array point1 [3][1] = Array p1[3][1];
			Array point2 [3][1] = Array p2[3][1];
		}


Can you explain what you are trying to do here? Create two dimensional arrays? If so, of what data type? Or are you attempting to use the Array class?
Was This Post Helpful? 0
  • +
  • -

#13 spullen  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 10
  • View blog
  • Posts: 356
  • Joined: 22-March 07

Re: I need help on my final...BIG HELP...!

Posted 08 June 2007 - 04:09 PM

View Postamynguyen, on 7 Jun, 2007 - 01:08 PM, said:

sorry..im a beginner, and my program is like this
when you put in three numbers and 1 for the length one for height and one for width...my program suppose to calculate out the volume and the surface area....


OK, so what's the volume, for instance:
public double volume(double w, double l, double h){
		  return l * w * h;
}


Easy as that, and then you just need to make a method to compute the surface area. I don't see where arrays would come into play here with your problem. Unless you are suppose to get points to make rectangles or something (in x, y coordinates), plus I recommend looking up what an array is and how to use it because it seems like you haven't learned anything in your class.
Was This Post Helpful? 0
  • +
  • -

#14 alpha02  Icon User is offline

  • Sexy DIC God
  • member icon

Reputation: 47
  • View blog
  • Posts: 803
  • Joined: 20-May 06

Re: I need help on my final...BIG HELP...!

Posted 08 June 2007 - 09:25 PM

Here are some codes to get you started:

public double volume(double w, double l, double h){
		  return l * w * h;
}

public double surface(double w, double l, double h){
		  return 2*(w*l)+2*(w*h)+2*(l*h);
}

public double[] getOppositeVertex(double x, double y, double z, double w, double l, double h){
		  return new double[]{
				  x+w,
				  y+l,
				  z+h
		  };
}

Was This Post Helpful? 0
  • +
  • -

#15 amynguyen  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 05-June 07

Re: I need help on my final...BIG HELP...!

Posted 11 June 2007 - 07:42 AM

thx for helping me...
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2