Hello, I’m working on this task:
Write a salary negotiation program that tells the user “I will give you {number} dollars, ok?” starting from 100. Every time the user answers “more”, it increases the number by 100. If the user answers “ok”, program outputs “Your salary is {number} dollars.” and exits. For example:
I will give you 100 dollars, ok?
>more
I will give you 200 dollars, ok?
>more
I will give you 300 dollars, ok?
>ok
Your salary is 300 dollars.
Here is my code:
namespace WhileLoop
{
class SalaryNegotiator
{
static void Main(string[] args)
{
int startSalary = 100;
bool check = true;
Console.WriteLine($"I will give you {startSalary} dollars, ok?");
while (check)
{
string answer = Console.ReadLine();
if (answer == "more")
{
startSalary = startSalary + 100;
Console.WriteLine($"I will give you {startSalary} dollars, ok?");
}
if (answer == "ok");
{
check = false;
Console.WriteLine($"Your salary is {startSalary} dollars.");
}
}
}
}
}
Can anyone please help me to solve it?