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; 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 used 7.5% for my tax rate. Once you create and run your program, all the following should be output from your program, except your store name and numbers will be different: Sears Bike and Board Shop order: 3 bikes at $109.95 per bike is $329.85 5 surfboards at $219.00 per surfboard is $1095.00 Order Total: $1424.85 Tax Amount: $106.86 Total Amount Due: $1531.71 Thank you for your order.

Solutions

Expert Solution

Source Code:

#include<stdio.h>
int main()
{
   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;
   printf("enter the bike cost and surfboard_cost in $\n");
   scanf("%f %f",&bike_cost,&surfboard_cost);
   printf("enter the number of bikes and surfboards \n");
   scanf("%d %d",&num_bikes,&num_surfboards);
   printf("enter the tax rate in %%\n");
   scanf("%f",&tax_rate);
   total_cost_bikes=num_bikes*bike_cost; //to calculate total cost of bikes
   total_cost_surfboards=num_surfboards*surfboard_cost; //to calculate total cost of surfboards
   total_cost=total_cost_bikes+total_cost_surfboards; // total amount without tax is calculated
   tax_amount=total_cost*tax_rate/100; // tax amount is calculated
   total_amount_with_tax=total_cost+tax_amount; //total amount with taxt is calculated
   printf("total cost of bikes is :%0.2f$\n",total_cost_bikes);
   printf("total cost of bikes is :%0.2f$\n",total_cost_surfboards);
   printf("Order Total :%0.2f$\n",total_cost);
   printf("total Tax Amount is :%0.2f$\n",tax_amount);
   printf("Total Amount Due:%0.2f$",total_amount_with_tax);
   return 0;
}

Output:

enter the bike cost and surfboard_cost in $
109.95 219.00
enter the number of bikes and surfboards
3 5
enter the tax rate in %
7.5
total cost of bikes is :329.85$
total cost of bikes is :1095.00$
Order Total :1424.85$
total Tax Amount is :106.86$
Total Amount Due:1531.71$
--------------------------------
Process exited after 8.606 seconds with return value 0
Press any key to continue . . .


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;
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 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...
You must write a C program that prompts the user for numbers and multiplies them using...
You must write a C program that prompts the user for numbers and multiplies them using "a la russe" multiplication. No input is allowed at execution time (no command line input). The program MUST DISPLAY YOUR BANNER LOGO as part of a prompt to the user. A menu must allow the user to put in two numbers at the same time or each of two numbers one at a time. The valid range of values for each number is 0...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT