why? printf doesnt work either
Trying to convert from Fahrenheit to celsius but its not printing
because 5/9 is rounded down you fucking idiot.
oh shit aight figured it out had to divide by 1.8
You forgot to declare the interface TemperatureUnit and then the clasess Celsius and Farenheit which inherit TemperatureUnit's values, then you create two objects of said classes and run the method
farenheitObject.convert(celsiusObject);
No need to thank me.
Try converting to Islam first.
She should have an apache library you could just use
I would tell you something that one of my stupid fellow classmates once told me when he was trying to convince me to create a LinkedList class from scratch in java and I said no
>God you are so boring xD!!!!
nigga you need to specify the type of divison you are using.
using just 5/9 will do floating point division.
BigDecimal is percise. I use it for money at work
this
just use something like
5.0/9.0
You forgot to convert it into a string.
change multiplier to: 5.0 / 9
System.out.println("" + output);
intro cs classes to stupid pointless shit like make a """linked list""" in python
Integer division.
int / int = int
double / double = double
double / int = double
int / double = double
5 / 9 is 0.
5.0 / 9 ~0.5555...
At least one of the operands needs to be a floating point number to get a floating point number as a result.
Literally how every single CS course I had thought simple programs had to be solved.
Isn't the list type in python actually implemented as a linked list internally?
>Java
found your problem
you are correct but it will do an integer division since a floating point division would be what he wants
>unironically having problems with k&r's first program.
you need this:
[CODE]
#include "studio.h"
[/CODE]
Java being built for doubles and ints is really where it blows. If you try and save memory and improve performance by using a short you have to cast and even that isn't guaranteed to be faster than a int