View Single Post
Old 04-02-2005, 12:07 AM   #6 (permalink)
cleverest
Registered User
 
Join Date: Mar 2005
Posts: 22
cleverest is on a distinguished road
Thanks, program continuing :-D

Awesome, thanks for the info! I've worked more on this program and this is what I have so far? Am I on the right track? If not could you show the first initial steps that would be ideal to program in the main() function to assure I'm on the right track?? (please read my comments in the revised code....)

Also are the functions I filled out below good?? The last one is questionable to me...

Thanks again!


Code:
#include <iostream>

using namespace std;

//--
const double FALLSPRING_COST = 30.00;
const double WINTERSUMMER_COST = 27.00;
const double PARK_FALLSPRING_COST = 75.00;
const double PARK_WINTERSUMMER_COST = 35.00;
const double ENROLL_CALI = 26.00;
const double ENROLL_US = 149.00;
const double ENROLL_VISA = 171.00;
const double REFUND_FALLSPRING =  10.00;
const double REFUND_WINTERSUMMER = 9.00;
//--

//fsws true = FALLSPRING COST, false is WINTERSUMMER.
double student_services_cost(bool fsws);
double parking_cost(bool fsws);
double student_sticker_refund(bool fsws);
//r: 'c' =  california, 'u' = US residents, 'v' =  visa holders;
double enrollment_cost(char r);

//---------------------------------------------

int main()
{
        bool fsws; 
	char insemester;
	char pause;

    cout << "Student Fee Calculator:\n";
    cout << "What semester am I calculating fees for? [F]all/[W]inter\n";
    cout << "[S]pring/su[M]mer]:";
    cin >> insemester;  

/*  IS this variable/method not how I should be 
collecting the cin >> input?  or is this OK?? */


/* No matter what I do with the following 
code the number '30' is outputted when I test this 
IF statement block by using cout.....never '27' 
for the SUMMER/WINTER selections.... what am I doing wrong?  
I know it has to be a real simple answer...I'm just not 
getting it.....at worst...would you be willing to do just the initial one for me to 
illustrate for me the ideal way to do such a simple process....it's gonna sink
in eventually, lol  I really appreciate it!
*/


            if (insemester == 'F' || 'S')  
	{
	   fsws = true;
	   double student_services_cost(bool fsws);
	   cout << FALLSPRING_COST;
	   return FALLSPRING_COST;
	}
	if (insemester == 'W' || 'M');
	{
	   fsws = false;
	   double student_services_cost(bool fsws);
	   cout << WINTERSUMMER_COST;
	   return WINTERSUMMER_COST;
	}

	cin >> pause;       // temporary pause for now....


  return 0;
}

//----------------------------------------------

double student_services_cost(bool fsws)
{
   if(fsws == true)
   {
      return FALLSPRING_COST;
   }
   return WINTERSUMMER_COST;
}

//----------------------------------------------

double parking_cost(bool fsws)
{
   if(fsws == true)
   {
      return PARK_FALLSPRING_COST;
   }
   return PARK_WINTERSUMMER_COST;
}  

//----------------------------------------------

double student_sticker_refund(bool fsws)
{
   if(fsws == true)
   {
      return REFUND_FALLSPRING;
   }
   return REFUND_WINTERSUMMER;
}

//----------------------------------------------

double enrollment_cost(char r)
{
   if(r == 'c')
   {
      return ENROLL_CALI;
   }
   if(r == 'u')
   {
      return ENROLL_US;
   }
   if(r == 'v')
   {
      return ENROLL_VISA;
   }


}
cleverest is offline   Reply With Quote