Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

>> REGISTER NOW TO START POSTING

# Thread: Does anyone know where I can find some info on where to start on this program?

1. ## Does anyone know where I can find some info on where to start on this program?

Assume the tanker is a cylinder of length 19.35 feet and volume 1320 gallons. What is the
diameter in feet of the tanker truck?
To solve this problem, write a Java program to calculate the diameter. For full credit, your
Java application must follow these specifications.
1. The program must interactively input the capacity of the tanker in gallons and its
length in feet. This should be done in the main method of your Tester class.
2. The input data should then be used to construct a TankerTruck object. You will
need to write the TankerTruck class.
3. A TankerTruck method should be used by main to calculate the resulting diameter of
the truck in feet.
4. Your program should use the standard Java constant for the math constant PI.
5. The output should be displayed using fixed-point notation, rounding to one decimal
place of precision

if anyone could help I would greatly appreciate it.  Reply With Quote

3. ## Re: Does anyone know where I can find some info on where to start on this program?

First get the needed equations for solving the problem. Then work on a design for the GUI to get the needed numbers from the user. Then write the code to use use the user's input to solve the equations.  Reply With Quote

4. ## The Following User Says Thank You to Norm For This Useful Post:

Mvxexty1001 (May 6th, 2014)

5. ## Re: Does anyone know where I can find some info on where to start on this program?

I am basically converting a c++ file to java: I am new to java. I am just trying to convert it.

C++ Code

#include <iostream>
#include <cmath>
#include <cstdlib>
#include <iomanip>
using namespace std;

int main()
{

double volume = 0;
double length = 0;
cout << " What is the max volume of water in tanker? : ";
cin >> volume;
cout << " What is the length of the tanker in feet? : ";
cin >> length;

cout << setprecision(1) << fixed;
cout << " The diameter in feet is: " << radius*2 << endl;

system("pause");
return 0;

}  Reply With Quote

6. ## Re: Does anyone know where I can find some info on where to start on this program?

Ok, what parts are you having problems with?  Reply With Quote

7. ## Re: Does anyone know where I can find some info on where to start on this program?

Well I have got this far in the translation: but the user inputs are wrong, and I want to break the program up into a class and a tester.

ex.:
```public class TankerTruck
{

public static int Main()
{

double volume = 0;
double length = 0;
System.out.print(" What is the max volume of water in tanker? : ");
cin >> volume;
System.out.print(" What is the length of the tanker in feet? : ");
cin >> length;

radius = Math.sqrt(volume / length / Math.PI);
System.out.printf("%.1f", " The diameter in feet is: ");
System.out.printf("%.1f", "\n");

system("pause");
return 0;

}
}```  Reply With Quote

8. ## Re: Does anyone know where I can find some info on where to start on this program?

the user inputs are wrong
See the Scanner class for methods to read input from a user.  Reply With Quote

9. ## Re: Does anyone know where I can find some info on where to start on this program?

I am here, where to next?

ex.:
```import java.util.*;

public class TankerTruck
{

public static int Main()
{
Scanner userInputScanner = new Scanner(System.in);
System.out.print(" What is the max volume of water in tanker? : ");
double volume = userInputScanner.nextDouble();
System.out.print(" What is the length of the tanker in feet? : ");
double length = userInputScanner.nextDouble();

radius = Math.sqrt(volume / Length / Math.PI);
System.out.printf("%.1f", " The diameter in feet is: ");
System.out.printf("%.1f", "\n");

system("pause");
return 0;

}
}```  Reply With Quote

10. ## Re: Does anyone know where I can find some info on where to start on this program?

I am here, where to next?
What does the code do now?
Does it compile and execute without any errors?

What does the code need added?  Reply With Quote

11. ## Re: Does anyone know where I can find some info on where to start on this program?  Reply With Quote

12. ## Re: Does anyone know where I can find some info on where to start on this program?

Can you explain?
Is it a problem coding an equation
or is the equation wrong?

Post the contents of the command prompt window showing the input and output and add some comments saying what the output should be.  Reply With Quote

13. ## Re: Does anyone know where I can find some info on where to start on this program?

ex.:
```import java.util.*;
import static java.lang.Math.PI;
import java.lang.*;

public class TankerTruck
{

public static int Main()
{
Scanner userInputScanner = new Scanner(System.in);
System.out.print(" What is the max volume of water in tanker? : ");
double volume = userInputScanner.nextDouble();
System.out.print(" What is the length of the tanker in feet? : ");
double length = userInputScanner.nextDouble();

double radius = PI / volume / length;
System.out.printf("%.1f", " The diameter in feet is: ");
System.out.printf("%.1f", "\n");
}
}```  Reply With Quote

14. ## Re: Does anyone know where I can find some info on where to start on this program?

Does it work now?  Reply With Quote

15. ## Re: Does anyone know where I can find some info on where to start on this program?

No because I don't know what I am doing. I write c++ not java.  Reply With Quote

16. ## Re: Does anyone know where I can find some info on where to start on this program?

If you want to write a java program you will need to learn some java.

If you need help with the code, ask some specific questions about the problems you are having.
If there are error messages, copy the full text of the messages and paste it here.  Reply With Quote

17. ## Re: Does anyone know where I can find some info on where to start on this program?

ex.:
```import java.util.*;
import static java.lang.Math.PI;
import java.lang.*;

public class TankerTruck
{

public static int Main()
{
Scanner userInputScanner = new Scanner(System.in);
System.out.print(" What is the max volume of water in tanker? : ");
double volume = userInputScanner.nextDouble();
System.out.print(" What is the length of the tanker in feet? : ");
double length = userInputScanner.nextDouble();

double radius = PI / volume / length;
double diameter = radius * 2;
System.out.printf("%.1f", " The diameter in feet is : %d%n", diameter);

}```

Its asking for a return statement??? It will not compile.  Reply With Quote

18. ## Re: Does anyone know where I can find some info on where to start on this program?

Its asking for a return statement?
This method definition says the method will return an int value:
` public static int Main()`
The compiler requires that the method have a return statement that returns an int.

Either change the definition of the method to return void
or return an int value.  Reply With Quote