Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

// as you can see in the method getCurrency l have threestrings respectively t,s

ID: 3615082 • Letter: #

Question

// as you can see in the method getCurrency l have threestrings respectively t,s and a. I would like to know how can lreturn them in the main method and print them out after lhave formatted them.

import javax.swing.*;
import java.text.DecimalFormat;
import java.text.NumberFormat;

public class currency
{
    public static void main(String args[])
    {

    double total = 6;
    double sum= 5;
      double amount = 17.0;
      String callCurrency=getCurrency(total,sum,amount);
   }

   public static String getCurrency ( double total,double sum, double amount)
   {


    NumberFormat formatter = newDecimalFormat("$0.00");
    String t = formatter.format(total);
    String s= formatter.format(sum);
    String a = formatter.format(amount);

    }
}

Explanation / Answer

//Hope this will help you. import javax.swing.*; import java.text.DecimalFormat; import java.text.NumberFormat; public class currency {     public static void main(String args[])     {       int i;       double total = 6;       double sum= 5;       double amount = 17.0;       String callCurrency[]=getCurrency(total,sum,amount);      for(i=0;i