Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Jphillippe

macrumors regular
Original poster
Oct 15, 2007
214
0
Miami, Florida
Hey Guys, I'm taking a java programming class for Fall 2010 and I have to answer this problem to see at what level I would be classified as...this is for practice only..any help appreciated since I don't know where to begin.


:apple:




You are required to write a program that can be used to convert imperial measurements into metric measurements. Write a class called ConversionCalculator. The class accepts two quantities:
• A letter in indicating whether the measurement is in pounds (p/P), yards (y/Y), or Fahrenheit (f/F).
• A numeric quantity that must be converted, which must be converted to Newton, meters, and kilometers, respectively.

Imperial Metric
1Pound 4.9 Newtons
1 Foot 0.3048 Meters
1 degree Fahrenheit -17.22 Celsius
The rule formula converting the temperature is: celsius = 5/9*(Fahrenheit - 32.0);
Use the switch statement to determine the measurement whether it is in pounds, yards, or Fahrenheit in order to carry out the conversion. I have started the test class for you.
class TestConversionCalculator
{
public static void main(String[] arg)
{
char ch = GetData.getCharacter("Enter a character denoting the type of measurement);
double amount = GetData.getDouble("Enter the measurement to be converted);
ConversionCalculator cc = new ConversionCalculator(ch, amount);
cc.convert();
// display the output
}
}



:apple:



if anyone would provide me with any help I would appreciate it.....
 
If you don't know how to answer this yourself it would probably be beneficial to actually say that and be put in a class which helps you more. What would the point be of someone here helping you and then you getting classified as having greater ability than you do and you struggling for the rest of the course?

I'm sure the rest of the course will get you on the right level by the end of it.
 
If you don't know how to answer this yourself it would probably be beneficial to actually say that and be put in a class which helps you more. What would the point be of someone here helping you and then you getting classified as having greater ability than you do and you struggling for the rest of the course?

I'm sure the rest of the course will get you on the right level by the end of it.

I agree but this isn't for a placement class it's to
for the teacher to see at what level is each student. This is for an intro to java highschool course I just need someone who knows how o solve problem so I can compare to what i can come up with once I get knowledge on subject and I can compare...I've attempted something but kind of embarrassd to
show since lots of rules don't coincide.
 
I agree but this isn't for a placement class it's to
for the teacher to see at what level is each student. This is for an intro to java highschool course I just need someone who knows how o solve problem so I can compare to what i can come up with once I get knowledge on subject and I can compare...I've attempted something but kind of embarrassd to
show since lots of rules don't coincide.

If we show you a perfect solution then your teacher will think you are at a higher level than you are and you will not get the teaching you require. Hand in what you have, don't try and pretend you know more than you do. It'll hurt you more in the end.
 
Why don't you make the attempt and then post the code here with any questions you might have.

I think that's a better avenue than asking for the answer. At least this way we know your trying!

In the future, when you paste source code in the forum, put it between [ code ] and [/ code ] tags (without the spaces) and this way it will remain formatted and scrollable so it doesn't look like a mess.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.