for some reason when i run this only package (1) will work for an output...the other two packages just end with nothing..thanks..
#include <iostream>
#include <string>
using std::cout;
using std::cin;
using std::endl;
using std::string;
int main () {
int pause;
int package;
int hours;
double amountdue;
const double package_1= 9.95, package_2= 14.95, package_3=19.95;
string Fname;
string Lname;
cout << "Please enter your name: \n" << endl;
cin >> Fname;
cin >> Lname;
cout << "Which internet package did you purchase?: \n" << endl;
cout << " " << "Package(1)\n";
cout << " " << "Package(2)\n";
cout << " " << "Package(3)\n";
cin >> package;
cout << "How many hours did you use?\n" << endl;
cin >> hours;
if (package==1)
{
if (hours <= 10)
{
cout << "Customer Name:\n " << Fname << " " << Lname;
cout << "Package Purchased:\n " << package;
cout << "Hours Used:\n " << hours;
cout << " The total amount due is $\n" << package_1;
}
if (hours > 10)
{
amountdue = package_1 + ((hours-10) * 2.0);
cout << "Customer Name: " << Fname << " " << Lname;
cout << "\nPackage Purchased: " << package;
cout << "\nHours Used: " << hours;
cout << " \nThe total amount due is $" << amountdue;
}
else if (package==2)
{
if (hours < 20)
{
cout << " " << "Customer Name: " << Fname << " " << Lname;
cout << " " << "Package Purchased: " << package;
cout << " " << "Hours Used: " << hours;
cout << "The total amount due is $" << package_2;
}
if (hours > 20)
{
amountdue=package_2+((hours-20)*1.0);
cout << "Customer Name: " << Fname << " " << Lname;
cout << "Package Purchased: " << package;
cout << "Hours Used: " << hours;
cout << "The total amount due is $" << amountdue;
}
else if (package==3)
{
if (hours > 20 && hours < 744)
{
cout << "Customer Name: " << Fname << " " << Lname;
cout << "Package Purchased: " << package;
cout << "Your hours are unlimited ";
cout << "The total amount due is $" << package_3;
}
else
cout << "That is an invalid hour input!";
}
cin >> pause;
return 0;
}
}
}
If you tried indenting your code you'd see the problem quite quickly.
Your other packages are in the same brace as package == 1 == true