(Science: wind- chill temperature) How cold is it outside? The temperature alone in not enough to provide an answer. Other factors including wind speed, relative humidity, and sunshine play important roles in determining coldness outside. In 2001, the National Weather Service (NWS) implemented the new wind chill temperature to measure the coldness using temperature and wind speed. The formula is given as follows:
Twc = 35.74 + 0.6215ta – 35.75v0.16 +0.4275tav0.16

Where ta is the outside temperature measured in degrees Fahrenheit and v is the speed measured in miles per hour. Twc is the wind chill temperature. The formula cannot be used for wind speeds below 2 mph or temperatures below -58 F or above 41 F.
Write a program that prompts the user o enter a temperature between -58 F and 41 F and a wind speed greater than or equal to 2 and displays the wind chill temperature. Use Math.pow(a, b) to compute v0.16

SO FAR THIS IS WHAT I HAVE:

package windchilltemperature;
import java.util.Scanner;
/**
 *
 * @author HP_Owner
 */
public class WindChillTemp {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        double OutsideTemperature = -58;
        double ta;
        double v;
        double speed;
        double WindChillTemperature = 35.74 + (0.6215 * ta) - 35.75 *Math.pow(v,0.16) + 0.4275 * ta * Math.pow(v, 0.16);

        Scanner input = new Scanner(System.in);

        //Enter Temperature in Fahrenheit, between -58F and 41F
        System.out.print("Enter a temperature in F between -58F and 41F");

        //Enter Wind Speed greater or equal to 2
        System.out.print("Enter Wind Speed greater or equal to 2");
        

        //Calculate Wind Chill Temperature

        //Display Results
        System.out.println("The Wind Chill Temperature is" + WindChillTemperature);

I DON'T GET WHAT I'M DOING WRONG!!!
ANY HELP WOULD BE APPRECIATED!
THANKS IN ADVANCE

you might want to elaborate a bit ...
for instance, what is it you think your code should be doing, and I don't mean the original assignment, because I can tell from miles away you haven't got any input in there, if that's the question.

ask more specific, like, why doesn't my input work, rather than, guess what, this is my assignment, I don't get it, fix it.

we're volunteers here, doesn't mean we have the time to study each problem in depth and provide quality stuff (even if we wanted to).

you really should put more effort in it because:

1. for us, this is not URGENT at all
2. if this is URGENT for you, maybe you should've paid more attention in class, or started earlier to work on this assignment

you might want to elaborate a bit ...
for instance, what is it you think your code should be doing, and I don't mean the original assignment, because I can tell from miles away you haven't got any input in there, if that's the question.

ask more specific, like, why doesn't my input work, rather than, guess what, this is my assignment, I don't get it, fix it.

we're volunteers here, doesn't mean we have the time to study each problem in depth and provide quality stuff (even if we wanted to).

you really should put more effort in it because:

1. for us, this is not URGENT at all
2. if this is URGENT for you, maybe you should've paid more attention in class, or started earlier to work on this assignment

ok Ive put the inputs I just have 2 minor issues which I do not know how to fix. Can you please look over it and see what the problem is

package wct;

/**
*
* @author HP_Owner
*/
import java.util.Scanner;
public class WindChillTemp {
public static void main(String[] args) {

// create a Scanner
Scanner input = new Scanner(System.in);

// Prompt the user to enter temperature (ta)
System.out.print("Enter a Temperature: ");
double ta = input.nextDouble();

// prompt the use to enter the wind speed (v)
System.out.print("Enter Wind Speed: ");
double v = input.nextDouble();
//Wind speed <=2


// Compute wind chill
double windchill = 35.74 + (0.6215*ta) - 35.75 * Math.pow(v, 0.16) + 0.4275*ta*Math.pow(v,0.16);
If (ta % -58 <= 0 && ta % 41 => 0);
System.out.println("Temperature must be in range between -58 and 41");
else if (
System.out.println("Your wind chill temperature is: " + windchill);
}
}

The last four lines are starting from If (ta %....seem to be the problem. Ive tried everything but I can't slow the problem

Thank you for your help.

1. Explain exactly what you are stuck on.
2. Explain why you are stuck. This information might include what inputs make your program fail, what section of your program is failing (with line numbers), etc.

1. Explain exactly what you are stuck on.
2. Explain why you are stuck. This information might include what inputs make your program fail, what section of your program is failing (with line numbers), etc.

No Offense but I think you should find yourself a new volunteer job. You are abs. no help at all. I don't expect you to do my homework but at least you should be able to tell me what I am doing wrong and I will try to fix it myself hence volunteers that help. Thank You for all your help. Have a nice day!!!!!!!!

I think what BestJewSinceJC meant was that you should be more specific with what is going wrong with your code. Are you compiling it and an error message shows up on a line? If so, what is the message? Or is it that your code compiles fine, but it crashes randomly in the middle and gives a vague error message? If so, what is the message? Or is it that your code runs fine, but it doesn't do what you want it to do? If so, what is it doing? If you explain what is going wrong with it we can use it to clue us into how to fix it.

On a side note, all the volunteers on Daniweb are very capable coders. If they offer their advice and you find it vague or unhelpful, don't criticize them. It will also make other volunteers you deem "clear" or "capable" less likely to want to helpful. Insulting people trying to help you is not a very good idea, not to mention it is extremely ungrateful.

No Offense but I think you should find yourself a new volunteer job. You are abs. no help at all. I don't expect you to do my homework but at least you should be able to tell me what I am doing wrong and I will try to fix it myself hence volunteers that help. Thank You for all your help. Have a nice day!!!!!!!!

Sorry about that i thought you were a different user ignore my last note it was not meant for you!

No Offense but I think you should find yourself a new volunteer job. You are abs. no help at all. I don't expect you to do my homework but at least you should be able to tell me what I am doing wrong and I will try to fix it myself hence volunteers that help. Thank You for all your help. Have a nice day!!!!!!!!

http://catb.org/~esr/faqs/smart-questions.html#code
http://catb.org/~esr/faqs/smart-questions.html#urgent

In my previous post, I was trying to get you to give more information so that I could help you without spending an exorbitant amount of time figuring out why your code is not working. That is your job. The least you can do is tell us what part of your assignment you're stuck on, why you haven't been able to proceed, what errors you are getting (if any), how far your program gets, and what causes the program to fail. If you cannot give us this information then you have not tried and I do not care whether or not you finish your assignment. And "telling off" people like myself who are just trying to help you is very likely to result in nobody helping you with your problem at all.

commented: More of an explanation than they deserved. +10

too late...

Nah, I got those links from Salem. :)

I mean, it was so urgent it's now too late to help him ;)

commented: Heh, pity. +5

Nah, I got those links from Salem. :)

I am sorry! Dont take it personally

I have the code that works:

//I took out your first line as it seems unnecessary. plus, it did not work with the line in the code
//package windchilltemperature;

import java.util.Scanner;


public class WindChillTemp {

