5 Replies - 578 Views - Last Post: 05 December 2016 - 10:11 PM Rate Topic: -----

#1 Silvio232   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 05-December 16

What is wrong with my code

Posted 05 December 2016 - 12:55 PM

Greetings,
Im from Brazil and can't find help there,Im having issues with my code.
I would like some help,it's not compipling.

Here it is
import java.util.Scanner; 
public class Calculosalarioebeneficios{
public static void main(String[] args) {
 Scanner console = new Scanner(System.in);
var


int idade,diasmes,diastrabmes,horasdia
double valhrtrab,salario,inss,fgts
char d,n

public class Exemplo{public static void main(String args[]{;
System.out.print("Digite o nome do funcionário: ");
nome=sc.nextLine();//String;
System.out.print("Digite a idade do funcionário: ");
idade=Integer.parselnt(sc.nextLine();
System.out.print("Digite quantos dias trabalhados no mês: ");
diastrabmes=Integer.parselnt(sc.nextLine();
repita;
System.out.print("Regime de horas trabalhadas por dia. 6 || 8 horas?: ");
horasdia =Integer.parselnt(sc.nextLine();
ate ((horasdia = 6) || (horasdia = 8));
System.out.print("Digite o Turno. D para Diurno e N para Noturno || Pressione S para Sair: ");
turdiario=sc.nextLine();//String;
if((turdiario != "D") && (turdiario != "N")) entao;
System.out.println("Programa Finalizado!!");
}
if ((turdiario = "D") && (idade <=50)) entao;
valhrtrab:= 3;
senao;
if ((turdiario = "D") && (idade > 50)) entao;
valhrtrab:= 3 + (3*0.10);
}
if ((turdiario = "N") && (idade <=50)) entao;
valhrtrab:= 4;
senao;
if ((turdiario = "N") && (idade > 50)) entao;
valhrtrab:= 4 + (4*0.10);
}
}
}
salario:= (valhrtrab * horasdia* diastrabmes)+ (valhrtrab * horasdia* diastrabmes* 1.5);
fgts:= salario*0.08;
if salario<= 1556.94 entao;
inss:= salario*0.08;
senao;
if ((salario >=  1556.95) && (salario <= 2594.92)) entao;
inss:= salario*0.09;
senao;
if ((salario >= 2594.93) && (salario <= 8189.82)) entao;
inss:= salario*0.11 senao;
}
}
System.out.printl("O salario bruto é: ",salario);
System.out.printl( "O Total do Depósito do FGTS é: ",fgts);
System.out.print( "O depósito do INSS é: ", inss);
	}
}

:code:
Thanks

This post has been edited by modi123_1: 05 December 2016 - 01:12 PM
Reason for edit:: In the future, pease use the [code] tag button.


Is This A Good Question/Topic? 0
  • +

Replies To: What is wrong with my code

#2 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 16479
  • View blog
  • Posts: 65,313
  • Joined: 12-June 08

Re: What is wrong with my code

Posted 05 December 2016 - 01:13 PM

Please elaborate - is it giving you error messages? If so copy/paste them here.
Was This Post Helpful? 0
  • +
  • -

#3 NormR   User is offline

  • D.I.C Lover
  • member icon

Reputation: 870
  • View blog
  • Posts: 6,695
  • Joined: 25-December 13

Re: What is wrong with my code

Posted 05 December 2016 - 01:28 PM

Also can you format the code and add proper indentations? Unformatted code is hard to read and understand.
Was This Post Helpful? 0
  • +
  • -

#4 Silvio232   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 05-December 16

Re: What is wrong with my code

Posted 05 December 2016 - 08:26 PM

View Postmodi123_1, on 05 December 2016 - 01:13 PM, said:

Please elaborate - is it giving you error messages? If so copy/paste them here.

Everytime I try to run it it gets worse
Here it is.
Thanks in advance

