Simple Java Program 3: USD to Philippine Peso Conversion

In this program a simple calculation will be made to know the equivalent of a certain amount of US Dollar in Philippine Peso.

The program will ask for the user to input a certain amount and it will give you its equivalent amount in peso.

import java.util.Scanner;
public class USToPeso {

    public static void main(String[] args) {
        double ustopeso = 43.86;
        double us;
        System.out.println("Enter amount in USD:");
        Scanner reader = new Scanner(System.in);
        us = reader.nextDouble();
        double amountinpeso = us*ustopeso;
        System.out.println("The value in Philippine Peso is: " +amountinpeso);

    }

}

Here's the output:















In case the exchange rate changes, you can always change its value by editing the highlighted part which is 43.86.
If you want to do other currency conversions, you can edit the amount as well and the variables to avoid confusion. The variables I used in this class are ustopeso, peso, and amountinusd. Click here for another example of currency conversion.


Comments

  1. Thanks for your informative post on Java application development. This open source platform assists software developers to create stunning mobile application with ease. Further, they can make use of this platform at free of cost.
    J2EE Training in Chennai
    .Net Training in Chennai
    PHP Training in Chennai
    Big Data Training in Chennai

    ReplyDelete
  2. Hi BerryKins,
    Quite Interesting post!!! Thanks for posting such a useful post. I wish to read your upcoming blog to enhance my skill set in java, keep blogging.
    Regards,
    SAP training in chennai|SAP course in chennai|SAP training|SAP courses in chennai

    ReplyDelete
  3. Corporate training is educating employees using various learning programmes through activities. It serves as a catalyst for employee achievement, which signifies your company's or organisation's overall success. According to a LinkedIn survey, 94% of employees said they would remain at a firm if it invested in their learning requirements because training is a crucial aspect of their professional lives. To learn more about corporate training features, join Corporate Training In Chennai at FITA Academy.

    Corporate Training In Chennai

    ReplyDelete

Post a Comment