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...
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