m0stwanted143
Eternal Poster
- Joined
- Feb 8, 2016
- Posts
- 925
- Reaction
- 189
- Points
- 310
Attachments
-
You do not have permission to view the full content of this post. Log in or register now.
Hehe di ko alam boss yung Sinasabi nyu pero thanks po sa info. Meron po kc akong code pero ung name nlng po ang di ko makuha .if galing database yan, I usually use entity framework.. tapos iso-sort sa highest ang netpay.. tapos display nalang..
show mo daw code.Hehe di ko alam boss yung Sinasabi nyu pero thanks po sa info. Meron po kc akong code pero ung name nlng po ang di ko makuha .
string dec = "YES";show mo daw code.
string dec = "YES";
while (dec.ToUpper() == "YES")
Console.Write("NumberofCustomer"); size=Convert.ToInt32(Console.ReadLine());
Console.clear();
string[] name = new string[size];
double[] gp= new double[size];
double[] td = new double[size];
double [] NP= new double [size];
double max= 0;
For (int i = 0; i < size; i++)
{
Console.Write("Input Name: ");
narae = Console.ReadLine();
Console.Write( "Total Deduction: ");
td=Convert.ToDouble(Console.ReadLine());
NP = gp - td;
Console.Write("Netpay:" + NP);
if (max <NP)
{
max = NP;
}
}
Console.Write("NAME\t GROSSPAY\t TOTALDEDUCTION\t NETPAY");
for(i=0; i < size; i++)
{
Console.WriteLine(name+ "\t" + gp + "\t" + td + "\t" + NP);
}
Console.ReadLine();
Console.write("do u want to continue yes/no ");
dec = Console.ReadLine();
Console.Clear();
Ganyan po sir. Paanu nyu po nakuha yung same index nung netpay at name?
Paanu nyu po nakuha sir ung pinaka malaki at ung name ?
Paanu nyu po nakuha sir ung pinaka malaki at ung name ?
if (max <NP)
{
max = NP;
}
ang ginawa nyu po ba yungremember this
C#:if (max <NP) { max = NP; }
while true, ilagay mo sa variable ang index ng value ng NP .. (nilagyan ko ng since array siya.. and i ang ginamit mong variable sa loop)
tapos sa display naman..
ganito lang..
NetPay: NP[index];
Name: name[index];
gusto ko sana yung code nalang ibigay kaso mas maganda kase pag logic lang ang tinuturo
ang ginawa nyu po ba yung
C#:
Sa name at netpay sa dulo ito ba
Name[3]
Netpay[3]
Eh panu po un? Si User po ung mag iinput.
Paanu kung 10 ung nilagay nya tapos depende sa array index kung pang ilan un un dapat na ilalagay pero baka lang naman po kung ganyan ung ginawa mopo
int[] arr = {1,2,7,4};
int index= 0 ;
int lowestVal = 0; //sabihin natin na bawal mag input ng below 1 ang user
for(int i =0; i < arr.Length; i++)
{
if(arr[i] > lowestVal)
{
lowestVal = arr[i];
index = i;
}
}
//actually malapit nato sa sagot.. haha
static void Main(string[] args)
{
string dec = "YES";
int size = 0;
while (dec.ToUpper() == "YES")
{
Console.Write("NumberofCustomer: ");
size = Convert.ToInt32(Console.ReadLine());
string[] name = new string[size];
double[] gp = new double[size];
double[] td = new double[size];
double[] NP = new double[size];
double max = 0;
int index = 0;
for (int i = 0; i < size; i++)
{
Console.Write("Input Name: ");
name[i] = Console.ReadLine();
Console.Write("GP: ");
gp[i] = double.Parse(Console.ReadLine());
Console.Write("Total Deduction: ");
td[i] = Convert.ToDouble(Console.ReadLine());
NP[i] = gp[i] - td[i];
Console.WriteLine("Netpay:" + NP[i]);
if (max < NP[i])
{
max = NP[i];
index = i;
}
}
Console.WriteLine();
Console.WriteLine("NAME\t GROSSPAY\t TOTALDEDUCTION\t NETPAY");
for (int i = 0; i < size; i++)
{
Console.WriteLine(name[i] + "\t" + gp[i] + "\t" + td[i] + "\t" + NP[i]);
}
Console.ReadKey();
Console.WriteLine("Employee with Highest Net Pay");
Console.WriteLine("NET: {0}",NP[index]);
Console.WriteLine("Name: {0}",name[index]);
Console.Write("do u want to continue yes/no ");
dec = Console.ReadLine();
Console.Clear();
}
}
Sir sumuko ka rin . Hahaha galing mo sir. The best idol. Sa uulitin sana Salamat idolC#:static void Main(string[] args) { string dec = "YES"; int size = 0; while (dec.ToUpper() == "YES") { Console.Write("NumberofCustomer: "); size = Convert.ToInt32(Console.ReadLine()); string[] name = new string[size]; double[] gp = new double[size]; double[] td = new double[size]; double[] NP = new double[size]; double max = 0; int index = 0; for (int i = 0; i < size; i++) { Console.Write("Input Name: "); name[i] = Console.ReadLine(); Console.Write("GP: "); gp[i] = double.Parse(Console.ReadLine()); Console.Write("Total Deduction: "); td[i] = Convert.ToDouble(Console.ReadLine()); NP[i] = gp[i] - td[i]; Console.WriteLine("Netpay:" + NP[i]); if (max < NP[i]) { max = NP[i]; index = i; } } Console.WriteLine(); Console.WriteLine("NAME\t GROSSPAY\t TOTALDEDUCTION\t NETPAY"); for (int i = 0; i < size; i++) { Console.WriteLine(name[i] + "\t" + gp[i] + "\t" + td[i] + "\t" + NP[i]); } Console.ReadKey(); Console.WriteLine("Employee with Highest Net Pay"); Console.WriteLine("NET: {0}",NP[index]); Console.WriteLine("Name: {0}",name[index]); Console.Write("do u want to continue yes/no "); dec = Console.ReadLine(); Console.Clear(); } }
subukan mo nalang to..
may gagawin pa ako.. hahaha