Hi Im new to everything the forum and java. But anyways I need some help with my coding. I need my program to to have a max value of 212 and convert a value from fahrenheit to celsius and then to kelvin, also feet to inches and pounds to stones. I also need to it say if the value is out of range for ex. 213 is out of range, and that a value is not valid ex. abs is not a valid entry.
Heres my code so far.
import java.util.Scanner; public class Project1 { private static final int MAX_VALUE = 212; public static void main(String[] args) { //Declare constants final double CS = (5.0 / 9); final double ME = 0.3048; final double KL = 0.4536; //Declare variables Scanner input = new Scanner(System.in); String entry; int fahrenheit, feet, pounds, count = 0, guess = -1, number; double fahrenheit1, feet1, pounds1; System.out.println(" J A "); System.out.println(" Project Title "); //Get input System.out.println("Enter a temperature in fahrenheit (integer): "); fahrenheit1 = input.nextInt(); System.out.println("Enter a distance in feet (integer): "); feet1 = input.nextInt(); System.out.println("Enter a weight in pounds (integer): "); pounds1 = input.nextInt(); number = getRandomNumber (MAX_VALUE); System.out.println("Kelvin, Inches, Stones"); while (guess != number) { System.out.println("\nEnter a Fahrenheit temperature between 0 and " + "MAX_VALUE" + ": "); entry = input.next (); if(validInput(entry)) { count++; guess = Integer.parseInt(entry); } else if (guess <= number) { System.out.println("The entered value is invalid"); } //Conversions double celsius = (CS) * (fahrenheit1 - 32); double meters = (ME) * (feet1); double kilograms = (KL) * (pounds1); double Kelvin = (fahrenheit1 + 459.67)* 5/9; double inches = (feet1 * 12); double stones = (pounds1 * 0.0714285714); //Display results System.out.println("Fahrenheit " + fahrenheit1 + "is" + celsius + " in Celsius" + Kelvin + " in Kelvin "); System.out.println("Feet " + feet1 + "is" + meters + "in Meters" + "is" + inches + "in Inches"); System.out.println("Pounds " + pounds1 + "is" + kilograms + "in Kilograms" + "is" + stones + "in Stones"); } } private static boolean validInput(String entry) { // TODO Auto-generated method stub boolean isValid = false; return isValid = false; } private static int getRandomNumber(int MAX_VALUE) { // TODO Auto-generated method stub return 0; }