hi ppl!
im here again :S with another problem, which, is more a question about if what im doing is ok.
the thing is i have to do a problem that counts the total of letters sent, the total of packages sent, total of letters and packages sent on the next day priority, on the next day normal, and the total if its sent over 2 days.
also i have to calculate a big total of letters and packages sent (i mean letters + packages in each day) and the percentage of the total of things sent on the next day priority, of the next day normal, and over 2 days.
i already have a code made, my question if its ok to put a for loop in the middle of a chain of ifs:
//A GENERAL FOR LOOP WOULD BE HERE
if ((peso < 30) && (dia = 7))
cout << " Se le cobraran 8$ " << "\n"; // these 3 are letters,
else if ((peso < 30) && (dia = 8))
cout << " Se le cobraran 5$ " << "\n";
else if ((peso < 30) && (dia = 9))
cout << " No esta disponible$ " << "\n";
//ANOTHER PUT A FOR LOOP HERE
else if ((peso > 30) && (peso < 1000) && (dia = 7)) // from here to the end, are packages
cout << " Se le cobraran 25$ " << "\n";
else if ((peso > 30) && (peso < 1000) && (dia = 8))
cout << " Se le cobraran 20$ " << "\n";
else if ((peso > 30) && (peso < 1000) && (dia = 9))
cout << " Se le cobraran 15$ " << "\n";
//AND ANOTHER ONE HERE
else if((peso > 1000) && (dia = 7))
{
cout << " Se le cobraran 25$ " << "\n";
cout << " Y 2$ adicionales por cada 500 gr de màs" << "\n";
diferencia = ((peso-1000) / 500);
total_a_pagar = (25 + ((diferencia *2) + 2));
cout << " Se le cobraran" << total_a_pagar << " $ en total" << "\n";
}
else if ((dia = 8) && (peso > 1000))
{
cout << " Se le cobraran 20$ " << "\n";
cout << " Y 1.5$ adicionales por cada 500 gr de màs" << "\n";
diferencia = ((peso-1000) / 500);
total_a_pagar = (25 + ((diferencia *2)+2));
cout << " Se le cobraran" << total_a_pagar << " $ en total" << "\n";
}
else if ((dia = 9)&& (peso > 1000))
{
cout << " Se le cobraran 15$ " << "\n";
cout << " Y 1$ adicionales por cada 500 gr de màs" << "\n";
diferencia = ((peso-1000) / 500);
total_a_pagar = (25 + ((diferencia *2)+2));
cout << " Se le cobraran" << total_a_pagar << " $ en total" << "\n";
}
what i want to do is this: the program must consider the hours in which the people work, so the first for loop would control that [for (hour = hour_begining; (hour > hour_begining) && (hour < hour_final); hour++) ]. now, when it comes to the other two for loops, i dont know if they will stop in any way the ifs, or do i have to write the code differently.
in the code:
peso = weight
dia = day
total_a_pagar = is what i have to pay if i send just one (its calculated only for the packages, if its a letter doesnt matter the weight, its a fixed price)
thanks for the help!!
gispe!!
ps: if anything isnt clear, ask me! and if whole code were necessary ill paste it!!