I do not understand, the exercise gives me 4 errors. The statement of the exercise is as follows:
In a class called Coins, the following members are present:
to. Two private variables of type called chain country and currency, the value of the variables must be typed from the keyboard. The code to request that value must write it to the class of the Main method.
b. Create a custom constructor with two parameters of type String that accepts the parameters corresponding to the variables of the class and that displays a message. For example "The currency of legal tender in El Salvador is the dollar", in this message you must concatenate the variables that you will receive in the parameter. Implement the class.
class MonedaPais {
public static void main(String[] args) {
Scanner ob = new Scanner(System.in);
System.out.println("Escribe el país: ");
String pa = ob.nextLine();
System.out.println("Escribe la moneda: ");
String mon = ob.nextLine();
Moneda moneda = new Moneda(pa, mon);
}
}
class MonedaPais10 {
private String pais, moneda;
public static void main(String pais, String moneda) {
this.pais = pais;
this.moneda = moneda;
System.out.println("La moneda de curso legal de " + pais + " es el " + moneda);
}
The errors that come out are:
MonedaPais10.java:14: error: can not find symbol Currency currency = new Currency (pa, mon); ^ symbol: class Currency location: class Currency Currency Pais10.java:14: error: can not find symbol Currency currency = new Currency (pa, mon); ^ symbol: class Currency location: class CurrencyPais CurrencyPais10.java:24: error: non-static variable this can not be referenced from a static context this.pais = country; ^ CurrencyPais10.java:25: error: non-static variable this can not be referenced from a static context this.moneda = currency; ^ 4 errors