Algorithm
URI 1009 Problem Link: https://www.urionlinejudge.com.br/judge/en/problems/view/1009
URI 1009 Problem Details:
Make a program that reads a seller's name, his/her fixed salary and the sale's total made by himself/herself in the month (in money). Considering that this seller receives 15% over all products sold, write the final salary (total) of this seller at the end of the month , with two decimal places.
- Don’t forget to print the line's end after the result, otherwise you will receive “Presentation Error”.
- Don’t forget the blank spaces.
Input
The input file contains a text (employee's first name), and two double precision values, that are the seller's salary and the total value sold by him/her.
Output
Print the seller's total salary, according to the given example.
Input Samples | Output Samples |
JOAO |
TOTAL = R$ 684.54 |
PEDRO |
TOTAL = R$ 700.00 |
Code Examples
#1 Code Example with C Programming
Code -
C Programming
#include <stdio.h>
int main()
{
double salary, value, total;
char name;
scanf("%s %lf %lf", &name, &salary, &value);
total = salary+value*.15;
printf("TOTAL = R$ %.2lf\n", total);
return 0;
}
Copy The Code &
Try With Live Editor
Input
500.00
1230.30
Output
#2 Code Example with C++ Programming
Code -
C++ Programming
#include <cstdio>
int main()
{
double a;
double b;
char word[256];
scanf("%s", &word);
scanf("%lf", &a);
scanf("%lf", &b);
printf("TOTAL = R$ %.2lf\n", a + ((b/100)*15));
return 0;
}
Copy The Code &
Try With Live Editor
Input
700.00
0.00
Output
Demonstration
Other Examples:
URI Solution 1009 Code in Java/ URI 1009 solution in Java:
import java.util.Scanner; public class Main { public static void main(String[] args) { double salary = 0,value, TOTAL; String name; Scanner sc = new Scanner(System.in); name = sc.next(); salary = sc.nextDouble(); value = sc.nextDouble(); TOTAL = salary + value * 0.15; System.out.printf("TOTAL = R$ %.2f\n",TOTAL); } }
URI Solution 1009 Code / URI 1009 solution in Python:
nome = input() salfixo = float(input()) qtdevendas = float(input()) bonus = float(qtdevendas * (15/100)) total = salfixo + bonus print("TOTAL = R$ %0.2f" %total)
URI Solution 1009 Code / URI 1009 solution in C# (C Sharp):
Demonstration:
seller receives 15% over all products sold is in the problem and so multiply the result like this .15
TOTAL = salary + value * 0.15;
Just implement this in coding. Since having any problem just put a comment below. Thanks