ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 9 Weeks Ago, 4 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 06 Jun 2017 My Price 9.00

code for CIS 355A class

Hi,

I need help with my code for CIS 355A class. I am writing a code in JAVA that will convert money between the following currencies: US Dollar, Yen, and Euro. Below is the instructions of how to format the code.

STEP 2: CurrencyConversion (20 points)

You must create a program named CurrencyConversion.java that converts money between the following currencies.

 

Given one of the three currencies (US Dollar, Yen, Euro), the program should convert the input amount into one of the other currencies. For example, if you input one (1) U.S. dollar, and you decide to convert that one dollar to a Euro, then the output should be .90.

 

This chart provides the codes to be used as input (JPY, EURO, USD) and the conversion factors.  

 

CURRENCY CURRENCY CODE YEN EURO USD

US Dollar

USD $1 = 123.14 $1 = .90 Euro ------------

Yen

YEN ------------- 1 Yen = .0073 Euro 1 Yen = $.0081

Euro

EURO 1 Euro = 136.08 Yen ------------

1 Euro = $1.11

Note that Step 2 DOES NOT HAVE TO USE OOP.  Keep it simple. 

Note that you CANNOT test for equality between strings using ==.   
String color = "red"; 

THIS WILL NOT WORK:   
if (color == "red") 

YOU MUST USE 
if (color.equals("red") 
Using the JOptionPane GUI, do the following.

Prompt the user for the currency code type.

Prompt the user for the amount of that currency.

Prompt the user for the currency code that the entered amount must be converted to.

Using the table above, the following formula was used to convert USD to EURO.

100.00 USD * .9 = 90.00 EURO

Display the results in a JOptionPane message box.

 1

Must contain program's name, student name, and description of the program

 4

Documents design process and testing

 5

Use JOptionPane for input and output

 7

Uses logic and correct formula to compute results

 3

Gives error message, allows correction of invalid data

 20

 

 

This what I have done so far:

public class CurrencyConversion 
{
    public static void main(String[] args) 
    {
        // declare variables
        double amount;
        double USDollar;
        double Yen = 0;
        double Euro;
        
        //prompt the user for the currency code type
        String currency = JOptionPane.showInputDialog("Enter currency code type: ");
        String message = String.format("Currency Code: ", currency);
        
        //prompt the user for the amount of that currency
        String aString = JOptionPane.showInputDialog("Enter amount of that currency: ");
        amount = Double.parseDouble(aString);
                
        //prompt the user for the currency code that the entered amount must be converted to
        String convert = JOptionPane.showInputDialog("Enter the currency code you want to convert for the amount: ");
        String text = String.format("Currency Code: ", convert);
        
        if(convert.equals("US Dollar"))
        {
            USDollar = 0.0081 * amount;
        }
        
        else 
            if (convert.equals("US Dollar"))
        {
            USDollar = 1.11 * amount;
        }
        
        
        NumberFormat nf = NumberFormat.getCurrencyInstance();
                
        //Display the results =
        JOptionPane.showMessageDialog(null, message + currency+ " "+ nf.format(amount));     
        JOptionPane.showMessageDialog(null, text + convert);
    }

}

I am have trouble figuring out how to output the amount that was converted from one currency to the other currency.

Answers

(11)
Status NEW Posted 06 Jun 2017 08:06 AM My Price 9.00

-----------

Not Rated(0)