Hey guys!
CAn u tell me if my program is right?
First, I need to get a Pkg and validate;
Second,get month and validate;
Third, determinate max hours;
*If FEB;
Fourth, get year and validate(1990-2020)
check for leap yr.
Fifth, get hours and validate against maxhours;
and calculate the bill ^^(month)
I have 3 pkg
PKG A = $12 month
PKG B = $18 " " "
PKG C = $25 " " "
Thank you!!
Thx
#include <iostream>
using namespace std;
void main()
{
int mDays;
int maxhours;
char pkg = 'Z';
cout<<"Enter pkg A, B or C: ";
cin >> pkg;
if( pkg == 'A'||pkg =='a' ||pkg =='b' ||pkg == 'B'|| pkg == 'C'||pkg =='c' )
{
int month;
cout<<"Enter Month 1 through 12: ";
cin>>month;
if(month>=1 && month<=12)
{
int hrs;
cout<<"Enter hrs: ";
cin>>hrs;
if (month==1||month==3||month==5||month==7||month==8||month==10||month==12)
{
mDays = 31;
maxhours = 744;
}
else if(month== 4 || month==6 || month==9 || month==11)
{
mDays = 30;
maxhours = 720;
}
else if(month ==2)
{
mDays = 28;
maxhours = 672;
}
else
{
mDays = 29;
maxhours = 696;
}
int yr;
cout<<"Enter Year 1990 - 2020"<<endl;
cin>>yr;
if(yr>=1990 && month<=2020)
{
if((yr%4)!=0) //leap year
{
}
}
else
{
cout<<" Year " << yr << " invalid "<<endl;
}
}
else
{
cout<<"Month " << month << " invalid"<<endl;
}
}
else
{
cout<<"Inalid pkg value"<<endl;
}
}//end main