Sunday, October 20, 2013

uri OJ 1009 Salary with Bonus problem c++ solution

uri OJ 1009 Salary with Bonus problem: http://www.urionlinejudge.com.br/judge/en/problems/view/1009

URI Online Judge | 1009

Salary with Bonus

Timelimit: 1
You have to calculate the final salary for your employee, based on value sold by him. So you have to read his name, his fixed salary and the value sold by him. Your functionary wins 15% over all products sold. Write the final (total) salary of this functionary, rounded to two decimal places.
- Don’t forget to print end line after the result otherwise you will get “Presentation Error”.
- Don’t forget the blank spaces.

Input

The input file contains an string (employee first name), the salary of this employee and the total value sold by him.

Output

Print the total salary of the employee, according to the given example.
Sample InputSample Output
JOAO
500.00
1230.30
TOTAL = R$ 684.54
my c++ solution to uri OJ 1009 Salary with Bonus problem:

#include <iostream>
#include <string>
#include <iomanip>
using namespace std;

int main() {
    // your code goes here
    double a, b;
    string c;
    cin>>c>>a>>b;
    cout<<"TOTAL = R$ "<<fixed<<setprecision(2)<<a+(b*15)/100<<endl;
    return 0;
}

4 comments:

  1. Replies
    1. http://ideone.com/NVkndU

      check out now

      #include
      #include
      #include
      using namespace std;

      int main() {
      // your code goes here
      double a, b;
      string c;
      cin>>c>>a>>b;
      cout<<"TOTAL = R$ "<<fixed<<setprecision(2)<<a+(b*15)/100<<endl;
      return 0;
      }

      Delete
  2. Replies
    1. http://ideone.com/NVkndU

      check out now

      #include
      #include
      #include
      using namespace std;

      int main() {
      // your code goes here
      double a, b;
      string c;
      cin>>c>>a>>b;
      cout<<"TOTAL = R$ "<<fixed<<setprecision(2)<<a+(b*15)/100<<endl;
      return 0;
      }

      Delete