0
I’m inclined to solve the following problem: João Papo-de-Pescador, a good man, bought a microcomputer to control the daily income of his work. Every time he brings a weight of fish greater than that established by the regulation of fishing in the state of São Paulo (50 kilos) must pay a fine of R$ 4.00 per kilo surplus. John needs you to do a program that read the weight variable (weight of fish) and calculate the excess. Write in variable excess the amount of kilos beyond the limit and in the variable fine the amount of the fine that João must pay. Print the data of program with the appropriate messages.
But the compiler is not accepting my comparisons and sums, where I am missing?
package papodepescador;
import java.util.Scanner;
public class PapoDePescador {
public static void main(String[] args) {
peso.quanto();
}
class peso {
private static void quanto(){
System.out.println("Quantos quilos de peixes temos hoje João? ");
Scanner sc = new Scanner(System.in);
boolean quilo = sc.nextBoolean();
if(quilo <= 50){
System.out.println("A quantidade " + quilo+"Kg de peixes esta dentro do"
+ " limite de peso do regulamento do estado de São Paulo. Muito bem João!");
}
else{
System.out.println("Que pena João!\n Infelismente você esta com " + excesso(quilo)
+ "Kg acima do limite.\n E terá que pagar uma multa de R$" + multa.valor(quilo)+ ".");
}
}
public static boolean excesso(boolean quilo){
return quilo / 50.00;
}
}
public class multa {
public static boolean valor(boolean quilo){
boolean aux;
aux = 50.00 / quilo * 4.00;
return aux;
}
}
}
bad operand errors occur on lines:
if(quilo <= 50){
return quilo / 50.00;
and the flip operands:
aux = 50.00 / quilo * 4.00;
Sure, thank you very much,
– Tadeu Agostini