I need to make this program pass by reference. How can I do that?
import java.io.*;
import java.util.*;
public class Convert
{
static Scanner console = new Scanner(System.in);
public static void main(String[] args)
{
int pounds;
int lb;
int oz;
int totalOz;
int lbs;
int ozs;
int totalOzs;
//Calling the functions
readData(pound);
Convert(lb, oz, totalOz);
displayResult(lbs, ozs, totalOzs);
}
//The function that reads the data
public static double readData(int pounds)
{
System.out.print("How many pounds? ");
pounds = console.nextInt();
return pounds;
}
//The function that converts pounds to ounces
public static double Convert(int pounds, double ounces, double totalounces)
{
ounces = pounds / 16;
totalounces = ounces + (pounds % 16);
return totalounces;
}
//The void function to display the result
public static void displayResult(int pounds, double ounces, double totalounces)
{
System.out.print(pounds + " pounds equal " + totalounces + " ounces.");
}
}
Sorry about not putting it in the code tags