Ok, so this is just a stupid little program i wrote for class...it will not compile here it is.
Code:
#include <stdio.h>
#include <stdlib.h>
int main( void )
{
int gallons;
int gallons1;
int gallons2;
double upb;
int charge = 35;
int latefee = 2;
double total = 0;
while ( gallons != -1 ) {
printf( "THANK YOU FOR CHOOSING PLEASANT WATER AUTHORITY\n\n" );
printf( "Enter the current quarters readings:\n" );
printf( " " );
scanf( "%d", &gallons );
printf("Enter last quarters readings:\n" );
printf( " " );
scanf( "%d", &gallons1 );
printf( "Enter last years readings, this quarter:\n" );
printf( " " );
scanf( "%d", &gallons2 );
printf( "Enter any unpaid balance from last quarter:\n" );
printf( " " );
scanf( "%.2f", &upb );
if ( upb = 0 && gallons <= gallons2 * .95 ) {
total = gallons * (1.10 / 1000) + latefee + charge;
printf( "Your total due this quarter is:\t %.2f\n\n", total );
printf( "Congratulations, you have been environmentally green this quarter!\n\n" );
}
if ( gallons > gallons2 * .95 && upb > 0 ) {
total = gallons * (2.20 / 1000) + charge + upb + latefee;
printf( "You have an unpaid balance of %.2f\n\n", upb );
printf( "Your total due this quarter is:\t %.2f\n\n", total );
printf( "You were not environmentally green this quarter.\n\n");
}
if ( gallons <= gallons2 * .95 && upb > 0 ) {
printf( "You have an unpaid balance of %.2f\n\n", upb );
printf( "Congratulations, you have been environmentally green this quarter!\n\n" );
total = gallons * (1.10 / 1000) + latefee + upb + charge;
printf( "Your total due this quarter is:\t %.2f\n\n", total );
}
//here is the compilation error, the 'if' statement
if ( gallons > gallons2 * .95 && upb = 0 ) {
total = gallons * (2.20 / 1000) + charge + upb;
printf( "Your total due this quarter is:\t %.2f\n\n", total );
printf( "You were not environmentally green this quarter.\n\n" );
}
}
system("PAUSE");
return 0;
}
any help would be appreciated. thank you