RSS Forums RSS
Please support our C++ advertiser: Programming Forums
Views: 231 | Replies: 2 | Thread Tools  Display Modes
Reply
Join Date: May 2008
Posts: 7
Reputation: Xokzin is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Xokzin Xokzin is offline Offline
Newbie Poster

Algorithim

  #1  
May 29th, 2008
Hi There,

I'm learning C++. One of the questions requires a function to do a calculation below. I have no clue how to do this. Can anybody help?

WeTryToHelp gives bursaries to help students with buying their textbooks. The amount of money depends on how
many modules the student passed during 2007 and for how many modules the student is registered in 2008. It works
as follows:
• if the student did not pass any modules in 2007: no bursary,
• if the student passed 1 or 2 modules in 2007 and is registered for at least 1 module in 2008: R300,
• otherwise: the bursary is equal to (number of modules passed + number of modules registered) * 100.
Three examples: If the student passed 4 modules in 2007 and is registered for 5 modules in 2008, the bursary will be
R900. If the student passed 2 modules in 2007 and is registered for 5 modules in 2008, the bursary will be R300. If
the student did not pass any modules in 2007 and is registered for 5 modules in 2008, no bursary will be given.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2006
Location: the Netherlands
Posts: 1,895
Reputation: niek_e is a name known to all niek_e is a name known to all niek_e is a name known to all niek_e is a name known to all niek_e is a name known to all niek_e is a name known to all 
Rep Power: 12
Solved Threads: 203
niek_e's Avatar
niek_e niek_e is offline Offline
Posting Virtuoso

Re: Algorithim

  #2  
May 29th, 2008
This is not a free homework service. You'll have to show some effort before you get help. So post what you've done so far.
Or ask specific questions
Last edited by niek_e : May 29th, 2008 at 4:34 am.
Want better/more replies to your questions? Wrap your code in [code] [/code] tags!
do NOT pm me for help, in the best case, you'll get ignored
Reply With Quote  
Join Date: May 2008
Posts: 7
Reputation: Xokzin is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Xokzin Xokzin is offline Offline
Newbie Poster

Re: Algorithim

  #3  
May 29th, 2008
Fair enough. Here is the code

  1. #include <iostream>
  2. using namespace std;
  3. //modP is the passed modules and modR is registered modules
  4. float bursary(float modP, float modR)
  5. {
  6. float burs;
  7. {if (modP == 0)
  8. burs = 0;
  9. else if (modP == 1 && modR >= 1)
  10. burs = (modP * 300);
  11. else
  12. burs = ((modP + modR)*100);
  13. }
  14.  
  15. return burs;
  16. }
Last edited by Narue : May 29th, 2008 at 12:14 pm. Reason: Changed quote to code tags
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Similar Threads
Other Threads in the C++ Forum
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 10:24 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC