Here is my main...
public class Yamaha {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
productoYamaha p1, p2;
p1= new productoYamaha ();
p2= new productoYamaha ('empacador',20.00);
p1.imprimir();
p2.imprimir();
System.out.println("El total a pagar es"total_a_pagar);
// TODO code application logic here
}
And here is the code i write
enter code here package yamaha;
/**
*
* @author Soria
*/
public class productoYamaha {
double pProducto;
String nProducto;
public productoYamaha(){
this.nProducto="";
this.pProducto=0;
}
public productoYamaha (double pProducto, String nProducto){
this.nProducto=nProducto;
this.pProducto=pProducto;
}
public double gYamaha (int cantidad){
double gcantidad;
gcantidad= this.pProducto*cantidad;
return gcantidad;
}
public void imprimir (){
System.out.println("nombre del producto"+nProducto);
System.out.println("precio del Producto"+pProducto);
}
}
And i'm having this error
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous ctor sym type: at yamaha.Yamaha.main(Yamaha.java:20) C:\Users\Erick_Soria\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1 BUILD FAILED (total time: 0 seconds)
What i'm doing wrong?
p2= new productoYamaha ('empacador',20.00);Two things: (1) the parameters seem to be backwards and (2) aStringliteral is declared using double quotes (").