Respuesta :
Answer:
C code is explained below
Explanation:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
// Declaring variables
int mins;
float data, tot = 0.0;
// Declaring constants
const float MONTHLYPLAN = 39.99;
const float ADDITIONALCHARGES = 0.40;
const float DATACHARGES = 10;
const double ADDITIONALDATA = 10;
const double TAX = 5.25;
// Getting the inputs entered by the user
printf("Enter the number of minutes:");
scanf("%d", &mins);
printf("Enter the data in GB:");
scanf("%f", &data);
printf("Your Monthly Charges as follows.\n");
if (mins <= 600)
{
printf("Monthly Plan:$%.2f\n", MONTHLYPLAN);
tot += MONTHLYPLAN;
}
else if (mins > 600)
{
printf("Monthly Plan:$%.2f\n", MONTHLYPLAN);
printf("Additional per minute charges :$%.2f\n", (mins - 600) * ADDITIONALCHARGES);
tot += MONTHLYPLAN + (mins - 600) * ADDITIONALCHARGES;
}
if (data <= 2)
{
printf("Data charges :$%.2f\n", DATACHARGES);
tot += DATACHARGES;
}
else
{
printf("Data charges :$%.2f\n", DATACHARGES);
printf("Additional Data charges :$%.2f\n", ceil(data - 2) * ADDITIONALDATA);
tot += DATACHARGES + ceil(data - 2) * ADDITIONALDATA;
}
printf("Pretax total: $%.2f\n", tot);
printf("Tax Paid : $%.2f\n", tot * (TAX / 100));
printf("Total : $%.2f\n", tot + tot * (TAX / 100));
return 0;#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
// Declaring variables
int mins;
float data, tot = 0.0;
// Declaring constants
const float MONTHLYPLAN = 39.99;
const float ADDITIONALCHARGES = 0.40;
const float DATACHARGES = 10;
const double ADDITIONALDATA = 10;
const double TAX = 5.25;
// Getting the inputs entered by the user
printf("Enter the number of minutes:");
scanf("%d", &mins);
printf("Enter the data in GB:");
scanf("%f", &data);
printf("Your Monthly Charges as follows.\n");
if (mins <= 600)
{
printf("Monthly Plan:$%.2f\n", MONTHLYPLAN);
tot += MONTHLYPLAN;
}
else if (mins > 600)
{
printf("Monthly Plan:$%.2f\n", MONTHLYPLAN);
printf("Additional per minute charges :$%.2f\n", (mins - 600) * ADDITIONALCHARGES);
tot += MONTHLYPLAN + (mins - 600) * ADDITIONALCHARGES;
}
if (data <= 2)
{
printf("Data charges :$%.2f\n", DATACHARGES);
tot += DATACHARGES;
}
else
{
printf("Data charges :$%.2f\n", DATACHARGES);
printf("Additional Data charges :$%.2f\n", ceil(data - 2) * ADDITIONALDATA);
tot += DATACHARGES + ceil(data - 2) * ADDITIONALDATA;
}
printf("Pretax total: $%.2f\n", tot);
printf("Tax Paid : $%.2f\n", tot * (TAX / 100));
printf("Total : $%.2f\n", tot + tot * (TAX / 100));
return 0;
}