Like I said, I am a beginner so please go easy on this noob. And this IS a school assignment so I dont want somebody to do this for me, just to guide me in the right direction...
//Write a program that will provide a weather forecast to the user. Prompt the
//user to enter an air temperature in degrees Fahrenheit, and whether the
//barometric pressure is rising or falling. If the pressure is rising, clear
//skies are ahead. If the pressure is falling, rain is in the forecast unless
//it's colder than 32° F in which case there will be snow.
import java.util.Scanner;
public class WeatherMan{
public static void main(String[] args){
Scanner scanny = new Scanner(System.in);
System.out.println("Enter the temputure in F: ");
int temp = scanny.nextInt();
int freeze = 32;
System.out.println("Please enter baromatic pressure (r)ising or (f)alling ");
String word = scanny.next();
boolean choice = true;
if(temp >= freeze && choice == true);
{
System.out.println("Its going to be nice");
if(temp >= freeze && choice == !true){
System.out.println("It looks like rain");
if(temp <= freeze && choice == true){
System.out.println("looks like snow");
if(temp <= freeze && choice == !true){
System.out.println("looks like snow");
}
}
}
}
}
}
Aucun commentaire:
Enregistrer un commentaire