java - My Programming Lab standard output errors -


i've been working on code , seems working, when myprogramminglab runs code says there problem standard output.

here problem:

write temperature class hold temperature in fahrenheit , provide methods temperature in fahrenheit, celsius, , kelvin. class should have following field:

• ftemp: double holds fahrenheit temperature.

the class should have following methods :

• constructor : constructor accepts fahrenheit temperature (as double ) , stores in ftemp field. • setfahrenheit: set fahrenheit method accepts fahrenheit temperature (as double ) , stores in ftemp field. • getfahrenheit: returns value of ftemp field fahrenheit temperature (no conversion required) • getcelsius: returns value of ftemp field converted celsius. use following formula convert celsius: celsius = (5/9) * (fahrenheit - 32) • getkelvin: returns value of ftemp field converted kelvin. use following formula convert kelvin: kelvin = ((5/9) * (fahrenheit - 32)) + 273

demonstrate temperature class writing separate program asks user fahrenheit temperature. program should create instance of temperature class , value entered user passed constructor . program should call object 's methods display temperature in following format (for example, if temperature in fahrenheit -40):

the temperature in fahrenheit -40.0 temperature in celsius -40.0 temperature in kelvin 233.0

and here code:

import java.io.*;  import java.util.scanner;      public class temperature  {  	private double ftemp;  	  	public temperature(double ftemp)  	{  		this.ftemp = ftemp;  	}  	public void setfahrenheit(double ftemp)  	{  		this.ftemp = ftemp;  	}  	public double getfahrenheit()  	{  		return ftemp;  	}  	public double getcelsius()  	{  		return (5.0/9.0) * (ftemp - 32.0);  	}  	public double getkelvin()  	{  		return (5.0/9.0) * ((ftemp - 32.0) + 273.0);  	}  }      class mytemperature  {      public static void main(string[] args)  	{  		  		scanner keyboard = new scanner(system.in);  		double input;  		  		system.out.print("enter fahrenheit temperature:");  		  		input = keyboard.nextdouble();  		  		temperature temp1 = new temperature(input);  		  		system.out.println("the temperature in fahrenheit " + temp1.getfahrenheit());  		system.out.println("the temperature in celsius " + temp1.getcelsius());  		system.out.println("the temperature in kelvin " + temp1.getkelvin());  	}  }

these errors gives me:

http://imgur.com/gallery/0d2rkw7/new

i don't have enough rep post images, sorry!

i don't understand problem be, appreciated.

public double getkelvin() {     return ((5.0/9.0) * (ftemp - 32.0)) + 273.0; } 

note changes in ()


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -