Answer to Question #323797 in Java | JSP | JSF for stephanie

Question #323797

Write a static method called dollarToPeso that takes a dollar amount as parameter and returns its equivalent in pesos. Assume that the conversion rate is 1 dollar = 48.45 pesos. Use this method in the program.



Sample output:


Enter dollar amount: 50


$ 50 = P 2,422.5



1
Expert's answer
2022-04-05T02:11:38-0400
import java.util.Scanner;

public class Main {

    public static void dollarToPeso(Scanner in){
        System.out.print("Enter dollar amount: ");
        double dol = in.nextDouble();

        System.out.println("$ " + dol + " = " + "P " + (dol*48.45));
    }

    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        Main.dollarToPeso(in);
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS