Note : (I am a beginner in programming, can you give me a detail that will help
ID: 3793525 • Letter: N
Question
Note : (I am a beginner in programming, can you give me a detail that will help me to understand. Thank you)
Write a C# program that could be used as a very basic police sketch program. At a minimum, the user will choose:
The Main( ) method will contain 3 method calls to hair, eye, and mouth categories. In each of the category methods, it allows the choice of one of the three styles. In other words, each category method needs to first prompt the choice of 3 items and then receive a choice from the keyboard. Afterward, it uses if-else statement to output the corresponding style. Sample output:
Choose a hair style:
Your sketch looks like this:
Remember: If you want to display a , you must use two of them: \.
Explanation / Answer
Please find the code below:
Design the sketch as you like. Use the console application to compile the code.
//Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace Rextester
{
public class Program
{
string A = " ";
string B = " ";
string C = " ";
string D = " ";
string E = " ";
string F = " ";
string G = " ";
string H = " ";
string I = " ";
public static void Main(string[] args)
{
Program Body = new Program();
Body.hair();
Body.eye();
Body.Print();
}
public void hair()
{
int num1 = 0;
Console.Write("Enter the Choice :");
num1 = Convert.ToInt32(Console.ReadLine());
if(num1 == 1)
{
Console.Write("parted");
A = "|||||";
}
else if(num1 == 2)
{
Console.Write("straight-up");
B = "\\";
}
else
{
Console.Write("Balding");
C = " ";
}
}
public void eye()
{
int num2 = 0;
Console.Write("Enter the Choice :");
num2 = Convert.ToInt32(Console.ReadLine());
if(num2 == 1)
{
Console.Write("beady eyed");
D = "o o";
}
else if(num2 == 2)
{
Console.Write("wide eyed");
E = "O O";
}
else
{
Console.Write("wears glasses");
F = "=0-0=";
}
}
public void mouth()
{
int num3 = 0;
Console.Write("Enter the Choice :");
num3 = Convert.ToInt32(Console.ReadLine());
if(num3 == 1)
{
Console.Write("smiling");
G = "-_-";
}
else if(num3 == 2)
{
Console.Write("Straight faced");
H = "---";
}
else
{
Console.Write("Surprised");
I = "(O)";
}
}
public void Print()
{
if(A !=" ")
{
Console.Write(A);
}
if(B !=" ")
{
Console.Write(B);
}
if(C !=" ")
{
Console.Write(C);
}
Console.Write("|| || || ||");
if(D !=" ")
{
Console.Write(D);
}
if(E !=" ")
{
Console.Write(E);
}
if(F !=" ")
{
Console.Write(F);
}
Console.Write("| | | |");
if(G !=" ")
{
Console.Write(G);
}
if(H !=" ")
{
Console.Write(H);
}
if(I !=" ")
{
Console.Write(I);
}
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.