0% found this document useful (0 votes)
15 views3 pages

Class Static Void String Char Double: Program

The document contains code that calculates the amount to pay based on a person's occupation and grade. It prompts the user to enter an occupation character ('P', 'C', 'D', 'N', 'O') and grade character ('B', 'R', 'M'), then uses nested switch statements to output the discount percentage and calculate the payment amount after applying the discount to an original amount of 300. The discount and resulting payment amount varies depending on the occupation and grade combination selected.

Uploaded by

Judith Briceño
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views3 pages

Class Static Void String Char Double: Program

The document contains code that calculates the amount to pay based on a person's occupation and grade. It prompts the user to enter an occupation character ('P', 'C', 'D', 'N', 'O') and grade character ('B', 'R', 'M'), then uses nested switch statements to output the discount percentage and calculate the payment amount after applying the discount to an original amount of 300. The discount and resulting payment amount varies depending on the occupation and grade combination selected.

Uploaded by

Judith Briceño
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

{

class Program
{
static void Main(string[] args)
{
char ocup, calif;
double desc, monto;
System.Console.WriteLine(" ingrese ocuoacion " );
ocup = Convert.ToChar(Console.ReadLine());
System.Console.WriteLine(" ingrese calificacion ");
calif = Convert.ToChar(Console.ReadLine());
switch (ocup)
{
case 'P':
System.Console.WriteLine(" policia ");
{
switch (calif)
{
case 'B':
System.Console.WriteLine(" descuento de: 60% ");
monto = 300 - (0.6 * 300);
System.Console.WriteLine(" monto a pagar " + monto);
break;
case 'R':
System.Console.WriteLine(" descuento de: 30% ");
monto = 300 - (0.3 * 300);
System.Console.WriteLine(" monto a pagar " + monto);
break;
case 'M':
System.Console.WriteLine(" descuento de: 10% ");
monto = 300 - (0.1 * 300);
System.Console.WriteLine(" monto a pagar " + monto);
break;

}
} break;

case 'C':
System.Console.WriteLine(" profesor de colegio ");
{
switch (calif)
{
case 'B':
System.Console.WriteLine(" descuento de: 50% ");
monto = 300 - (0.5 * 300);
System.Console.WriteLine(" monto a pagar " + monto);
break;
case 'R':
System.Console.WriteLine(" descuento de: 20% ");
monto = 300 - (0.2 * 300);
System.Console.WriteLine(" monto a pagar " + monto);

break;
case 'M':
System.Console.WriteLine(" descuento de: 10% ");
monto = 300 - (0.1 * 300);
System.Console.WriteLine(" monto a pagar " + monto);
break;
}
} break;

case 'D':
System.Console.WriteLine(" docente universitario ");
{
switch (calif)
{
case 'B':
System.Console.WriteLine(" descuento de: 40% ");
monto = 300 - (0.4 * 300);
System.Console.WriteLine(" monto a pagar " + monto);
break;
case 'R':
System.Console.WriteLine(" descuento de: 20% ");
monto = 300 - (0.2 * 300);
System.Console.WriteLine(" monto a pagar " + monto);
break;
case 'M':
System.Console.WriteLine(" descuento de: 0% ");
monto = 300 - 0;
System.Console.WriteLine(" monto a pagar " + monto);
break;

}
} break;

case 'N':
System.Console.WriteLine(" no docente universitario ");
{
switch (calif)
{
case 'B':
System.Console.WriteLine(" descuento de: 40% ");
monto = 300 - (0.4 * 300);
System.Console.WriteLine(" monto a pagar " + monto);
break;
case 'R':
System.Console.WriteLine(" descuento de: 10% ");
monto = 300 - (0.1 * 300);
System.Console.WriteLine(" monto a pagar " + monto);
break;
case 'M':
System.Console.WriteLine(" descuento de: 0% ");

monto = 300 - (0.0*300);


System.Console.WriteLine(" monto a pagar " + monto);
break;
}
} break;

case 'O':
System.Console.WriteLine(" otros ");
{
switch (calif)
{
case 'B':
System.Console.WriteLine(" descuento de: 30% ");
monto = 300 - (0.3 * 300);
System.Console.WriteLine(" monto a pagar " + monto);
break;
case 'R':
System.Console.WriteLine(" descuento de: 0% ");
monto = 300 - (0.0 * 300);
System.Console.WriteLine(" monto a pagar " + monto);
break;
case 'M':
System.Console.WriteLine(" descuento de: 0% ");
monto = 300 - (0.0 * 300);
System.Console.WriteLine(" monto a pagar " + monto);
break;

}
}

}
} break;

Console.ReadLine();

You might also like