2
- Do a program that receives the number of hours worked, the value of the minimum wage and the number of overtime worked, calculate and show the salary you receive, following the rules below:
a. The hour worked is worth 1/8 of the minimum wage;
b. Overtime is worth ¼ of minimum wage;
c. Gross wage equals the number of hours worked multiplied by the value of the hour worked;
d. The amount receivable for overtime equals the number of overtime worked multiplied by the value of overtime;
e. The salary to be received is equivalent to the gross wage plus the amount to be received for overtime.
Code
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
//Variáveis
double numero_horas_trabalhadas;
double salarioMinimo;
double numero_horas_extras;
double valor_hora, valor_hora_extra, salarioBruto, salarioTotal;
//Entrada de dados
printf("Olá, vamos calcular o seu salário!");
printf("\nDigite as horas trabalhadas: ");
scanf("%f",&numero_horas_trabalhadas);
printf("\nDigite o valor do salario minimo: ");
scanf("%f",&salarioMinimo);
printf("\nDigite o numero de horas extras trabalhadas: ");
scanf("%f",&numero_horas_extras);
//Processamento
valor_hora = salarioMinimo/8;
valor_hora_extra = salarioMinimo/4;
salarioBruto = (numero_horas_trabalhadas * valor_hora);
valor_hora_extra = (numero_horas_trabalhadas * valor_hora_extra);
salarioTotal = salarioBruto + valor_hora_extra;
//Saída de informação
printf ("O valor do salario minimo e : %f",salarioTotal);
Your first problem posted here has been solved? What is the problem of this now?
– Maniero
The first was solved yes.
– Karolayne Santos
This error is in processing, the final salary is showing 0
– Karolayne Santos
Always try to post as much information as possible to help people understand their problem. Then take a look at this: [tour]. I’ve found the problem with this one.
– Maniero
Did you try to print the individual values read? And the intermediate values? This can help you better identify where the bug is instead of looking at the program as a whole and wondering where it might be.
– mgibsonbr
Okay, thank you! I’m sorry, I’m new around here so I’m still learning. Thank you so much for the strength!
– Karolayne Santos
@Karolaynesantos it is normal to take a while to get the hang of it, we are here to help. Do not forget to read the [tour]
– Maniero