This is what I'm trying to do:
Your new cell bill program must use 3 functions with parameters, as follows:
function calcRegBill – accepts one integer argument for the number of minutes used. Determines and returns the total amount due.
function calcPremBill – accepts two integer arguments, for the number of day minutes and number of night minutes used. Determines and returns the total amount due.
function printBill – accepts 4 arguments: a string account number, a character service code, an integer total number of minutes used, and an amount due. Note that this is a generic print bill function, which prints either a regular or premium bill.
This is 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
|
//Program Assignment 9
//Author:
//Date: 4/13/2015
//This program is used to collect phone bill data and calculate a total monthly phone bill.
#include <iostream>
#include <iomanip>
#include <stdlib.h>
#include <string>
using namespace std;
double calcRegBill(int z);
double calcPremBill (int a, int b);
void printBill (string a, char s, int tm, int ta);
int main ()
{
double dayMinutes, nightMinutes, anyMinutes;
int total;
string account;
char servicePlan;
cout << "Enter the first letter of your service plan: " ;
cin >> servicePlan;
cout << "Enter your 4 digit account number: " ;
cin >> account;
cout << endl;
switch (servicePlan)
{
case 'R':
case 'r':
cout << "Enter the number of anytime minutes used: " ;
cin >> anyMinutes;
anyMinutes = anyMinutes - 50;
cout << endl;
calcRegBill (anyMinutes);
printBill (account, servicePlan, anyMinutes, total);
case 'P':
case 'p':
cout << "Enter the number of daytime minutes used: " ;
cin >> dayMinutes;
dayMinutes = dayMinutes - 75;
cout << endl;
cout << "Enter the number of night time minutes used: " ;
cin >> nightMinutes;
nightMinutes = nightMinutes - 100;
cout << endl;
calcPremBill (dayMinutes, nightMinutes);
printBill (account, servicePlan, anyMinutes, total);
}
}
double calcRegBill(int z)
{
double total;
if (z > 0)
total = 10 + z * .2 << endl;
else
total = 10 << endl;
break;
}
double calcPremBill (int a, int b)
{
int total;
int totalMinutes;
cout << "Enter the number of daytime minutes used: " ;
cin >> a;
cout << endl;
cout << "Enter the number of night time minutes used: " ;
cin >> b;
cout << endl;
a = a - 75;
b = b - 100;
if (a > 0 && b > 0)
totalMinutes = a + b;
total = (25 + (a * .1) + (b * .05)) << endl;
else if (a <= 0 && b > 0)
totalMinutes = a + b;
total = (25 + (b * .05)) << endl;
else if (a > 0 && b <= 0)
totalMinutes = a + b;
total = (a * .1) << endl;
else
total = 25 << endl;
}
void printBill (string a, char s, int tm, int ta)
{
if (s == 'r' or 'R')
{
cout << "Creator: Paul Vellake" << endl;
cout << "Date: 4/13/15" << endl;
cout << "Account Number: " << a << endl;
cout << "Service Type: Regular" << endl;
cout << "Total Minutes: " << tm << endl;
cout << "Amount Due: $" << ta << endl;
}
else
cout << "Creator: Paul Vellake" << endl;
cout << "Date: 4/13/15" << endl;
cout << "Account Number: " << a << endl;
cout << "Service Type: Premium" << endl;
cout << "Total Minutes: " << tm << endl;
cout << "Amount Due: $" << ta << endl;
}
|
HERE ARE THE ERRORS
In function 'double calcRegBill(int)':|
|66|error: invalid operands of types 'double' and '<unresolved overloaded function type>' to binary 'operator<<'|
|68|error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'|
In function 'double calcPremBill(int, int)':|
|86|error: invalid operands of types 'double' and '<unresolved overloaded function type>' to binary 'operator<<'|
|88|error: invalid operands of types 'double' and '<unresolved overloaded function type>' to binary 'operator<<'|
|90|error: invalid operands of types 'double' and '<unresolved overloaded function type>' to binary 'operator<<'|
|92|error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'|
||=== Build failed: 6 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|