I am doing something wrong within my code. I'm pretty sure I did not declare the letters right, I'm not sure how that is done. I'm sure other things are wrong too, I did my best. Please help me out here!!
#include<iostream>
int main()
{
int resident;
// Here, I declare resident as a variable (of integer type).
const double resProcessingFee = 4.50;
const double resBasicServices = 20.50;
const double resPremiumChannels = 17.50; // Dont FORGET PER CHANNEL
// In these three lines we inialized three variables.
// These variables are the Residential prices for some bills.
int Commercial;
// As we did in the previous section of cod, we are declaring the variable for the commercial residents.
const double comProcessingFee = 15.00;
const double comBasicServices = 20.50 ;
// Dont forget about 5.00 for additional connection-- after ten connections.
const double comPremiumChannels = 50.00 ;
// 50.00 per channel for any number of conections.
// We used variable type double becuase we want our answers to be very precise, especially when dealing with money.
// Double types is about 2 times as precise as the variable type floating.
int residential = r and R;
int commercial = c and C;
// Here we are declaring more variables for the program.
// These variables are codes for the customer.
char customerType;
// This is our customer type, we used char because it deals with alhabetical letters.
// The alphabetical leters that this variable is dealing with is ourvariables declared above, which is the customer type.
int premium_channels;
int basic_service_fee;
// In this program, we have potentailly added rates depending on the amount of premium channels for (residents).
// As well as 5.00 service fee for every connection after 10 connections (commercial business).
int customerAccountNum;
double amountDue;
// More variables we must declare.
// Customer account number, so we know its a customer within our branch.
// Also the amount due which is a variable we will need later in the program.
cout << "\tThis program will calculate your NOLA Cable Company bill";
cout << "\tPlease enter your customer account number: ";
cin >> customerAccountNum;
// Here we are asking the customer to enter their account number that consists of four digits.
// If the customer enters >4 or <4 numbers it will be an error and that will be dealt with later in the program.
cout << "\tPlease state rather you are residential or commercial, type r for residential and c for commercial";
cin >> customerType;
// Here we are getting the customer type from the user
// This is either residential or commercial
switch(customerType)
{
case r:
case R:
cout << "\tEnter the number of premium channels ur residancy is subscribed to: ";
cin >> premium_channels;
amountDue = resProcessingFee + resBasicServices + resPremiumChannels * premium_channels;
cout << "\tYour account number: " << customerAccountNum << endl;
cout << "\tYour total amount due is: $" << amountDue << endl;
break;
// I decided to do a switch case because i felt it was slightly easier than doing an if, if else statement.
// In this particular case (residential) we had to calculate the price total by multiplying by the amount
// of premium channels the customer is subscribed too.
// We also had to add the other flat fees, which consisted of processing fee, basic services, and flat charge for premium channels
case c:
case C:
int comConnections;
// Decided to make a new variable to make it more clear as to what number i am recieving from the user.
// The next line asks for the number of connections
cout << "\tEnter number of connections linked to this account: ";
cin >> comConnections;
cout << "\tEnter number of Premium Channels subscribed to: ";
cin >> premium_channels;
// Now that we are on the Commercial calculations we need to get the number connections for basic service fees
// As well as getting the number for the amount of premium channels subscribed too
// These numbers will be incorporated into our if statement
if(comConnections <= 10)
{
amountDue = comProcessingFee + comBasicServices + comPremiumChannels * premium_channels;
cout << "\tYour account number is: " << customerAccountNum << endl;
cout << "\tTotal amount due is: $" << amountDue << endl;
}
else if(comConnections > 10)
{
amountDue = comProcessingFee + comBasicServices + (comConnections - 10)*5 + (premium_channels * comPremiumChannels);
cout << "\tYour account number is: " << customerAccountNum << endl;
cout << "\tYour total amount due is: &" << amountDue << endl;
}
break;
default:
char again;
while(again =='y');
cout << "\tYou did not enter the correct account number, or did not use the correct keys";
cout << "\tDo you want to try again? Y or N";
cin >> again;
}
You sometimes use r or c or C instead of residential or comercial? Also those are not declarated. Also try to add usingnamespace std; and see if theres a lot of errors. Im begginner
in my assignment it sais I have to put little c and big C(little r and big R) as options because basically, their is no telling if the customer (user) is going to put in a lowercase letter or not.
one of the main things I did wrong is declaring the letters, I'm confused on that part.
and WOW thank you so much, I cant believe I didn't have that in their!!
I don't want to download skype on my sony, I started having major problems when I downladed windows ten. Until I get a new one, I'm stuck with this one. I been keeping away from any downloads basically. BUT my email is thomaslanda@dcc.edu if you still want to talk and can help me with the coding
#include<iostream>
using std::cout; // dmh
using std::cin;
using std::endl;int
main()
{
int resident; // dmh this is unused
// Here, I declare resident as a variable (of integer type).
constdouble resProcessingFee = 4.50;
constdouble resBasicServices = 20.50;
constdouble resPremiumChannels = 17.50; // Dont FORGET PER CHANNEL
// In these three lines we inialized three variables.
// These variables are the Residential prices for some bills.
int Commercial; // dmh this is unused
// As we did in the previous section of cod, we are declaring the
// variable for the commercial residents.
constdouble comProcessingFee = 15.00;
constdouble comBasicServices = 20.50;
// Dont forget about 5.00 for additional connection-- after ten
// connections.
constdouble comPremiumChannels = 50.00;
// 50.00 per channel for any number of conections.
// We used variable type double becuase we want our answers to be
// very precise, especially when dealing with money.
// Double types is about 2 times as precise as the variable type floating.
// int residential = r and R;
// int commercial = c and C;
// Here we are declaring more variables for the program.
// These variables are codes for the customer.
char customerType;
// This is our customer type, we used char because it deals with
// alhabetical letters.
// The alphabetical leters that this variable is dealing with is
// ourvariables declared above, which is the customer type.
int premium_channels;
int basic_service_fee; // dmh this is unused
// In this program, we have potentailly added rates depending on
// the amount of premium channels for (residents).
// As well as 5.00 service fee for every connection after 10
// connections (commercial business).
int customerAccountNum;
double amountDue;
// More variables we must declare.
// Customer account number, so we know its a customer within our branch.
// Also the amount due which is a variable we will need later in
// the program.
cout << "\tThis program will calculate your NOLA Cable Company bill";
cout << "\tPlease enter your customer account number: ";
cin >> customerAccountNum;
// Here we are asking the customer to enter their account number
// that consists of four digits.
// If the customer enters >4 or <4 numbers it will be an error and
// that will be dealt with later in the program.
cout <<
"\tPlease state rather you are residential or commercial, type r for re\
sidential and c for commercial";
cin >> customerType;
// Here we are getting the customer type from the user
// This is either residential or commercial
switch (customerType) {
case'r':
case'R': // dmh use single quotes to indicate a character constant
cout << "\tEnter the number of premium channels ur residancy is subscri\
bed to: ";
cin >> premium_channels;
amountDue =
resProcessingFee + resBasicServices + resPremiumChannels * premium_\
channels;
cout << "\tYour account number: " << customerAccountNum << endl;
cout << "\tYour total amount due is: $" << amountDue << endl;
break;
// I decided to do a switch case because i felt it was
// slightly easier than doing an if, if else statement. In
// this particular case (residential) we had to calculate the
// price total by multiplying by the amount of premium
// channels the customer is subscribed too. We also had to
// add the other flat fees, which consisted of processing fee,
// basic services, and flat charge for premium channels
case'c':
case'C': // dmh single quotes againint comConnections;
// Decided to make a new variable to make it more clear as to
// what number i am recieving from the user.
// The next line asks for the number of connections
cout << "\tEnter number of connections linked to this account: ";
cin >> comConnections;
cout << "\tEnter number of Premium Channels subscribed to: ";
cin >> premium_channels;
// Now that we are on the Commercial calculations we need to
// get the number connections for basic service fees As well
// as getting the number for the amount of premium channels
// subscribed too These numbers will be incorporated into our
// if statement
if (comConnections <= 10) {
amountDue =
comProcessingFee + comBasicServices +
comPremiumChannels * premium_channels;
cout << "\tYour account number is: " << customerAccountNum << endl;
cout << "\tTotal amount due is: $" << amountDue << endl;
} elseif (comConnections > 10) {
amountDue =
comProcessingFee + comBasicServices + (comConnections - 10) * 5\
+
(premium_channels * comPremiumChannels);
cout << "\tYour account number is: " << customerAccountNum << endl;
cout << "\tYour total amount due is: &" << amountDue << endl;
}
break;
default:
char again;
while (again == 'y');
cout <<
"\tYou did not enter the correct account number, or did not use the\
correct keys";
cout << "\tDo you want to try again? Y or N";
cin >> again;
}
cin.get();
cin.get();
return 0;
}