In: Computer Science
Write a C program that summarizes an order from a fictitious store. You must have these four lines in your program: float bike_cost, surfboard_cost; float tax_rate, tax_amount; int num_bikes, num_surfboards; float total_cost_bikes, total_cost_surfboards; float total_cost, total_amount_with_tax;
SOURCE CODE:
#include<stdio.h>
#include<stdlib.h>
int main()
//main
method
{
float
bike_cost,surfboard_cost,tax_rate,tax_amount,total_cost_bikes,total_cost_surfboards,total_cost,total_amount_with_tax;
//declaring float variables
int num_bikes,num_surfboards;
//declaring int
variables
printf("Enter the cost of a bike: ");
scanf("%f",&bike_cost);
//Taking the input of the cost of a bike
printf("Enter the cost of a surfboard: ");
scanf("%f",&surfboard_cost);
//Taking the input of the
cost of a surfboard
printf("Enter the tax rate: ");
scanf("%f",&tax_rate);
//Taking the input of the tax rate
printf("Enter the number of bikes: ");
scanf("%d",&num_bikes);
//Taking the input of the number of bikes
printf("Enter the number of surfboards: ");
scanf("%d",&num_surfboards);
//Taking the input of the
number of surfboards
total_cost_bikes=bike_cost*num_bikes;
total_cost_surfboards=surfboard_cost*num_surfboards;
total_cost=total_cost_bikes+total_cost_surfboards;
tax_amount=tax_rate*total_cost;
total_amount_with_tax=tax_amount+total_cost;
printf("\nTotal cost of only the bikes is=
%f",total_cost_bikes);
//Print
the total cost of the bikes
printf("\nTotal cost of only the surfboards is=
%f",total_cost_surfboards);
//Print the total cost of the surfboards
printf("\nTotal cost of the bikes and surfboards
together is= %f",total_cost);
//Print the total cost of the bikes and surfboards together
printf("\nTotal tax implemented is=
%f",tax_amount);
//Print the tax
implemented
printf("\nTotal cost of the bikes and surfboards
together with tax implemented is=
%f",total_amount_with_tax); //Print
the total cost of the bikes and surfboards together with tax
implemented
return 0;
}
OUTPUT: