View Single Post
Old 04-01-2005, 12:49 PM   #1 (permalink)
cleverest
Registered User
 
Join Date: Mar 2005
Posts: 22
cleverest is on a distinguished road
Exclamation Assignment I have, it's crazy for little 'ol me...help?

The goal is to use a few functions (at least one passed by value, and one passed by reference). any kind of loops....No pointers/arrays cause we haven't got to those yet..... and I think I can only use the iostream/string headers and 'using namespace std;'

What I have so far below is very rough and it's only the start of the program, but if someone could suggest a foundation to start with I will steer is that direction, or at least tell me if I'm building upon the correct foundation already....like what exactly in the program dialog below should be FUNCTIONS and what should just be variables int he main() function?? I think this would help clarify things for me....thanks.

THIS IS WHAT THE PROGRAM SHOULD LOOK LIKE WHEN RAN
(3 examples are given below that the program should display,
BOLD text is user inputted values)

Student Fee Calculator:
What semester am I calculating fees for? [F]all/[W]inter/
[S]pring/su[M]mer]:W
Are you a California resident? [y/n]: y
Do you need a parking sticket? [y/n]: y
Are you requesting an AS sticker refund? [y/n]: n
How many units will you enroll in? 12
Your 12 units will cost 374.00


Student Fee Calculator:
What semester am I calculating fees for? [F]all/[W]inter/
[S]pring/su[M]mer]:F
Are you a California resident? [y/n]: y
Do you need a parking sticket? [y/n]: y
Are you requesting an AS sticker refund? [y/n]: n
How many units will you enroll in? 12
Your 12 units will cost 412.00


Student Fee Calculator:
What semester am I calculating fees for? [F]all/[W]inter/
[S]pring/su[M]mer]:F
Are you a California resident? [y/n]: n
Are you a US citizen? [y/n]: n
Are you an F1 visa holder? [y/n]: y
Do you need a parking sticket? [y/n]: y
Are you requesting an AS sticker refund? [y/n]: n
How many units will you enroll in? 12
Your 12 units will cost 2157.00


This is what I have so far which really only covers the very start of it...(with some comments).....just don't know if I'm going in the right direction and don't want to start witha shaky foundation.....I don't want my program completely written for me (not that I'm refusing) but I just need a good design plan/foundation so I can accomplish this the easiest way possible cause I REALLY WANT TO LEARN IT....



Code:
 
#include <iostream>
#include <string>
using namespace std;

int Semester(const int, const int, const int, const int); 
// is consst necessary/recommended for these?

int main()
{
    
    char inSemester;
    char pause;       // using this temporarily to PAUSE the output
    const int F = 30;
    const int W = 27;
    const int S = 30;
    const int M = 27;
    
    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;
    if (inSemester == 'F' || 'f')
    {
    int Semester(F);
    cout << Semester;   // just to confirm that it is reading the correct int value
    }
    if (inSemester == 'W' || 'w')
    {
    int Semester(W);
    cout << Semester;  // just to confirm that it is reading the correct int value
    }
    if (inSemester == 'S' || 's') /  
    {
    int Semester(S);
    cout << Semester;  // just to confirm that it is reading the correct int value
    }
    if (inSemester == 'M' || 'm')
    {
    int Semester(M);
    cout << Semester;  // just to confirm that it is reading the correct int value
    }

    
    
    cin >> pause;  // will remove later
    return 0;
}



int Semester(const int F = 30, const int W = 27, const int S = 30, const int M = 27)
{

    
     return F,W,S,M;  // is there a clearer and easier way for a beginner to do these functions?  Am I making this too complicated?
     
}
Oh also these are the rates to use for the calculation...

Description Cost:
Student Services
$30.00 for Fall or Spring semester
$27.00 for Winter or Summer session

Parking
$75.00 for Fall or Spring semester
$35.00 for Winter or Summer session

Enrollment Per Unit
$26.00 / unit for California residents
$149.00 / unit for US residents
$171.00 / unit for F1 Visa holders

Associated Student Sticker Refund
$10.00 refund in Fall or Spring semester, if requested
$9.00 refund in Winter or Summer session, if requested


Thanks for any help at all! I really appreciate it! I'm just overwhelmed by this.
cleverest is offline   Reply With Quote