This is a discussion on please help me fix my coding for this assignment within the C Programming forums, part of the General Programming Boards category; please help me coding my assignment. it does not work properly. ill first show the ASSIGNMENT QUESTION and then my ...

please help me coding my assignment. it does not work properly. ill first show the ASSIGNMENT QUESTION and then my SUGGESTED SOLUTION ( which does not get the proper calculation).
thank u

Question:

Cellular (wireless) phones have become an increasingly
important part of our everyday life. Choosing a cellular
phone and accompanying service plan can however be
confusing for many customers (especially those who
do not read the fine print!).

For your first programming assignment this semester,
you are to write a C program that helps customers choose
between 3 (simplified) cellular phone service plans and
calculates the cost for the first month as well as the
projected average costs for subsequent months.
(see below for the details about each service plan).

One time only expenses:
Initial cost of phone-------------> \$ 49.95
One time activation charge--------> \$ 35.00

Service charges common to ALL plans:
System access fee-----------------> \$ 6.95 per month
911 emergency fee-----------------> \$ 0.25 per month

Plan 1:
Cost per month---> \$25.00
Included anytime minutes per month---> 150
Special offers---> unlimited weekend calling

Plan 2:
Cost per month---> \$35.00
Included anytime minutes per month---> 100
Special offers---> unlimited evening & weekend calling

Plan 3:
Cost per month---> \$50.00
Included anytime minutes per month---> 350
Special offers---> none

pieces of data:
1. Estimated total number of minutes used per month.
2. Percentage (5%, 10%, 25% etc.) of total minutes
called in the weekday daytime (8 a.m. to 6 p.m.) hours.
3. Percentage of total minutes called in the weekday
evening (6 p.m. to 8 a.m.) hours.

The percentage of total weekend minutes called may
be calculated by subtracting (daytime + evening)
from 100.

Your program should then process the information,
perform the necessary calculations, and display for
the user which plan is the most cost effective for
their particular usage levels, as well as display
the first month's invoice and subsequent projected
future month's invoice (1 only).

NOTE: When determining the monthly invoice, the
costs must also include taxes: GST(7%), & PST(8%).
You may assume that billing is done on a per second
basis (i.e. do not worry about rounding)
You may also assume that only correct data
(positive numeric) will be entered and that the
percentages will always total to 100%.
No data validation will be required.

A few sample runs of the program should look like this:
\$ a.out
***Welcome to the Cellular Phone Analyzer (CPA)!***
Enter the estimated total number of monthly minutes: 175
Enter the percentage of daytime minutes: 80
Enter the percentage of evening minutes: 10

First month's invoice------> \$136.88
Projected monthly invoice--> \$ 39.19

\$ a.out
***Welcome to the Cellular Phone Analyzer (CPA)!***
Enter the estimated total number of monthly minutes: 250
Enter the percentage of daytime minutes: 10
Enter the percentage of evening minutes: 50

First month's invoice------> \$134.72
Projected monthly invoice--> \$ 37.03

\$ a.out
***Welcome to the Cellular Phone Analyzer (CPA)!***
Enter the estimated total number of monthly minutes: 280
Enter the percentage of daytime minutes: 90
Enter the percentage of evening minutes: 5

First month's invoice------> \$163.47
Projected monthly invoice--> \$ 65.78

\$ a.out
***Welcome to the Cellular Phone Analyzer (CPA)!***
Enter the estimated total number of monthly minutes: 280
Enter the percentage of daytime minutes: 10
Enter the percentage of evening minutes: 80

First month's invoice------> \$146.22
Projected monthly invoice--> \$ 48.53

_________________________________

MY CODE

#include<stdio.h>

main()
{
int monthly_minutes;

int percent_daytime;

int percent_evening;

int percent_weekend;

double GST_PST_Multiplier=1.15; /*for the value after tax */

double initial_cost=49.95;

double activation_charge=35.00;

double sys_access_fee=6.95;

double emergency_fee=0.25;

double monthly_cost;

double month_total;

double first_invoice;

double pmi; /* Projected Monthly Incone */

printf("***Welcome to the Cellular Phone Analyzer (CPA)!***\n");
printf("Enter the estimated total number of monthly minutes:");
scanf(" %d" , & monthly_minutes);
printf("Enter the percentage of daytime minutes:");
scanf(" %d" , & percent_daytime);
printf("Enter the percentage of evening minutes:");
scanf(" %d" , & percent_evening);
percent_weekend = 100 - ( percent_daytime + percent_evening);;

if(monthly_minutes<= 150 )
monthly_cost= 25.00;
monthly_minutes=(percent_daytime/100 * monthly_minutes)+(percent_evening/100 * monthly_minutes);
month_total=initial_cost+ activation_charge+ sys_access_fee+ emergency_fee + monthly_cost;
first_invoice=month_total* GST_PST_Multiplier;
printf("First month's invoice------>\$ %.2lf\n",first_invoice);
pmi=(sys_access_fee+ emergency_fee + monthly_cost) * GST_PST_Multiplier;
printf("Projected monthly invoice-->\$ %.2lf\n",pmi);

}

else if ( monthly_minutes >150 && percent_daytime < percent_evening && percent_weekend )
monthly_cost=35.00;
monthly_minutes=percent_daytime/100 * monthly_minutes;
if(monthly_minutes> 100)
month_total=initial_cost+ activation_charge+ sys_access_fee+ emergency_fee + monthly_cost+additional_charge;
first_invoice=month_total* GST_PST_Multiplier;
printf("First month's invoice------>\$ %.2lf\n",first_invoice);
pmi=(sys_access_fee+ emergency_fee + monthly_cost+additional_charge) * GST_PST_Multiplier;
printf("Projected monthly invoice-->\$ %.2lf\n",pmi);

}
else if(monthly_minutes > 150 && monthly_minutes < 250)
{
monthly_cost=25.00;
monthly_minutes=monthly_minutes -( (percent_weekend/100)* monthly_minutes);
printf("%.2lf",percent_weekend);
month_total=initial_cost+ activation_charge+ sys_access_fee+ emergency_fee + monthly_cost+additional_charge;
first_invoice=month_total* GST_PST_Multiplier;
printf("First month's invoice------>\$ %.2lf\n",first_invoice);
pmi=(sys_access_fee+ emergency_fee + monthly_cost+additional_charge) * GST_PST_Multiplier;
printf("Projected monthly invoice-->\$ %.2lf\n",pmi);

}

else if(monthly_minutes >= 250)
monthly_cost=50.00;
if (monthly_minutes >350)
else if (monthly_minutes <=350 && monthly_minutes > 275)
month_total=initial_cost+ activation_charge+ sys_access_fee+ emergency_fee + monthly_cost+additional_charge;
first_invoice=month_total* GST_PST_Multiplier;
printf("First month's invoice------>\$ %.2lf\n",first_invoice);
pmi=(sys_access_fee+ emergency_fee + monthly_cost+additional_charge) * GST_PST_Multiplier;
printf("Projected monthly invoice-->\$ %.2lf\n",pmi);

}
}

2. One problem is you need to cast an int to a double before dividing:

monthly_minutes=((double) percent_daytime/100 * monthly_minutes)+(percent_evening/100 * monthly_minutes);

monthly_minutes=(double) percent_daytime/100 * monthly_minutes;

monthly_minutes=monthly_minutes -( ((double) percent_weekend/100)* monthly_minutes);

Another problem is figuring out which plan is cheapest. I think to do this correctly, you will have to calculate the cost for each plan, then choose the one which is lowest in price. This would requre changing your code so that it calculates the price for each plan first, then does a comparison to see which is cheapest.