Question

In: Computer Science

Write a C program that summarizes an order from a fictitious store. You must have these...

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;

Solutions

Expert Solution

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:


Related Solutions

Write a C program that summarizes an order from a fictitious store. You must have these...
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; You will assign your own unique values for each of the variables, except the totals which are computed. No other variables are needed in the program. For example, you will see the numbers I picked in my program in the sample output below. I...
Write a C++ program that summarizes all of the Oscars that a given actor or movie...
Write a C++ program that summarizes all of the Oscars that a given actor or movie has won or been nominated for. You have been provided with a CSV file with all of the Oscar wins and nominations below. Each row of this file contains 4 pieces of information, separated by commas: the year, the award category, whether they won the award (TRUE or FALSE), and the recipient. Note that the award category and the year may have multiple words...
Program must be in C++! Write a program which: Write a program which uses the following...
Program must be in C++! Write a program which: Write a program which uses the following arrays: empID: An array of 7 integers to hold employee identification numbers. The array should be initialized with the following values: 1, 2, 3, 4, 5, 6, 7. Hours: an array of seven integers to hold the number of hours worked by each employee. payRate: an array of seven doubles to hold each employee’s hourly pay rate. Wages: an array of seven doubles to...
CODE MUST BE IN C++ write a program that loops a number from 1 to 10...
CODE MUST BE IN C++ write a program that loops a number from 1 to 10 thousand and keeps updating a count variable (count variable starts at 0 ) according to these rules: n1 = 14 n2 = 54 n3 = 123 if the number is divisible by n1, increase count by 1 if the number is divisible by n2, increase count by 2 if the number is divisible by n3, increase count by 3 if none of the above...
Write a C program that will read different data types from the following file and store...
Write a C program that will read different data types from the following file and store it in the array of structures. Given file: (This file have more than 1000 lines of similar data): time latitude longitude depth mag magType nst gap dmin 2020-10-19T23:28:33.400Z 61.342 -147.3997 12.3 1.6 ml 12 84 0.00021 2020-10-19T23:26:49.460Z 38.838501 -122.82684 1.54 0.57 md 11 81 0.006757 2020-10-19T23:17:28.720Z 35.0501667 -117.6545 0.29 1.51 ml 17 77 0.1205 2020-10-19T22:47:44.770Z 38.187 -117.7385 10.8 1.5 ml 15 100.22 0.049 2020-10-19T22:42:26.224Z...
write a c++ program using micro soft visual studio 2010 to write a program and store...
write a c++ program using micro soft visual studio 2010 to write a program and store 36 in variable x and 8 in variable y. add them and store the result in the variable sum. then display the sum on screen with descriptive text. calculate the square root of integer 36 in x. store the result in a variable. calculate the cube root of integer 8 in y. store result in a variable. display the results of square root and...
Write a short and simple C++ program (must be able to have custom inputs): Design a...
Write a short and simple C++ program (must be able to have custom inputs): Design a class that holds the following personal data: name, address, age, and phone number Write appropriate accessor and mutator functions. Demonstrate the class by writing a program that creates three instances of it. One instance should hold your information, and the other two should hold your friends' or family members' information. Thanks!!
3. Write a C++ program that takes in the name of a store, and the following...
3. Write a C++ program that takes in the name of a store, and the following details for 4 employees working at the store; their first name, last name, number of hours they worked that week and how much they are paid per hour. Your program should output the name of the store, along with each employee's full name and how much they earned that week in the manner below. Monetary values should be format to 2 decimal places. Also...
Write a C program to store the parameters of a circle on a 2D plane: the...
Write a C program to store the parameters of a circle on a 2D plane: the x and y coordinates of the center point and r, the radius. All three parameters are real (floating point) numbers. -Define a type to store the parameters of a circle. Write a function that receives the parameters of two circles as function parameters, and returns whether the two circles overlap or not. (Two circles overlap if the distance between their center points - computed...
Write a program that does the following in C++ 1 ) Write the following store data...
Write a program that does the following in C++ 1 ) Write the following store data to a file (should be in main) DC Tourism Expenses 100.20 Revenue 200.50 Maryland Tourism Expenses 150.33 Revenue 210.33 Virginia Tourism Expenses 140.00 Revenue 230.00 2 ) Print the following heading: (should be in heading function) Store name | Profit [Note: use setw to make sure all your columns line up properly] 3 ) Read the store data for one store (should be in...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT