Create a program in C, for a store, that asks the user to select one of the options below and you must use function pointers to call the user’s choice of function for options 1 through 7
1. Determine and print total revenue. This is calculated as the sum of retail price * retail quantity for all items.
2. Determine and print total sale cost. This is calculated as the sum of sale price * sale quantity for all items
3. Determine and print the current investment. This is calculated as the sum of sale price * (sale quantity – retail quantity).
4. Determine and print profit. This is total revenue (#1) minus total sale cost (#2) plus cost of current investment (#3).
5. Determine and print total number of sales. This is calculated as the sum of the retail quantity.
6. Determine and print average profit per sale. This is profit (#4) divided by total number of sales (#5).
7. Print items in stock. This function should print each item into a list.
#include<stdio.h>
#include<conio.h>
void calling(int ch)
{
float rp,rq,total_revenue,sp,sq,total_sale_cost,current_inv;
float tr,tsc,profit,srq,pr,tns,average_pr;
switch(ch)
{
case 1:
{
printf("\nenter the sum of retail
price: ");
scanf("%f",&rp);
printf("\nenter the retail
quantity: ");
scanf("%f",&rq);
total_revenue=rp*rq;
printf("\nThe total revenue is
%f",total_revenue);
break;
}
case 2:
{
printf("enter the sum of sale
price: ");
scanf("%f",&sp);
printf("enter the sale quantity for
all items: ");
scanf("%f",&sq);
total_sale_cost=sp*sq;
printf("The total sale cost is
%f",total_sale_cost);
break;
}
case 3:
{
printf("enter the sum of sale
price: ");
scanf("%f",&sp);
printf("enter the sale quantity:
");
scanf("%f",&sq);
printf("enter the retail quantity:
");
scanf("%f",&rq);
current_inv=sp*(sq-rq);
printf("\ntotal current_investment
is %f",current_inv);
break;
}
case 4:
{
printf("enter total revenue:
");
scanf("%d",&tr);
printf("enter the total sale cost:
");
scanf("%d",&tsc);
printf("enter the cost of
current_investment: ");
scanf("%d",¤t_inv);
profit=tr-tsc+current_inv;
printf("The profit is %d
",profit);
break;
}
case 5:
{
printf("enter the total sum of
retail quantity: ");
scanf("%f",&srq);
printf("\ntotal number of sales is
%f",srq);
break;
}
case 6:
{
printf("enter profit: ");
scanf("%d",&pr);
printf("enter total number of
sales: ");
scanf("%d",tns);
average_pr=pr/tns;
printf("the average profit is %d
",average_pr);
break;
}
case 7:
{
printf("1.guitar 200 piece
");
printf("2.laptop 100 piece
");
printf("3.mobile 3000 piece
");
break;
}
default:
printf("wrong choice entered");
}
}
void main()
{
int a;
void (*call_ptr)(int)=&calling;
clrscr();
printf("enter your choic from 1 to 7: ");
scanf("%d",&a);
(*call_ptr)(a);
getch();
}


.
.
.
.
DON'T FORGET TO LIKE.
THANKS BY HEART
Create a program in C, for a store, that asks the user to select one of...
C program help: Write a C program that uses three functions to perform the following tasks: – The first function should read the price of an item sold at a grocery store together with the quantity from the user and return all the values to main(). example: #include void getInput(int *pNum1, int *pNum2); // note: *pNum1 & *pNum2 are pointers to ints int main () { int numDucks,numCats; getInput(&numDucks, &numCats); // passing addresses of num1 & num2 to...
You are to write a program IN C++ that asks the user to enter an item's wholesale cost and its markup percentage. It should then display the item's retail price. For example: if the an item's wholesale cost is 5.00 and its markup percentage is 100%, then the item's retail price is 10.00 If an item's wholesale cost is 5.00 and its markup percentage is 50%, then the item's retail price is 7.50 Program design specs. You should have 5...
1. Markup Write a program that asks the user to enter an item's wholesale cost and its markup percentage. It should then display the item's retail price. For example: . If an item's wholesale cost is $5.00 and its markup percentage is 100 percent, then . If an item's wholesale cost is $5.00 and its markup percentage is 50 percent, then The program should have a function named calculateReta1l that receives the wholesale the item's retail price is $10.00. the...
We use JAVA. Thanks. Create an application whose main method asks the user to enter an n by m integer matrix that contains nm integer numbers. n and m should be between 1 and 10. If the user enters a number less than 1 or greater than 10, the program will continue to ask the user to enter an integer number between 1 and 10. The program should print the sum of the boundary elements of the matrix....
Assignment Content PROGRAM DESCRIPTION Make a program that will allow the user to select a choice from the following options: A-getCount B-getSum C-checkNum D-getFactorial X - Exit Each options (A,B,C) must have its own user-defined function. The program must repeat the program until the user enters "X". Options are: 1. getCount. The module is designed to encode numbers until user enters "x" and determine the number of positive and negative numbers of the encoded numbers within the module. 2. getSum....
Write a C program that asks the user to enter three numbers (integres). A menu will be displayed to let the user choose one of the three options: print the two highest numbers, product of the three numbers or the division of the second by the by the third if the third is not zero. See the sample runs. Required: Your code must use -One function to get the numbers from the user One function for each of the three...
Create a program with the main function and one additional function. The additional function asks for input from the user and returns the output back to the main function for display. This is for c++ and here is my code, could you guys please tell me what I am missing from the instructions. Thank you #include <iostream> using namespace std; int sum (int, int); int main() { int n1, n2, total; cout << "Enter two numbers...
Write a C++ program that asks the user to enter a single number from 1 to 50 and a choice of "even" or "odd". Using a recursive function, output the sum of all the even or odd integers from 1 up to (and including) that number. Your program does not need to loop and accept more input (only one input of the number then even/odd).
Create a program using C++ for a store. It will be a ledger for daily transactions. It should be able to record the transactions on a date. The transactions will happen at a given time (hour, minute, second). Also, every transaction must have a unique ID that is a number that is randomly generated by the system. *Note that the transaction has an ID, NOT the items. There will be no more than 10 transactions on a date. Within every...
(C programing, Not C++) Write a program in C that asks the user to input 10 numbers. Store these numbers in an array. Then ask the user to input a single number. Your program should execute a linear search on the array, trying to find that number. If the number exists in the array, have the program print out which position/element the number was found at. If the target number is not in the array, have the program print out...