Question: Need help in Java!!! How to correct errors import java.util.Scanner; public class convertor { public static void main(String args[]) { int opt; double usd,rmb; System.out.println(CURRENCY

Need help in Java!!! How to correct errors

import java.util.Scanner;

public class convertor

{

public static void main(String args[])

{

int opt;

double usd,rmb;

System.out.println("CURRENCY EXCHANGE PROGRAM"); //Create scanner Object and pass string in it Scanner

scan = new Scanner(System.in); //ASK USER FOR A OPTION IF '0' THEN USD TO CHINESE RMB OTHERWISE RMB TO USD System.out.println("Enter 0 to convert fromU.S Dollars to Chinese RMB"); opt=scan.nextInt(); if(opt==0) { System.out.println("Enter the amount of U.S. Dollars"); usd = scan.nextInt(); //Input the amount of usd from user rmb=usd*6.82; //convert USD to RMB 1 usd = 6.82 rmb System.out.println(usd + " USD = " + rmb + " RMB"); //display the result } else { //except 0 option System.out.println("Enter the amount of Chinese RMB"); rmb = scan.nextInt(); //Input the amount of RMB from user usd=rmb*0.146; //convert RMB to USD 1 RMB = 0.146 USD System.out.println(rmb + " RMB = " + usd + " USD"); //display the result } } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!