Results 1 to 20 of 20
Thread: Dirt Track Volume
- 09-27-2012, 05:16 PM #1
Member
- Join Date
- Sep 2012
- Posts
- 20
- Rep Power
- 0
Dirt Track Volume

Below is what I have completed until now but I am doing a test case and not getting the correct volume. If someone could help me out as to what I am doing wrong here it would be great.
Java Code:import java.util.Scanner; public class A1Q4 { /** * Calculate the volume required to cover the track */ public static void main( String[] args ) { // SET UP KEYBOARD INPUT Scanner keyboard = new Scanner( System.in ); // DECLARE VARIABLES/DATA DICTIONARY double rLength = 0; double rWidth = 0; double tWidth = 0; double depth = 0; double clayVolume = 0; // Read in the given values System.out.print ("Please enter the width of the rectangle part of the inner field in meters: "); rWidth = keyboard.nextDouble(); System.out.print ("Please enter the length of the rectangle part of the inner field in meters: "); rLength = keyboard.nextDouble(); System.out.print ("Please enter the width of the track in meters: "); tWidth = keyboard.nextDouble(); System.out.print ("Please enter the desired depth of clay in centimeters: "); depth = keyboard.nextDouble(); // Call method to compute the volume of clay needed. clayVolume = findClayVolume (rLength, rWidth, tWidth, depth); // Diplay the result System.out.println ("\nThe volume of clay needed to cover the track is " + clayVolume + " cubic metres"); } /** * Description: include a description of the problem * solving method (algorithm). * Parameters (GIVENS): */ private static double findClayVolume(double rLength, double rWidth, double tWidth, double depth) { // Declaration of the result variable double clayVolume = 0; // Declaration of the intermediate variables double innerTrackVolume = 0; double wholeTrackVolume = 0; double depthInM = 0; // Add code for the method // Convert the depth in m depthInM = depth/100; // Calculate the inner track volume innerTrackVolume = (rLength*rWidth*depthInM) + (4/3)*(Math.PI*Math.pow((rWidth/2),3)); //*(rWidth/2)*(rWidth/2)); // Calculate the whole track volume wholeTrackVolume = (rLength*(rWidth + 2*tWidth)*depthInM) + (4/3)*(Math.PI*Math.pow(((rWidth + 2 * tWidth)/2),3)); //*((rWidth + 2 * tWidth)/2)*((rWidth + 2 * tWidth)/2)); // Calculate the track volume by subtracting whole track from inner track clayVolume = wholeTrackVolume - innerTrackVolume; // Return the result return clayVolume; } }
- 09-27-2012, 06:37 PM #2
Re: Dirt Track Volume
Could you post what is on the console including what is entered and the results from the program and add some comments to it saying what the correct volume is?not getting the correct volumeIf you don't understand my response, don't ignore it, ask a question.
- 09-27-2012, 06:57 PM #3
Member
- Join Date
- Sep 2012
- Posts
- 20
- Rep Power
- 0
Re: Dirt Track Volume
The console output:
Please enter the width of the rectangle part of the inner field in meters: 300
Please enter the length of the rectangle part of the inner field in meters: 400
Please enter the width of the track in meters: 20
Please enter the desired depth of clay in centimeters: 70
The volume of clay needed to cover the track is 4842969.501221102 cubic metres
What the answer should be:
The volume of clay needed to cover the track is 25274.335088082244 cubic meters
Thanks for helping me out :)
- 09-27-2012, 07:05 PM #4
Re: Dirt Track Volume
Where did you get the correct answer?
Can you write formulas for computing the surface area for each section of the track?
If the straight sections were removed and the ends slide together, would the shape be a circle?If you don't understand my response, don't ignore it, ask a question.
- 09-27-2012, 07:21 PM #5
Member
- Join Date
- Sep 2012
- Posts
- 20
- Rep Power
- 0
Re: Dirt Track Volume
Yes, if you remove the two straight lines you will get two semicircles which you can combine to form a circle. The formulas were not given, I calculated the area by myself. This is what I did. First, I thought that if I get the volume of the inner track and find the volume of the whole track and do wholeTrackVolume - innerTrackVolume I would get the volume of the track that I want. Below is what I did to find the volume of inner track and whole track.
Inner Track:
To find the volume of the inner track I got the volume of the inner rectangle and added it to the volume of the two inner semicircles. So I know the volume of the rectangle is rLength * rWidth * depthInM (I converted depth from cm to m so all units match). To get the volume of the circle, I did (4/3)(PI*r^3). I added the volume of the rectangle and the volume of the circle to get the volume of the inner track.
Outer track:
I basically did the same thing except the width of the rectangle was rWidth + 2*tWidth. Also, to get the radius of the circle, instead of dividing rWidth by 2, I had to add tWidth*2 + rWidth then divide by two. When I added the two volumes I got the volume of the outer rectangle.
Then, as I said before, I did wholeTrackVolume - innerTrackVolume to get the volume that I need.
Please let me know if something does not make sense, I will try to explain it better.
Thanks
Edit: correct answer was given, I did not calculate it.
- 09-27-2012, 07:35 PM #6
Re: Dirt Track Volume
Are you covering the inner area? Or just the track part that is tWidth wide?
Can you write the formulas for each section you are computing the area of? Just the formulas.If you don't understand my response, don't ignore it, ask a question.
- 09-27-2012, 07:44 PM #7
Member
- Join Date
- Sep 2012
- Posts
- 20
- Rep Power
- 0
Re: Dirt Track Volume
I want to cover just the track part so yes, the part that is tWidth wide. I am not computing area, I am computer volume.
innerTrackVolume = (rLength*rWidth*depthInM) + (4/3)(PI*((rWidth/2)^3)
wholeTrackVolume = (rLength*(rWidth+2*tWidth)*depthInM) + (4/3)(PI*((rWidth+(2*tWidth))/2)^3)
Let me know if you need me to explain anything.
- 09-27-2012, 07:46 PM #8
Re: Dirt Track Volume
Not sure what you are computing.
I see the area as the sum of 2 rectangles and the difference between an outer circle and an inner circle.If you don't understand my response, don't ignore it, ask a question.
- 09-27-2012, 07:53 PM #9
Member
- Join Date
- Sep 2012
- Posts
- 20
- Rep Power
- 0
Re: Dirt Track Volume
Oh, I just understood what you said. Let me try it out and ill see what happens. Thanks for your help :)
- 09-27-2012, 08:06 PM #10
Member
- Join Date
- Sep 2012
- Posts
- 20
- Rep Power
- 0
Re: Dirt Track Volume
So, as you suggested I added the two rectangle volumes. Then I took the large circle and subtracted by smaller one. I added the circle and rectangle but I am still getting the same answer so I guess it didn't matter which way I used to get the volume. I guess there is something wrong with my circle track, maybe I am doing something wrong to calculate its volume. Let me know if you find something.Java Code:rectangleTrack = (rLength*tWidth*depthInM)*2; circleTrack = (4/3)*(Math.PI*Math.pow(((rWidth + (2 * tWidth))/2),3)) - (Math.PI*Math.pow((rWidth/2),3)); clayVolume = circleTrack + rectangleTrack;
- 09-27-2012, 08:29 PM #11
Re: Dirt Track Volume
What is the equation for the area of a circle?
If you don't understand my response, don't ignore it, ask a question.
- 09-27-2012, 08:57 PM #12
Member
- Join Date
- Sep 2012
- Posts
- 20
- Rep Power
- 0
- 09-27-2012, 09:05 PM #13
Re: Dirt Track Volume
What shape are you calculating the volume of?
A circle does not have a volume. It is two dimensional. A sphere has a volume. A circle has an area.volume of a circleIf you don't understand my response, don't ignore it, ask a question.
- 09-27-2012, 09:56 PM #14
Member
- Join Date
- Sep 2012
- Posts
- 20
- Rep Power
- 0
- 09-27-2012, 10:07 PM #15
Re: Dirt Track Volume
Why?I am calculating the volume of the sphere
Have you ever seen or been to a race track? They are basically two dimensional. I've never seen one that looks like a sphere. Maybe for some kind of motorcycle sport.If you don't understand my response, don't ignore it, ask a question.
- 09-27-2012, 10:10 PM #16
Member
- Join Date
- Sep 2012
- Posts
- 20
- Rep Power
- 0
- 09-27-2012, 10:15 PM #17
Member
- Join Date
- Sep 2012
- Posts
- 20
- Rep Power
- 0
Re: Dirt Track Volume
So this is what I did:
I got a output: The volume of clay needed to cover the track is 31306.192982974666 cubic metresJava Code:circleTrack = (Math.PI*Math.pow(((rWidth + (2 * tWidth))/2),2)) - (Math.PI*Math.pow((rWidth/2),2));
That is sort of closer to the expected result but still there is something wrong. Let me know if you find anything else. Thanks for your help.
- 09-30-2012, 02:05 AM #18
Member
- Join Date
- Sep 2012
- Posts
- 1
- Rep Power
- 0
Re: Dirt Track Volume
you are meant to calculate the area of a cylinder..... like you use Pi * (r)^2 * h to find the volume of the semi-circle... if you have any more problems i'll check back.
- 09-30-2012, 02:15 AM #19
Re: Dirt Track Volume
@v1ru5
Break the large expression up into a list of small simple steps that do one thing at a time. Putting it all into ONE expression is both hard to read and understand and makes it harder to debug.
With that technique ( 7 steps) I got: vol=25274.335088082265If you don't understand my response, don't ignore it, ask a question.
- 09-30-2012, 02:21 AM #20
Member
- Join Date
- Sep 2012
- Posts
- 20
- Rep Power
- 0
Similar Threads
-
Area and Volume help
By gioeco in forum New To JavaReplies: 10Last Post: 05-13-2012, 04:02 AM -
Control volume
By calippus in forum New To JavaReplies: 0Last Post: 10-31-2011, 02:17 PM -
Volume of Intersection
By afifi in forum Advanced JavaReplies: 0Last Post: 01-07-2011, 10:42 AM -
Volume of AudioClip
By Fedor in forum New To JavaReplies: 0Last Post: 04-25-2009, 04:16 PM -
Track download
By nilesh.malode in forum Advanced JavaReplies: 1Last Post: 07-13-2007, 09:44 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks