URI-1048 Solve

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:

SalaryReadjustment Rate
0 - 400.00
400.01 - 800.00
800.01 - 1200.00
1200.01 - 2000.00
Above 2000.00
15%
12%
10%
7%
4%

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"
Input SampleOutput Sample
400.00Novo salario: 460.00
Reajuste ganho: 60.00
Em percentual: 15 %
800.01Novo salario: 880.01
Reajuste ganho: 80.00
Em percentual: 10 %
2000.00Novo salario: 2140.00
Reajuste ganho: 140.00
Em percentual: 7 %
Problem link [URI 1048##link##]

Solution:

  • [tab]
    • C
      • #include<stdio.h>
        int main()
        {
         float n;
         scanf("%f", &n);
         if (n <= 400.0)
           printf("Novo salario: %.2f\nReajuste ganho: %.2f\nEm percentual: 15 %%\n", n * 1.15, n * 0.15);
         else if (n <= 800.0)
           printf("Novo salario: %.2f\nReajuste ganho: %.2f\nEm percentual: 12 %%\n", n * 1.12, n * 0.12);
         else if (n <= 1200.0)
           printf("Novo salario: %.2f\nReajuste ganho: %.2f\nEm percentual: 10 %%\n", n * 1.10, n * 0.10);
         else if (n <= 2000.0)
           printf("Novo salario: %.2f\nReajuste ganho: %.2f\nEm percentual: 7 %%\n", n * 1.07, n * 0.07);
         else
           printf("Novo salario: %.2f\nReajuste ganho: %.2f\nEm percentual: 4 %%\n", n * 1.04, n * 0.04);
         return 0;
        }
    • C++
      • #include <iostream>
        #include <iomanip>
        
        using namespace std;
        
        int main()
        {
         float n, tmp, per;
        
         cin >> n;
        
         if(n <= 400){
          per = 15;
          tmp = n + ((n * per) / 100);
         }else if(n > 400 && n <= 800){
          per = 12;
          tmp = n + ((n * per) / 100);
         }else if(n > 800 && n <= 1200){
          per = 10;
          tmp = n + ((n * per) / 100); 
         }else if(n > 1200 && n <= 2000){
          per = 7;
          tmp = n + ((n * per) / 100);
         }else{
          per = 4;
          tmp = n + ((n * per) / 100);
         }
        
         cout << "Novo salario: " << fixed << setprecision(2) << tmp << endl;
         cout << "Reajuste ganho: " << fixed << setprecision(2) << (tmp - n) << endl;
         cout << "Em percentual: " << fixed << setprecision(0) << per << " %" << endl;
        
         return 0;
        }
3/Technology/post-list
Name

Codeforces,53,Problem Solve,90,Programming Tricks,1,URI,37,
ltr
item
DorHubs: URI-1048 Solve
URI-1048 Solve
DorHubs
https://dorhubs.blogspot.com/2019/09/uri-1048-solve.html
https://dorhubs.blogspot.com/
https://dorhubs.blogspot.com/
https://dorhubs.blogspot.com/2019/09/uri-1048-solve.html
true
9087637800571592252
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy