[URI Online Judge] – 1009 – Salary with Bonus

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), and two double values, that are 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 Inputs Sample Outputs
JOAO
500.00
1230.30
TOTAL = R$ 684.54
PEDRO
700.00
0.00
TOTAL = R$ 700.00
MANGOJATA
1700.00
1230.50
TOTAL = R$ 1884.58

Solution:

#include <cstdio>
#include <cmath>

int main(){
char a[300];
float b, c;
scanf(“%s”, a);
scanf(“%f”, &b);
scanf(“%f”, &c);
printf(“TOTAL = R$ %.2f\n”, b + round((c * 0.15) * 100) / 100);
return 0;
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s