Document 7881984

Download Report

Transcript Document 7881984

Review of Sections & Logic
Sections
In Main
// declare section
decimal salary1;
decimal deductions1;
decimal netsal1;
decimal totalpayroll;
string textvar;
Sections
// Input section
Console.Write(“Please enter salary for person 1 ”);
textvar=Console.ReadLine(); // allow user input
salary1=Convert.ToDecimal(textvar);
Console.Write(“Please enter deduct for person 1 ”);
textvar=Console.ReadLine(); // allow user input
deductions1=Convert.ToDecimal(textvar);
Sections
// Calculations section
netsal1=salary1 – deductions1;
Sections
// results section
Console.WriteLine(“Person 1 Salary: {0} ”,
salary1;
Console.WriteLine(“Person 1 deductions: {0}
”, deductions1;
Console.WriteLine(“Person 1 Net Salary: {0} ”,
netsalary1;
OR
Console.Write(“Person 1 Salary {0}”, salary1);
Console.Write(“Person 1 Deductions {0}”,
deductions1);
Console.WriteLine(“Person 1 Net Salary {0}”,
netsalary1;
OR
Console.WriteLine(Gross 1 {0}, Deduct 1 {1},
Net Salary 1 {2}”, salary1, deductions1,
netsalary1);