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...
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 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...
Write a program in c# that declare a variable and store user name jjohn in. Then,...
Write a program in c# that declare a variable and store user name jjohn in. Then, write a statement that will make your program display at the screen the content of that variable, followed by " I would like to know your height in centimeter. Please enter it:". Then, write a statement that will store the value entered by the user, allowing decimal numbers ie some precision, a fraction part. Finally, write statements (more than one can be needed) so...
IN C++ Write a program to play the Card Guessing Game. Your program must give the...
IN C++ Write a program to play the Card Guessing Game. Your program must give the user the following choices: - Guess only the face value of the card. -Guess only the suit of the card. -Guess both the face value and suit of the card. Before the start of the game, create a deck of cards. Before each guess, use the function random_shuffle to randomly shuffle the deck.
Must be done in C Write a C program found out the maximum value between the...
Must be done in C Write a C program found out the maximum value between the three numbers? Show steps with comments or else it will be flagged.
Please write in C. This program will store roster and rating information for a soccer team....
Please write in C. This program will store roster and rating information for a soccer team. Coaches rate players during tryouts to ensure a balanced team. (1) Prompt the user to input five pairs of numbers: A player's jersey number (0 - 99) and the player's rating (1 - 9). Store the jersey numbers in one int array and the ratings in another int array. Output these arrays (i.e., output the roster). (3 pts) ex Enter player 1's jersey number:...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT