need help finishing the last pieces i haven't finshed yet using c

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Nov 2007
Posts: 38
Reputation: wollacott is an unknown quantity at this point 
Solved Threads: 0
wollacott wollacott is offline Offline
Light Poster

need help finishing the last pieces i haven't finshed yet using c

 
0
  #1
Feb 10th, 2008
can anyone help me finish my program please. thank you
  1. #include <stdio.h>
  2. #include <math.h>
  3. int main()
  4.  
  5. {
  6. int product;
  7. float product1 = 2.98;
  8. float product2 = 4.50;
  9. float product3 = 9.98;
  10. float product4 = 4.49;
  11. float product5 = 6.87;
  12. float quantity = 1;
  13. double unitprice;
  14. float result;
  15. double total;
  16.  
  17. printf( "Enter product number \n");
  18. scanf("%f",&);
  19.  
  20. printf( "Enter quantity : \n" );
  21. scanf("%f",&);
  22.  
  23. switch(product) {
  24. case 1:
  25. unitprice = 2.98;
  26. break;
  27. case 2:
  28. unitprice = 4.50;
  29. break;
  30. case 3:
  31. unitprice = 9.95;
  32. break;
  33. case 4:
  34. unitprice = 3.89;
  35. case 5:
  36. unitprice = 9.98;
  37. break;
  38. default:
  39.  
  40.  
  41.  
  42. total = unitprice * quantity;
  43. printf( "total is:",total);
  44. }
  45. }
Last edited by Ancient Dragon; Feb 10th, 2008 at 8:15 am. Reason: add code tags
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 5,051
Reputation: John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold 
Solved Threads: 332
Team Colleague
John A's Avatar
John A John A is offline Offline
Vampirical Lurker

Re: need help finishing the last pieces i haven't finshed yet using c

 
0
  #2
Feb 10th, 2008
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.
"Technological progress is like an axe in the hands of a pathological criminal."

All my posts may be freely redistributed under the terms of the MIT license.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 38
Reputation: wollacott is an unknown quantity at this point 
Solved Threads: 0
wollacott wollacott is offline Offline
Light Poster

Re: need help finishing the last pieces i haven't finshed yet using c

 
0
  #3
Feb 10th, 2008
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.
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 5,051
Reputation: John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold 
Solved Threads: 332
Team Colleague
John A's Avatar
John A John A is offline Offline
Vampirical Lurker

Re: need help finishing the last pieces i haven't finshed yet using c

 
0
  #4
Feb 10th, 2008
And...? Does the code that you posted work? What part of this is giving you problems?
"Technological progress is like an axe in the hands of a pathological criminal."

All my posts may be freely redistributed under the terms of the MIT license.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 38
Reputation: wollacott is an unknown quantity at this point 
Solved Threads: 0
wollacott wollacott is offline Offline
Light Poster

Re: need help finishing the last pieces i haven't finshed yet using c

 
0
  #5
Feb 10th, 2008
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",&);
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 5,051
Reputation: John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold 
Solved Threads: 332
Team Colleague
John A's Avatar
John A John A is offline Offline
Vampirical Lurker

Re: need help finishing the last pieces i haven't finshed yet using c

 
0
  #6
Feb 10th, 2008
Variables that will hold what the user enters.
Last edited by John A; Feb 10th, 2008 at 1:40 am.
"Technological progress is like an axe in the hands of a pathological criminal."

All my posts may be freely redistributed under the terms of the MIT license.
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 2,042
Reputation: Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of 
Solved Threads: 178
Aia's Avatar
Aia Aia is offline Offline
Postaholic

Re: need help finishing the last pieces i haven't finshed yet using c

 
0
  #7
Feb 10th, 2008
Originally Posted by wollacott View Post
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",&);
  1. int product;
  2. scanf( "%d", &product );
  3.  
  4. int quantity;
  5. scanf( "%d", &quantity );
"If it moves, tax it. If it keeps moving, regulate it, and if it stops moving, subsidize it" - Ronald Reagan
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for C
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC