Click here to Skip to main content
15,891,431 members
Home / Discussions / C#
   

C#

 
AnswerRe: Parentfolderagain Pin
S. Senthil Kumar21-Oct-05 20:38
S. Senthil Kumar21-Oct-05 20:38 
Questionhelp with GDI+ Pin
tawammar21-Oct-05 17:07
tawammar21-Oct-05 17:07 
AnswerRe: help with GDI+ Pin
S. Senthil Kumar21-Oct-05 20:39
S. Senthil Kumar21-Oct-05 20:39 
GeneralRe: help with GDI+ Pin
tawammar21-Oct-05 21:33
tawammar21-Oct-05 21:33 
GeneralRe: help with GDI+ Pin
S. Senthil Kumar21-Oct-05 21:46
S. Senthil Kumar21-Oct-05 21:46 
GeneralRe: help with GDI+ Pin
Sasuko22-Oct-05 0:26
Sasuko22-Oct-05 0:26 
AnswerRe: help with GDI+ Pin
[Marc]23-Oct-05 12:22
[Marc]23-Oct-05 12:22 
QuestionBeginner Question: Data type issue Pin
ivelander21-Oct-05 15:45
ivelander21-Oct-05 15:45 
I am almost done with a project to calculate employee salaries, but am having problems adding a 5% bonus on everyone's final salary. The salary variable is in integer format and I need to convert it to a double. is there a quick and easy way to fix this issue? I am getting the data type error in the Everbody's bonus section. Below is the code ( this is my first program ever, so it is most likely very sloppy, sorry in advance!):

using System;

namespace EmployeeSalary
{
/// <summary>
/// Calculates employee salary based on experience, birthday, position, and company success
/// </summary>

class EmployeeSalary
{

[STAThread]
static void Main(string[] args)
{
int executive, //employee's executive status
finalSalary = 0, //employee's final salary
baseSalary = 5000, //employee's base salary
experience, //employee's years of experience
birthday; //employee's birthday bonus


// Employee's executive status (1 = exec, 2 = not exec)
Console.Write( "Please enter executive code (1/yes 2/no): " );
executive = Int32.Parse( Console.ReadLine() );
if ( executive == 1 )
{
Console.WriteLine( "\nSorry, you're an executive, no benefits for you!" );
goto finalWrite;
}


//Employee's years of experience (1 = less than 3 yrs, 2 = 3 to 5 yrs, 3 = over 5 yrs)
Console.WriteLine( "\nPlease enter your experience code (1/less than 3 yrs, 2/3-5 yrs, 3/over 5 yrs)" );
experience = Int32.Parse( Console.ReadLine() );
if ( experience == 1 ) finalSalary = baseSalary - 2000;
else if ( experience == 2 )
{
finalSalary = baseSalary + 2500;
goto bonusAdd;
}
else if ( experience == 3 )
{
finalSalary = baseSalary + baseSalary;
goto bonusAdd;
}
else
{
Console.WriteLine("That is not a valid entry");
goto bonusAdd;
}

//Employee birthday question
Console.WriteLine( "\nIs this month your birthday (1/yes 2/no)?" );
birthday = Int32.Parse(Console.ReadLine() );
if ( birthday == 1)
{
finalSalary = finalSalary + 250;
goto bonusAdd;
}
if ( birthday == 2) goto bonusAdd;

//Everybody's bonus
bonusAdd:
finalSalary = finalSalary + (finalSalary * 0.5);

//Write final salary
finalWrite:
Console.Write("Your salary for this month is: ");
Console.WriteLine(finalSalary.ToString("c"));



}
}
}
AnswerRe: Beginner Question: Data type issue Pin
MoustafaS21-Oct-05 16:13
MoustafaS21-Oct-05 16:13 
AnswerRe: Beginner Question: Data type issue Pin
Matt Gerrans21-Oct-05 16:19
Matt Gerrans21-Oct-05 16:19 
AnswerRe: Beginner Question: Data type issue Pin
Matt Gerrans21-Oct-05 16:22
Matt Gerrans21-Oct-05 16:22 
GeneralRe: Beginner Question: Data type issue Pin
ivelander21-Oct-05 16:28
ivelander21-Oct-05 16:28 
GeneralRe: Beginner Question: Data type issue Pin
Matt Gerrans22-Oct-05 7:19
Matt Gerrans22-Oct-05 7:19 
QuestionPlease help... Pin
KORCARI21-Oct-05 12:39
KORCARI21-Oct-05 12:39 
QuestionMoving a graphic on a form Pin
har04mich21-Oct-05 11:41
har04mich21-Oct-05 11:41 
AnswerRe: Moving a graphic on a form Pin
Ali Beirami21-Oct-05 12:08
Ali Beirami21-Oct-05 12:08 
AnswerRe: Moving a graphic on a form Pin
S. Senthil Kumar21-Oct-05 20:42
S. Senthil Kumar21-Oct-05 20:42 
GeneralRe: Moving a graphic on a form Pin
Anonymous22-Oct-05 1:04
Anonymous22-Oct-05 1:04 
GeneralRe: Moving a graphic on a form Pin
S. Senthil Kumar22-Oct-05 1:15
S. Senthil Kumar22-Oct-05 1:15 
QuestionFirst Tablet PC Application using C# Pin
celllllllll21-Oct-05 11:25
celllllllll21-Oct-05 11:25 
QuestionCombobox problem Pin
Boggy21-Oct-05 11:02
Boggy21-Oct-05 11:02 
AnswerRe: Combobox problem Pin
Ali Beirami21-Oct-05 12:28
Ali Beirami21-Oct-05 12:28 
GeneralRe: Combobox problem Pin
Boggy21-Oct-05 15:35
Boggy21-Oct-05 15:35 
QuestionStreamWriter.WriteLine() doesn't complete on last line! Pin
Lord Kixdemp21-Oct-05 10:34
Lord Kixdemp21-Oct-05 10:34 
AnswerRe: StreamWriter.WriteLine() doesn't complete on last line! Pin
Robert Rohde21-Oct-05 10:49
Robert Rohde21-Oct-05 10:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.