Need help with cell phone bill assignment

Hello everyone, this is my first post here. I'm pretty new to programming and I just completed my first class. Its been really really easy so far. Now, I've come to my last assignment and I cant seem to get it down. I've gotten the hang of functions but I've been hitting so many bumps with this program because I am using Microsoft visual studio 2010 remotely (citrix ilab). I think because of this it is causing me problems and errors. :(

I am in desperate need of help for this program.

Here's the assignment:
Using functions write a program that calculates and prints the bill for a cellular telephone company. The company offers two types of service: regular and premium. Its rate varies, depending on the type of service. The rates are computed as follows:

Regular Service: $10.00 plus first 50 minutes are free. Charges for over 50 minutes are $0.20 per minute.

Premium service: $25:00 plus;

a. For calls made from 6:00 a.m. to 6:00 p.m., the first 75 minutes are free;
charges over 75 minutes are $0.10 per minute.

b. For calls made from 6:00 p.m. to 6:00 a.m., the first 100 minutes are free;
charges over 100 minutes are $0.05 per minute.

Your program should prompt the user to enter an account number, a service code, and the number of minutes the service was used. A service of r or R means regular service; a service of p or P means premium service. Treat any other character as an error. Your program should output the account number, type of service, number of minutes the telephone service was used, and the amount due from the user.

If any of you could help it would be greatly appreciated.
people here help on the code you write, even if its not working. We will help you in correcting the code and make it run.

so, whatever code you already have, post it. No one is going to write a program from scratch.
The only reason I tried was because I saw a post earlier where someone replied with a completed program within an hour.

But anyway, I started from scratch using a someone else's uncompleted code that I found on here regarding the same assignment

Here's what I have so far
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#include <iostream>
#include <iomanip>
#include <string>

using namespace std;

const double REG_SERV_CHARGES = 10.00;
const int REG_FREE_MINUTES = 50;
const double REG_RATE_OVER_50 = 0.20;

const double PREM_SERV_CHARGES = 25.00;
const int PREM_FREE_DAY_MINUTES = 75;
const double PREM_DAY_RATE_OVER_75 = 0.10;

const int PREM_FREE_NIGHT_MINUTES = 100;
const double PREM_NIGHT_RATE_OVER_100 = 0.05;

void  getMinutes (int minUsed, double amtDue);
void getPremiumMinutes(int dayMin, int nightMin, double amtDue);
int regularAmtDue (int minUsed, double amtDue);
int premiumAmtDue (int dayMin, int nightMin, double amtDue);
void writeOutput (int minutes1, int minutes2, double amtDue, char service);

string promptMessage;
int minUsed=0, dayMin=0, nightMin=0, minutes1=0, minutes2=0;
double amtDue2=0, amtDue=0;
char service;

int main()
{
	char serviceType;

	cout << fixed << showpoint;
    cout << setprecision(2);
	cout << "Enter service type: (r or R) for regular, " 
         << "(p or P) for premium service: " << endl;
    cin >> serviceType;
    cout << endl;

    switch (serviceType)
    {
	case 'r':
    case 'R': 
    
			getMinutes (minUsed, amtDue);
			//cout<<"Enter the number of minutes used: ";
			//cin>>minUsed;
    		regularAmtDue (minUsed, amtDue);
			writeOutput (minutes1, minutes2, amtDue, service);
		
			
			
			
            break;
    case 'p':
    case 'P': 

    		getMinutes (minUsed, amtDue);

    		getPremiumMinutes(dayMin, nightMin, amtDue);

			premiumAmtDue (dayMin, nightMin, amtDue);

			writeOutput (minutes1, minutes2, amtDue, service);
			
        break;
    default: 
        cout << "\n\nInvalid Service Type" << endl;
	}//end switch

	return 0;
}

void getMinutes (int minUsed, double amtDue)
{
	cout<<"\n\nEnter the number of minutes used: ";
	cin>>minUsed;
}

void getPremiumMinutes(int dayMin,int nightMin, double amtDue)
{
	cout<<"\n\nEnter the number of daytime minutes: ";
	cin>>dayMin;
	cout<<"\n\nEnther the number of nighttime minutes: "; 
	cin>>nightMin;
}
	
int regularAmtDue (int minUsed, double amtDue) 
{
    if (minUsed <= 50)
     {
     amtDue = REG_SERV_CHARGES;
     }
     else if (minUsed > 50)
     {
     amtDue = REG_SERV_CHARGES + minUsed * REG_RATE_OVER_50;
     }
	return amtDue;
} // end regularAmtDue

int premiumAmtDue (int dayMin, int nightMin, double amtDue)
{
if (dayMin <= 75)
     {
     amtDue = PREM_SERV_CHARGES;
     }
     else if (nightMin > 100)
     {
     amtDue = PREM_SERV_CHARGES + (nightMin * PREM_NIGHT_RATE_OVER_100);
     }
     else if(nightMin > 100 && dayMin > 75)
     {
     amtDue = PREM_SERV_CHARGES + (dayMin * PREM_DAY_RATE_OVER_75)
                   + (nightMin * PREM_NIGHT_RATE_OVER_100);
     }
     else
     {
     amtDue = PREM_SERV_CHARGES + (dayMin * PREM_DAY_RATE_OVER_75);
     }
	return amtDue;
}

void writeOutput (int minutes1, int minutes2, double amtDue, char service)
{
     if (service == 'r' || 'R')
     {
     minutes2 = 0;
     amtDue = 0;
     cout << "\nYour service is regular." << endl;
     cout << "\nYour bill is " << regularAmtDue(minUsed, amtDue) << endl;
     } 
     if (service == 'p' || 'P')
     {
     amtDue = 0;
     cout << "\nYour service is premium." << endl;
     cout << "\nYour bill is " << premiumAmtDue(dayMin, nightMin, amtDue) << endl;
     }

}

It compiles but after I enter minUsed for switch code r (regular service), the programs ends
If by
the programs ends
you mean that the console closes, this is normal.
The console is only kept open as long as the program is running.

I tested your code and I found no obvious problem.
Yes the console closed. But If you read what the assignment is, its obvious that I dont want it to close.

I want it to calculate the payment due (amtDue) with the regularAmtDue and the premiumAmtDue function, then print what is in the writeOutput function.

It does all that, and then your program ends and the console closes.
Enter service type: (r or R) for regular, (p or P) for premium service:
r



Enter the number of minutes used: 25

Your service is regular.

Your bill is 10

Your service is premium.

Your bill is 25
Wow! This stupid thing sucks.

I guess because I'm using it remotely from my schools servers it just does that.

Thanks a lot!
Topic archived. No new replies allowed.