    public static void main(String[] args) {
        double OutsideTemperature = -58;
//here, in the following two lines, I converted the first and second
//arguments to integers and then I multiplied them with 1.0 to get doubles
        double ta = new Integer(args[0]).intValue()*1.0;
        double v = new Integer(args[0]).intValue()*1.0;
        //double speed; this variable is unneccesary as you do not us it anywhere

        double WindChillTemperature = 35.74 + (0.6215 * ta) - 35.75 *Math.pow(v,0.16) + 0.4275 * ta * Math.pow(v, 0.16);

//        Scanner input = new Scanner(System.in);
        System.out.print("Enter a temperature in F between -58F and 41F");
        System.out.print("Enter Wind Speed greater or equal to 2");
        System.out.println("The Wind Chill Temperature is" + WindChillTemperature);

}
}

the code i provided works, but only if you run it through command line.
you had excess lines that stopped the code from working, in addition, when you get input through command line, they are initially in the form of string. to manipulate them, you need to convert them in numbers, which is what i did and explained where i did so. I hope you can make any use out of the code!

the code i provided works, but only if you run it through command line.
you had excess lines that stopped the code from working, in addition, when you get input through command line, they are initially in the form of string. to manipulate them, you need to convert them in numbers, which is what i did and explained where i did so. I hope you can make any use out of the code!

Remember what you just did and never do it again, then you'll be closer to helping people learn. Giving people the "working" code doesn't help them learn. It encourages them to disregard rules, both written and understood, and to have others do work for them instead of learning on their own, which can best be accomplished through trying, failing, and repeating.

I am sorry! Dont take it personally

I don't hold a grudge. As long as you keep the things I mentioned before in mind when posting questions from now on, and as long as you don't tell me I'm bad at doing my job, I'm more than willing to help you.

:)

commented: Well said, WELL SAID!!!!! +19

@Aisha25 can you please in the future drop using URGENT, NEED HELP as we specifically ask user not to do so in our forum rules

Do not post threads with generic subjects such as "HELP ME" or "PROBLEM".

Please understand that your urgency has nothing to do with our priorities...

@BestJewSinceOJ
I'm sorry. I shall refrain from solving other people's problems in the future. yuo are right, I did not help the person learn I helped him do the homework.

you also don't just delete package statements . if it's a part of a bigger application, the app won't find the new class anymore, since it won't be in the specified package

And just as a nitpicky point that I didn't mention before, you can definitely run a program that requires command line arguments without using the command line. For example, I can run it in Eclipse and just supply the command line arguments.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.