Im using the scanner to accept what type of wood will be chosen based on the variable " m , o p". im using the if and else statement to print out the type of wood which was chosen but im getting an error when it comes to else.
package furniture_store;
import java.util.Scanner;
/**
*
* @author whitneykenny
*/
public class Furniture_store {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner type_Furniture = new Scanner(System.in);
System.out.println("Choose a type of wood");
System.out.println("Choose P for pine wood " + "Choose M for mahogany " + "O for Oak");
String woodType = type_Furniture.nextLine();
String p,o,m ;
if (woodType.equals("p")) {
System.out.println("Pine wood was chosen ");
} else if (woodType.equals("o"))
System.out.println("Oak wood was chosen");{
}else (woodType.equals("m"));{
System.out.println("Mahogony wood was chosen");
}
}
}
Aucun commentaire:
Enregistrer un commentaire