URI Online Judge | 1048
Salary Increase
By Neilor Tonin, URI Brazil
Timelimit: 1
The company ABC decided to give a salary increase to its employees, according to the following table:
Read the employee's salary, calculate and print the new employee's salary, as well the money earned and the increase percentual obtained by the employee, with corresponding messages in Portuguese, as the below example.
Input
The input contains only a floating-point number, with 2 digits after the decimal point.
Output
Print 3 messages followed by the corresponding numbers (see example) informing the new salary, the among of money earned and the percentual obtained by the employee. Note:
Novo salario: means "New Salary"
Reajuste ganho: means "Money earned"
Em percentual: means "In percentage"
Novo salario: means "New Salary"
Reajuste ganho: means "Money earned"
Em percentual: means "In percentage"
Input Sample | Output Sample |
400.00 | Novo salario: 460.00 Reajuste ganho: 60.00 Em percentual: 15 % |
800.01 | Novo salario: 880.01 Reajuste ganho: 80.00 Em percentual: 10 % |
2000.00 | Novo salario: 2140.00 Reajuste ganho: 140.00 Em percentual: 7 % |
URI Online Judge Solution 1048 in Java language || Salary Increase
import java.io.IOException;import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
float N,new_salary = 0,earn_Money = 0;
int parcent = 0;
Scanner input =new Scanner(System.in);
N =input.nextFloat();
if (N >= 0 && N <= 400.00) {
parcent = 15;
new_salary = (float) (N + (N * (parcent /100.00)));
earn_Money = (float) ((N * (parcent /100.00)));
}else if (N >= 400.01 && N <= 800.00) {
parcent = 12;
new_salary = (float) (N + (N * (parcent /100.00)));
earn_Money = (float) ((N * (parcent /100.00)));
}else if (N >= 800.01 && N <= 1200.00) {
parcent = 10;
new_salary = (float) (N + (N * (parcent /100.00)));
earn_Money = (float) ((N * (parcent /100.00)));
}else if (N >= 1200.01 && N <= 2000.00) {
parcent = 7;
new_salary = (float) (N + (N * (parcent /100.00)));
earn_Money = (float) ((N * (parcent /100.00)));
}else if (N >= 2000.01) {
parcent = 4;
new_salary = (float) (N + (N * (parcent /100.00)));
earn_Money = (float) ((N * (parcent /100.00)));
}
System.out.printf("Novo salario: %.2f\n",new_salary);
System.out.printf("Reajuste ganho: %.2f\n",earn_Money);
System.out.print("Em percentual: "+parcent+" %\n");
}
}
No comments:
Write commentsTo know more about the problem, give us your valuable commment. We'll try to help you. Thanks