classError(s), warning(s):
source_file.java:5: error: not a statement
var
^
source_file.java:5: error: ';' expected
var
^
source_file.java:8: error: ';' expected
int idade,diasmes,diastrabmes,horasdia
^
source_file.java:9: error: ';' expected
double valhrtrab,salario,inss,fgts
^
source_file.java:10: error: ';' expected
char d,n
^
source_file.java:12: error: illegal start of expression
public class Exemplo{public static void main(String args[]{;
^
source_file.java:12: error: ';' expected
public class Exemplo{public static void main(String args[]{;
^
source_file.java:12: error: not a statement
public class Exemplo{public static void main(String args[]{;
^
source_file.java:12: error: ';' expected
public class Exemplo{public static void main(String args[]{;
^
source_file.java:12: error: illegal start of expression
public class Exemplo{public static void main(String args[]{;
^
source_file.java:12: error: illegal start of expression
public class Exemplo{public static void main(String args[]{;
^
source_file.java:12: error: ';' expected
public class Exemplo{public static void main(String args[]{;
^
source_file.java:12: error: ')' expected
public class Exemplo{public static void main(String args[]{;
^
source_file.java:12: error: illegal start of expression
public class Exemplo{public static void main(String args[]{;
^
source_file.java:12: error: ';' expected
public class Exemplo{public static void main(String args[]{;
^
source_file.java:16: error: ')' expected
idade=Integer.parselnt(sc.nextLine();
^
source_file.java:18: error: ')' expected
diastrabmes=Integer.parselnt(sc.nextLine();
^
source_file.java:19: error: not a statement
repita;
^
source_file.java:21: error: ')' expected
horasdia =Integer.parselnt(sc.nextLine();
^
source_file.java:25: error: not a statement
if((turdiario != "D") && (turdiario != "N")) entao;
^
source_file.java:28: error: not a statement
if ((turdiario = "D") && (idade <=50)) entao;
^
source_file.java:29: error: illegal start of expression
valhrtrab:= 3;
^
source_file.java:30: error: not a statement
senao;
^
source_file.java:31: error: not a statement
if ((turdiario = "D") && (idade > 50)) entao;
^
source_file.java:32: error: illegal start of expression
valhrtrab:= 3 + (3*0.10);
^
source_file.java:34: error: not a statement
if ((turdiario = "N") && (idade <=50)) entao;
^
source_file.java:35: error: illegal start of expression
valhrtrab:= 4;
^
source_file.java:36: error: not a statement
senao;
^
source_file.java:37: error: not a statement
if ((turdiario = "N") && (idade > 50)) entao;
^
source_file.java:38: error: illegal start of expression
valhrtrab:= 4 + (4*0.10);
^
source_file.java:41: error: class, interface, or enum expected
}
^
source_file.java:43: error: class, interface, or enum expected
fgts:= salario*0.08;
^
source_file.java:44: error: class, interface, or enum expected
if salario<= 1556.94 entao;
^
source_file.java:45: error: class, interface, or enum expected
inss:= salario*0.08;
^
source_file.java:46: error: class, interface, or enum expected
senao;
^
source_file.java:47: error: class, interface, or enum expected
if ((salario >= 1556.95) && (salario <= 2594.92)) entao;
^
source_file.java:48: error: class, interface, or enum expected
inss:= salario*0.09;
^
source_file.java:49: error: class, interface, or enum expected
senao;
^
source_file.java:50: error: class, interface, or enum expected
if ((salario >= 2594.93) && (salario <= 8189.82)) entao;
^
source_file.java:51: error: class, interface, or enum expected
inss:= salario*0.11 senao;
^
source_file.java:52: error: class, interface, or enum expected
}
^
source_file.java:55: error: class, interface, or enum expected
System.out.printl( "O Total do Depósito do FGTS é: ",fgts);
^
source_file.java:56: error: class, interface, or enum expected
System.out.print( "O depósito do INSS é: ", inss);
^
source_file.java:57: error: class, interface, or enum expected
}
^
44 errors
Was This Post Helpful? 0
  • +
  • -

#5 jon.kiparsky   User is offline

  • Beginner
  • member icon


Reputation: 12350
  • View blog
  • Posts: 20,984
  • Joined: 19-March 11

Re: What is wrong with my code

Posted 05 December 2016 - 09:34 PM

Start with the first error. :

Quote

classError(s), warning(s):
source_file.java:5: error: not a statement
var
^


What is this and what's it doing here? If you delete it, do things get better?
Was This Post Helpful? 0
  • +
  • -

#6 astonecipher   User is offline

  • Enterprise Software Architect
  • member icon

Reputation: 3215
  • View blog
  • Posts: 12,098
  • Joined: 03-December 12

Re: What is wrong with my code

Posted 05 December 2016 - 10:11 PM

What language are you trying to write in? Looks like a combination of bash, assembly, and java!

Line 5, var, that's it.

Line 12, no idea what you think happens.

Lines 28, 29, and 30, huh?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1