can anyone help me finish my program please. thank you

#include <stdio.h>
#include <math.h>
int main()

{
int product;
float product1 = 2.98; 
float product2 = 4.50;  
float product3 = 9.98; 
float product4 = 4.49; 
float product5 = 6.87;
float quantity = 1;
double unitprice;
float result;
double total;

printf( "Enter product number \n");
scanf("%f",&);

printf( "Enter quantity : \n" );
scanf("%f",&);

switch(product) {
case 1:
unitprice = 2.98;
break;
case 2:
unitprice = 4.50;
break;
case 3:
unitprice = 9.95;
break;
case 4:
unitprice = 3.89;
case 5:
unitprice = 9.98;
break;
default:



total = unitprice * quantity;
	printf( "total is:",total);
}
}

Recommended Answers

All 6 Replies

Sorry, but you seem to have missed several ReadMes in your rush to post. Firstly, we are not here to do your homework. We're happy to help and answer any question you may have, though. Secondly, use CODE tags when posting code! Without them code is very unreadable.

I'd like to know how you even expect us to figure out what the rest of your assignment is without you telling us.

a mail order hopuse sells five different products whose retail prices are shown below
product number retail price
1-5 2.98,4.50,9.98,4.49,6.87
your program should use a switch statements to help determine the retail price for each product. your program shoulds also calculate and display the total retail value of all products sold last week.

And...? Does the code that you posted work? What part of this is giving you problems?

i havent tried it yet caz i'm stuck here what shud i put after & so it can work?
printf( "Enter product number \n");
scanf("%f",&);

printf( "Enter quantity : \n" );
scanf("%f",&);

Variables that will hold what the user enters.

i havent tried it yet caz i'm stuck here what shud i put after & so it can work?
printf( "Enter product number \n");
scanf("%f",&);

printf( "Enter quantity : \n" );
scanf("%f",&);

int product;
scanf( "%d", &product );

int quantity;
scanf( "%d", &quantity );
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.