Okay, so I just started this homework lab and I'm having a little bit of trouble. I've searched for any solutions but they all seem way more complex than what I can comprehend. I'm looking for the dollars needed and change needed to buy something. I just came up with some numbers and when i run the file i get an error. Can anyone help me find how to complete the equations to get the sum value. Also dollarsNeeded needs to be int and not double. The changeNeeded can be double. Any help would be greatly appreciated.
java:30: error: possible loss of precision
findDollars = xboxOne + newGame;
^
required: int
found: double
1 error
public class MoneyNeeded
{
public static void main(String[] args)
{
double xboxOne, newGame, moneyNeeded;
xboxOne = 320.41;
newGame = 64.36;
moneyNeeded = findMoney(xboxOne, newGame);
System.out.println(moneyNeeded);
int dollarsNeeded;
dollarsNeeded = findDollars(xboxOne, newGame);
System.out.println(dollarsNeeded);
double changeNeeded;
changeNeeded = findChange(xboxOne, newGame);
System.out.println(changeNeeded);
}
public static double findMoney(double xboxOne, double newGame)
{
double findMoney;
findMoney = xboxOne + newGame;
return findMoney;
}
public static int findDollars(double xboxOne, double newGame)
{
int findDollars;
findDollars = xboxOne + newGame;
return findDollars;
}
public static double findChange(double findDollars, double findMoney)
{
double findChange;
findChange = findMoney % findDollars;
return findChange;
}
}