Gross Wage Assignment Homework: Solve for Bangladesh, China, DR & Haiti

  • Thread starter Veronica_Oles
  • Start date
  • Tags
    Assignment
In summary, when you call GrossWage() and GrossWageBangladesh(), you are initializing GrossWageBan and GrossWageChi to 0, but when you call GrossWageChina(), you are not initializing them.
  • #1
Veronica_Oles
142
3

Homework Statement


Have to write a program that outputs the users gross wage. If the hours are over 40 then the hourly rate gets multiplied by 1.5.

We also have to output the salary people would get from different countries:

Bangladesh 0.15 cents
China 0.48 cents
Dominican Republic 1.60 dollars
Haiti 0.55 cents

This is all on c#.

Homework Equations

The Attempt at a Solution


Mod note: Added code tags
C:
static void Main(string[] args)
  {

  double dblHrsWorked = 0;
  double dblHrlyRate = 0;
  double grossWageBan = 0;
  double grossWageChi = 0;

  Console.Write("Please enter the hours worked: ");
  dblHrsWorked = double.Parse(Console.ReadLine());

  Console.WriteLine("Please enter the hourly rate($): ");
  dblHrlyRate = double.Parse(Console.ReadLine());

  Console.WriteLine("You make a total of " + (GrossWage(dblHrsWorked, dblHrlyRate)) + " dollars.");

  Console.WriteLine("People in the following countries make this amount of money: Bangladesh: " + (GrossWageBangladesh(grossWageBan)) + " dollars, China: " + (GrossWageChina(grossWageChi)) +" dollars.");

  Console.ReadKey();
  }  static double GrossWage (double hours, double rate)
  {

  double dblGrossWage = 0;

  if (hours > 40)
  {
  dblGrossWage = 40 * rate;

  dblGrossWage = dblGrossWage + ((hours - 40) * (rate * 1.5));

  }

  else
  {

  dblGrossWage = hours * rate;
  }

  return dblGrossWage;  }

  static double GrossWageBangladesh (double hours)
  {

  double dblBanGrossWage = 0;

  dblBanGrossWage = hours * 0.15;

  return dblBanGrossWage;

  }

  static double GrossWageChina(double hours)
  {

  double dblChinaGrossWage = 0;

  dblChinaGrossWage = hours * 0.48;

  return dblChinaGrossWage;

  }
  }
  }

I can't seem to figure out why the countries are not working can someone please Help me figure it out!
 
Physics news on Phys.org
  • #2
Veronica_Oles said:

Homework Statement


Have to write a program that outputs the users gross wage. If the hours are over 40 then the hourly rate gets multiplied by 1.5.

We also have to output the salary people would get from different countries:

Bangladesh 0.15 cents
China 0.48 cents
Dominican Republic 1.60 dollars
Haiti 0.55 cents

This is all on c#.

Homework Equations

The Attempt at a Solution


Mod note: Added code tags
C:
static void Main(string[] args)
  {

  double dblHrsWorked = 0;
  double dblHrlyRate = 0;
  double grossWageBan = 0;
  double grossWageChi = 0;

  Console.Write("Please enter the hours worked: ");
  dblHrsWorked = double.Parse(Console.ReadLine());

  Console.WriteLine("Please enter the hourly rate($): ");
  dblHrlyRate = double.Parse(Console.ReadLine());

  Console.WriteLine("You make a total of " + (GrossWage(dblHrsWorked, dblHrlyRate)) + " dollars.");

  Console.WriteLine("People in the following countries make this amount of money: Bangladesh: " + (GrossWageBangladesh(grossWageBan)) + " dollars, China: " + (GrossWageChina(grossWageChi)) +" dollars.");

  Console.ReadKey();
  }  static double GrossWage (double hours, double rate)
  {

  double dblGrossWage = 0;

  if (hours > 40)
  {
  dblGrossWage = 40 * rate;

  dblGrossWage = dblGrossWage + ((hours - 40) * (rate * 1.5));

  }

  else
  {

  dblGrossWage = hours * rate;
  }

  return dblGrossWage;  }

  static double GrossWageBangladesh (double hours)
  {

  double dblBanGrossWage = 0;

  dblBanGrossWage = hours * 0.15;

  return dblBanGrossWage;

  }

  static double GrossWageChina(double hours)
  {

  double dblChinaGrossWage = 0;

  dblChinaGrossWage = hours * 0.48;

  return dblChinaGrossWage;

  }
  }
  }

I can't seem to figure out why the countries are not working can someone please Help me figure it out!
When you call your GrossWageBan() and GrossWageChi() methods, you are passing a value of 0 for hours to each method. You should be passing the number of hours in the calls to these methods, not grossWageBan and grossWageChi. These two variables are initialized to zero.
 

1. What is a gross wage assignment and how does it work?

A gross wage assignment is a legal process where a portion of an employee's wages are withheld to satisfy a debt. In this case, for Bangladesh, China, DR, and Haiti, it refers to the amount of money that is deducted from an employee's gross wages to support the economic development of these countries.

2. Why do these specific countries require a gross wage assignment?

These countries have a high poverty rate and are in need of financial support for their economic development. By implementing a gross wage assignment, they can receive a steady stream of funds that can be used for various development projects and initiatives.

3. How is the amount of gross wage assignment determined for each country?

The amount of gross wage assignment for each country is determined by their respective governments, based on their economic needs and priorities. It may also be influenced by agreements or partnerships with other countries or international organizations.

4. Is gross wage assignment mandatory for all employees in these countries?

The implementation of gross wage assignment varies from country to country. In some cases, it may be mandatory for all employees, while in others, it may only apply to specific industries or income levels. It is best to consult with the government or a local agency for more information.

5. Can employees opt out of the gross wage assignment?

In most cases, employees cannot opt out of the gross wage assignment as it is a legal process. However, there may be certain circumstances where an employee can request to be exempted, such as financial hardship or if they are already contributing to other charitable causes. Again, it is best to consult with the government or a local agency for more information.

Back
Top