I don't understand this error is it logical error or something else here is the coding " this program should convert riyal to currency that is chosen by the user using multiway if-else
import java.util.Scanner;
public class Convert
{
public static void main (String[] args)
{
Scanner kb= new Scanner (System.in);
double riyal, c;
int opp;
System.out.println("Please enter the amount of money in Riyal: ");
riyal= kb.nextDouble();
System.out.println("Enter the currency option(1- Dollar, 2- Euro, 3- Yen): ");
opp= kb.nextInt();
if(opp==1)
c=riyal*0.267;
System.out.print(riyal+" Riyals is converted to "+c" Dollars");
else if (opp==2)
c=riyal*0.197;
System.out.print(riyal+" Riyals is converted to "+c" Euros");
else if (opp==3)
c=riyal*0.27.950;
System.out.print(riyal+" Riyals is converted to "+c" Yens");
else
{
System.out.println("Invalied opption");
}
}
}
error massage
error: illegal start of expression
error: 'else' without 'if'
error: ';' expected
error: ')' expected
Aucun commentaire:
Enregistrer un commentaire