Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me figure out what I am doing wrong with my code. I am having issues with my last 'while' loop and I don't

Please help me figure out what I am doing wrong with my code. I am having issues with my last 'while' loop and I don't understand why one of my parameters are not being recognized.

Here are the error messages.

/home/runner/Assign-41-Arrays-and-Methods/main.cs(50,7): error CS1003: Syntax error, 'while' expected [/home/runner/Assign-41-Arrays-and-Methods/main.csproj] /home/runner/Assign-41-Arrays-and-Methods/main.cs(50,7): error CS1003: Syntax error, '(' expected [/home/runner/Assign-41-Arrays-and-Methods/main.csproj] /home/runner/Assign-41-Arrays-and-Methods/main.cs(50,32): error CS1026: ) expected [/home/runner/Assign-41-Arrays-and-Methods/main.csproj] /home/runner/Assign-41-Arrays-and-Methods/main.cs(50,32): error CS1002: ; expected [/home/runner/Assign-41-Arrays-and-Methods/main.csproj]

Here is my code.

using System;

class Program {

static double IncreasedCost(double payRaise, double payRate) { double[] employeePay = {35000, 38000, 40000, 47000, 59000}; string[] employeeName = {"One", "Two", "Three", "Four", "Five"}; double totalCost = 0; int employeeID;

Console.WriteLine($"ID.1 Employee {employeeName[0]} base pay is ${employeePay[0]}"); Console.WriteLine($"ID.2 Employee {employeeName[1]} base pay is ${employeePay[1]}"); Console.WriteLine($"ID.3 Employee {employeeName[2]} base pay is ${employeePay[2]}"); Console.WriteLine($"ID.4 Employee {employeeName[3]} base pay is ${employeePay[3]}"); Console.WriteLine($"ID.5 Employee {employeeName[4]} base pay is ${employeePay[4]}"); Console.Write(" From the above list enter in the employee's ID number that you would like to perform pay raise calulations on. "); employeeID = Convert.ToInt16(Console.ReadLine()); employeeID = employeeID - 1; Console.Write("Enter in pay raise value here: "); payRaise = Convert.ToDouble(Console.ReadLine());

payRate = Convert.ToDouble(employeePay[employeeID]); totalCost = totalCost + payRate * payRaise;

return totalCost; } public static void Main(string[] args, string payRaise, string totalCost, string employeeID) {

Console.WriteLine("This program is designed to run simulations of pay raises.");

do { Console.Write("Enter in 'yes' if you wish to start otherwise input (y/n)" ); string response = Console.ReadLine(); response = response.ToLower(); while(string.IsNullOrEmpty(response)) { Console.Write("Please enter in a response: "); response = Console.ReadLine(); response = response.ToLower(); } while(true) { if (response == "yes") { break; } else if (response == "no") { break; } else { return; } } } While(response == "yes") { totalCost = IncreasedCost(payRaise, payRate); Console.WriteLine($"For employee ID.{employeeID} The total cost of a {payRaise}% raise is {totalCost}"); } Console.WriteLine("The session has ended."); } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

? 061906448X, 978-0619064488

More Books

Students also viewed these Databases questions

Question

Explain why many households do not participate in the stock market.

Answered: 1 week ago

Question

What are the objectives of job evaluation ?

Answered: 1 week ago

Question

Write a note on job design.

Answered: 1 week ago

Question

Compute the derivative of f(x)cos(-4/5x)

Answered: 1 week ago

Question

Discuss the process involved in selection.

Answered: 1 week ago