Trabalho algoritmo AV1
Autor: Lêda da Silva Almeida | Publicado: 2011-06-08T20:25:00-07:00

TRABALHO AVI
1)&nbsp;&nbsp;&nbsp; Faça um programa que receba a idade e o peso de uma pessoa. De acordo com a tabela a seguir, verifique e mostre em qual grupo de risco essa se encaixa.
   Idade   Peso  
   Até 60   Entre 60 e 90 (inclusive)   Acima de 90  
   Menores   de 20   9   8   7  
   De 20 a 50   6   5   4  
   Maiores   de 50   3   2   1  

2)&nbsp;&nbsp;&nbsp; Faça um programa que receba o preço, a categoria (1 – limpeza, 2 – alimentação ou 3 – vestuário) e a situação (R – produtos que necessitam de refrigeração e N – produtos que não necessitam de refrigeração). Calcule e mostre:
·&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; O valor do aumento, usando as regras a seguir sobre o preço.

   Preço   Categoria   Percentual de aumento  
   &lt;= R$ 25,00   1   5%  
   2   8%  
   3   10%  
   &gt; R$ 25,00   1   12%  
   2   15%  
   3   18%  

·&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; O valor do imposto, usando as seguintes regras.

   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; O produto que preencher pelo menos   um dos seguintes requisitos pagará imposto equivalente a 5% do preço, caso   contrário pagará 8% do preço. Os requisitos são:
Categoria: 2Situação: R  

·&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; O novo preço, ou seja, o preço mais aumento menos imposto.
·&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A classificação, de acordo com as regras a seguir.
   Novo preço   Classificação  
   &lt;= R$ 50,00   Barato  
   Entre R$ 50,00 e R$ 120,00   Normal  
   &gt;= R$ 120,00   Caro  





1º)#include &lt;iostream&gt;using namespace std;int main ( ){int idade, peso;
cout &lt;&lt; "Digite a idade: ";cin &gt;&gt; idade;cout &lt;&lt; "Digite o peso: ";cin &gt;&gt; peso;
if ((idade &lt; 20) &amp;&amp; (peso&lt;=60)) printf ( "Pessoa esta no grupo de risco: 9 \n");
if ((idade &lt; 20) &amp;&amp; (peso&gt;60)&amp;&amp; (peso&lt;90))&nbsp; printf ( "Pessoa esta no grupo de risco: 8 \n");
if ((idade &lt; 20) &amp;&amp; (peso&gt;90))&nbsp; printf ( "Pessoa esta no grupo de risco: 7 \n");&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ((idade &gt;20) &amp;&amp; (idade &lt;50) &amp;&amp; (peso&lt;=60))&nbsp; printf ( "Pessoa esta no grupo de risco: 6 \n");
if ((idade &gt;20) &amp;&amp; (idade &lt;50) &amp;&amp; (peso&gt;60)&amp;&amp; (peso&lt;90))&nbsp; printf ( "Pessoa esta no grupo de risco: 5 \n");
if ((idade &gt;20) &amp;&amp; (idade &lt;50) &amp;&amp; (peso&gt;90)) printf ( "Pessoa esta no grupo de risco: 4 \n");
if ((idade&gt;50) &amp;&amp; (peso&lt;=60)) printf ( "Pessoa esta no grupo de risco: 3 \n");
if ((idade&gt;50) &amp;&amp; (peso&gt;60)&amp;&amp; (peso&lt;90))&nbsp; printf ( "Pessoa esta no grupo de risco: 2 \n");
if ((idade&gt;50) &amp;&amp; (peso&gt;90))&nbsp; printf ( "Pessoa esta no grupo de risco: 1 \n");
system("PAUSE");
}
   2º) #include &lt;iostream&gt;
double preco, aum, valaum, imposto;int cat;char situa;

using namespace std;
main (){&nbsp; &nbsp;&nbsp; cout&lt;&lt;"Insira o preco do produto\n";&nbsp; cin&gt;&gt;preco;&nbsp; cout&lt;&lt;"Insira o codigo da categoria do produto.\n Digite: 1 para Limpeza, 2 para Alimentacao ou 3 para Vestuario\n";&nbsp; cin&gt;&gt;cat;&nbsp; cout&lt;&lt;"Digite a letra R para produtos que necessitam de refrigeracao\n e N para produto que nao precisa\n";&nbsp; cin&gt;&gt;situa;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;if (preco &lt;= 25)&nbsp; &nbsp; &nbsp;{&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if &nbsp;(cat == 1) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; aum =preco * 0.05;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if &nbsp;(cat == 2) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; aum = preco * 0.08;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if &nbsp;(cat == 3) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; aum = preco * 0.10;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout&lt;&lt;"O codigo da categoria informada nao se encontra cadastrado no sistema\n";&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; }&nbsp; &nbsp; else if (preco &gt; 25)&nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if &nbsp;(cat == 1) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; aum = preco * 0.12;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if &nbsp;(cat == 2) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; aum = preco * 0.15;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if &nbsp;(cat == 3) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; aum = preco * 0.18;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout&lt;&lt;"O codigo da categoria informada nao se encontra cadastrado no sistema\n";&nbsp;&nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; valaum=preco + aum;&nbsp; &nbsp; cout&lt;&lt;"O valor do aumento foi de R$ "&lt;&lt;aum&lt;&lt;" e o novo valor R$ "&lt;&lt;valaum&lt;&lt;"\n";&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; if ((cat == 2) || (situa == 'r')){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;imposto= valaum * 0.05;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cout&lt;&lt;"Valor do imposto:"&lt;&lt;imposto&lt;&lt;"\n";&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;else {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;imposto= valaum * 0.08;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cout&lt;&lt;"Valor do imposto:"&lt;&lt;imposto&lt;&lt;"\n";&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (valaum &lt;= 50 )&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cout&lt;&lt;"Barato\n";&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;else if ((valaum &gt;50) &amp;&amp; (valaum &lt; 120))&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cout&lt;&lt;"Normal\n";&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;else&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cout&lt;&lt;"Caro\n";&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; system("PAUSE");&nbsp;&nbsp; &nbsp; &nbsp;}