==> this is my pesudocode code for an assignment. i stayed up all last nit with minimal success trying to code it into C. I do not want someone to complete the assignment for me, but would be very greatful if someone could start me off in the right track... starting is my biggest problem(and the fact that i will miss my next lecture due to wedding on that day, is going to be suckie- but will hopefully be a great day)
thanks anyone that would be of help
==> PROBLEM: basically to input a pollutant number, input amount of gas grams emmitted pkm, input distance from source (aceptable distance limits case1; <80,00km, case 2; >80,000 <160,000.... gas grams emmitted change with these two cases, evident below.) program will keep asking for these untill 0 is entered, then display summary.
Calculate_Acceptable_Unacceptable_Pollutants
Defining the table
Defining the variables
distance_source = 0
gas_amount_pkm = 0
gms_amount_pkm_temp = 0
pollutant_no = 0
Defining the counters
Display pollutant names and numbers
1. Carbon Monoxide
2. Hydrocarbons
3. Nitrogen oxides
4. Non methane hydrocarbons
IF pollutant (!= 0, 1, 2, 3,4)
Then display message (Please choose a correct number)
WHILE(pollutant number < 5 ) (possibally DO WHILE instead)
Prompt user for pollutant number
read pollutant number
if(pollutant number is equal to 1)
prompt user for amount of gas grams pkm
read amount of gas grams pkm
prompt user for distance from source
read distance from source
if( distance > 80000 )
if( gas_amount_pkm > 2.63 )
display message(Carbon Monoxide emissions exceeds level of 2.63)
Add one to Unaccept_Carmonoxide
else if (gas_amount_pkm < 2.63 )
display message(Carbon Monoxide emissions are acceptable)
Add one to Accept_Carmonoxide
if( distance < 80000 )
if (gas_amount_pkm > 2.13 )
display message(Carbon Monoxide emissions exceeds level of 2.13)
Add one to Unaccept_Carmonoxide
else if (gas_amount_pkm < 2.13 )
display message(Carbon Monoxide emissions are acceptable)
Add one to Accept_Carmonoxide
Calculate Subtotal
SubTot_Carmonoxide = Accept_Carmonoxide + Unaccept_Carmonoxide
-------------------------------------------------------------------------------------------------
else if(pollutant number is equal to 2)
prompt user for amount of gas grams pkm
read amount of gas grams pkm
prompt user for distance from source
read distance from source
if( distance > 80000 )
if(gas_amount_pkm > 0.24 )
display message(Hydrocarbon emissions exceeds level of 0.24)
Add one to Unaccept_Hydrocarbon
else if (gas_amount_pkm < 0.24 )
display message(Hydrocarbon emissions are acceptable)
Add one to Accept_Hydrocarbon
if( distance < 80000 )
if(gas_amount_pkm > 0.19 )
display message(Hydrocarbon emissions exceeds level of 0.19)
Add one to Unaccept_Hydrocarbon
else if (gas_amount_pkm < 0.19 )
display message(Hydrocarbon emissions are acceptable)
Add one to Accept_Hydrocarbon
Calculate Subtotal
SubTot_Hydrocarbon = Accept_Hydrocarbon + Unaccept_Hydrocarbon
-----------------------------------------------------------------------------------------
else if(pollutant number is equal to 3)
prompt user for amount of gas grams pkm
read amount of gas grams pkm
prompt user for distance from source
read distance from source
if( distance > 80000 )
if(gas_amount_pkm > 0.31 )
display message(Nitrogen oxide emissions exceeds level of 0.31)
Add one to Unaccept_Nitrogen
else if (gas_amount_pkm < 0.31 )
display message(Nitrogen oxide emissions are acceptable)
Add one to Accept_Nitrogen
if( distance < 80000 )
if(gas_amount_pkm > 0.25 )
display message(Nitrogen oxide emissions exceeds level of 0.25)
Add one to Unaccept_Nitrogen
else if (gas_amount_pkm < 0.25 )
display message(Nitrogen oxide emissions are acceptable)
Add one to Accept_Nitrogen
Calculate Subtotal
SubTot_Nitrogen = Accept_Nitrogen + Unaccept_Nitrogen
-----------------------------------------------------------------------------------------------
else if(pollutant number is equal to 4)
prompt user amount of gas grams pkm
read amount of gas grams pkm
prompt user for distance from source
read distance from source
if( distance > 80000 )
if(gas_amount_pkm > 0.19 )
display message(Non_methane emissions exceeds level of 0.19)
Add one to Unaccept_Non_methane
else if (gas_amount_pkm < 0.19 )
display message(Non_methane emissions are acceptable)
Add one to Accept_Non_methane
if( distance < 80000 )
if(gas_amount_pkm > 0.16 )
display message(Non_methane emissions exceeds level of 0.16)
Add one to Unaccept_Non_methane
else if (gas_amount_pkm < 0.16 )
display message(Nonmethane emissions are acceptable)
Add one to Accept_Non_methane
Calculate Subtotal
SubTot_Nonmethane = Accept_Non_methane + Unaccept_Non_methane
---------------------------------------------------------------------------------------------
else if(pollutant number is <= 0 )
clear Screen
display Summary
Calculate Total Acceptable
Tot_accept = Accept_Car_monoxide + Accept_Hydro_carbon + Accept_Nitrogen + Accept_Non_methane
Calculate Total unacceptables
Tot_unaccept = Unaccept_Car_monoxide + Unaccept_Hydrocarbon + Unaccept_Nitrogen + Unaccept_non_methane
Calculate Total
Total = SubTot_Car_monoxide + SubTot_Hydro_carbon + SubTot_Nitrogen + SubTot_Non_methane
ENDWHILE
END