Question

In: Computer Science

Write a program where the main part of the program collects the data such as employee hours, hourly rate, state of residence, and marital status.

IN BASIC. all answers are in C++ , java but i need it in BASIC PLEASE.

Write a program where the main part of the program collects the data such as employee hours, hourly rate, state of residence, and marital status.

It then calls the function Calculatewages() function and sends employee hours and hourly rate.

The Calculatewages () function would calculate the wages and sends it back to the main.

The main program would use the wages returned by Calcualewages() function and send it another function called CalcualteFederaltax() along with marital status. The CalcualteFederaltax() function would calculate the federal tax based on marital status and send the fedtax amount back to the main.

Then the main function would call another function called calculatestatetax() and send the wage and state of residence info to that function. Calculatestatetax() function would calculate the state tax based on the state of residence and send stat tax back to the main.

The main then would call the function calcualtenet() function and send wage, fedtax, and statetax returned by the above functions.

The calculate function would calculate the net wages, and display all information such as wage before tax, taxes, and wage after taxes.

You can write your program based on the following program skeleton

‘main part of the program.

Collect hoursworked, hourlyrate, stateofresidence, maritalstatus from the user.

Call calculatewages() and send hoursworked, and hourlyrate. The caclulatewages() function returns wages.

Call calculatefedtax() function and send marital status and wage returned by calculatewages() function.   This function returns fedtax.

Call calculatestatetax() function and send wage, stateofresidence. This function sends back statetax.

Call calculatenet() function and send, wage, fedtax, statetex. Note that fedtax was returned by calculatefedtax() function and statetax was returned by calculatestatetax() function.

End

Function calculatewages() receives hours worked and hourly rate from the main.

Calculate the wages and sends it back to the main.

End function

Function CalcualteFederaltax () receives wages, and maritalstatus from the main.

Calculate the fed tax based on the marital satus.

Calculate the fed tax at 20% for “Married” and at 25% for “Single”. For others calculate it at 22%

End function

Function calculatestatetax () receives wages and state of residence from the main.

Calculate the statetax sends it back to the main.

Statetax is calculated based on the following criteria.

For those who are from “CA”, “NV”, “SD”, “WA”, “AZ”, calculate the state tax at 8%

For those who are from “TX”, “IL”, “MO”, “OH”, “VA”, calculate the state tax at 7%

For those who are from “NM”, “OR”, “IN”, calculate the state tax at 6%

For the rest calculate the state tax at 5%

Send back the state tax to the main.

End function

Function calcualtenet () receives wages, fedtax, statetax from the main.

Calculate the netwages.

Display the wages, fedtax, statetax, netwages.

End function

Solutions

Expert Solution

IN JAVA

import java.util.Scanner;

/**
* @author
*
*/
public class CalculateTaxes {
   /**
   * @param args
   */
   public static void main(String[] args) {

       Scanner scanner = null;
       try {
           scanner = new Scanner(System.in);

           double hourlyrate;
           int hoursworked;
           String stateofresidence, maritalstatus;
           double wages, fedtax, statetax;
           System.out
                   .println("Enter hoursworked, hourlyrate, stateofresidence and maritalstatus:");

           hoursworked = scanner.nextInt();
           hourlyrate = scanner.nextDouble();
           stateofresidence = scanner.next();
           maritalstatus = scanner.next();

           wages = calculateWages(hourlyrate, hoursworked);
           fedtax = calcualteFederaltax(maritalstatus, wages);
           statetax = calculateStateTax(stateofresidence, wages);
           calcualtenet(wages, fedtax, statetax);

       } catch (Exception e) {
           // TODO: handle exception
       }

   }

   /**
   * method to calculate the netpay and display the result
   *
   * @param receives
   * @param wages
   * @param fedtax
   * @param statetax
   *
   */
   public static void calcualtenet(double wages, double fedtax, double statetax) {

       double netwages = wages - fedtax - statetax;

       System.out.println("\tWages: " + wages + ",\t Fedtax : " + fedtax
               + ", \t Statetax : " + statetax + " \t, Netwages : " + netwages
               + ". \n");

   }

   /**
   * methood to Calculate the statetax
   *
   * @param stateofresidence
   * @param wages
   * @return
   */
   public static double calculateStateTax(String stateofresidence, double wages) {

       double stateTax = 0.0;

       // those who are from “CA”, “NV”, “SD”, “WA”, “AZ”, calculate the state
       // tax at 8%
       if (stateofresidence.equalsIgnoreCase("CA")
               || stateofresidence.equalsIgnoreCase("NV")
               || stateofresidence.equalsIgnoreCase("SD")
               || stateofresidence.equalsIgnoreCase("WA")
               || stateofresidence.equalsIgnoreCase("AZ")) {
           stateTax = wages * 0.08;

           // those who are from “TX”, “IL”, “MO”, “OH”, “VA”, calculate the
           // state tax at 7%
       } else if (stateofresidence.equalsIgnoreCase("TX")
               || stateofresidence.equalsIgnoreCase("IL")
               || stateofresidence.equalsIgnoreCase("MO")
               || stateofresidence.equalsIgnoreCase("OH")
               || stateofresidence.equalsIgnoreCase("VA")) {
           stateTax = wages * 0.07;
           // those who are from “NM”, “OR”, “IN”, calculate the state tax at
           // 6%
       } else if (stateofresidence.equalsIgnoreCase("NM")
               || stateofresidence.equalsIgnoreCase("OR")
               || stateofresidence.equalsIgnoreCase("IN")) {
           stateTax = wages * 0.06;
       } else {
           stateTax = wages * 0.05;

       }

       return stateTax;

   }

   /**
   * method to Calculate the fed tax based on the marital satus
   *
   * @param maritalstatus
   * @param wages
   * @return
   */
   public static double calcualteFederaltax(String maritalstatus, double wages) {

       double fedTax = 0.0d;

       if (maritalstatus.equalsIgnoreCase("Married")) {
           fedTax = wages * 0.20;

       } else if (maritalstatus.equalsIgnoreCase("Singel")) {
           fedTax = wages * 0.25;

       } else {
           fedTax = wages * 0.22;

       }
       return fedTax;

   }

   /**
   * method to Calculate the wages
   *
   * @param hourlyrate
   * @param hoursworked
   * @return
   */
   public static double calculateWages(double hourlyrate, int hoursworked) {
       return hourlyrate * hoursworked;
   }

}

OUTPUT:

Enter hoursworked, hourlyrate, stateofresidence and maritalstatus:
5
60
CA
Single
   Wages: 300.0,   Fedtax : 66.0,    Statetax : 24.0    , Netwages : 210.0.


Related Solutions

Write a C program that calculates a worker’s wages from their hours worked and hourly rate....
Write a C program that calculates a worker’s wages from their hours worked and hourly rate. This wage calculator should also account for overtime hours, calculate amount to be witheld from taxes, and calculate the final net income. Required functionality: 1. Ask the user for the number of hours worked and hourly rate in dollars. The program should be able to accept decimal values for both of these (e.g. 3.2 hours, 11.25 dollars/hour) 2. Overtime hours are those worked in...
An employee receives an hourly rate of $15, with time and a half for all hours...
An employee receives an hourly rate of $15, with time and a half for all hours worked in excess of 40 during the week. Payroll data for the first week of the calendar year are as follows: hours worked, 46; federal income tax withheld, $110, Social security tax rate,6%; and Medicare tax rate, 1.5%; state unemployment tax, 5.4% on the fast $7,000; federal unemployment tax, 0.81% on the first $7,000. What is the net amount to be paid to the...
An employee receives an hourly rate of $15, with time and a half for all hours...
An employee receives an hourly rate of $15, with time and a half for all hours worked in excess of 40 during the week. Payroll data for the current week are as follows: hours worked, 46; federal income tax withheld, $120; all earnings are subject to social security tax; Social security tax rate, 6%; and Medicare tax rate, 1.5%; state unemployment compensation tax, 3.4% on the first $7,000; federal unemployment compensation tax, 0.8% on the first $7,000. Prepare the journal...
Write a function called compute_pay that accepts arguments representing the hourly wage of an employee and the number of hours that employee worked this week.
Python RephactorCompute Take Home PayWrite a function called compute_pay that accepts arguments representing the hourly wage of an employee and the number of hours that employee worked this week. The function should return the take home pay owed to the employee as a floating point value rounded to two decimal places.The normal work week is 40 hours, and the company pays employees "time and a half" for overtime. So, the total wages is the sum of regular wages and overtime...
1. An employee receives an hourly wage rate of $24, with time-and-a-half for all hours worked...
1. An employee receives an hourly wage rate of $24, with time-and-a-half for all hours worked in excess of 40 during the week. Payroll data for the current week are as follows: hours worked, 44; federal income tax withheld, $145; social security tax rate, 6.0%; Medicare tax rate, 1.5%; state unemployment compensation tax, 3.4% on the first $7,000; and federal unemployment compensation tax, 0.8% on the first $7,000. What is the net amount to be paid to the employee? Round...
Write the code in C++. Write a program to implement Employee Directory. The main purpose of...
Write the code in C++. Write a program to implement Employee Directory. The main purpose of the class is to get the data, store it into a file, perform some operations and display data. For the purpose mentioned above, you should write a template class Directory for storing the data empID(template), empFirstName(string), empLastName(string), empContactNumber(string) and empAddress(string) of each Employee in a file EmployeeDirectory.txt. 1. Write a function Add to write the above mentioned contact details of the employee into EmployeeDirectory.txt....
An employee receives an hourly wage rate of $16, with time-and-a-half for all hours worked in excess of 40 during the week.
An employee receives an hourly wage rate of $16, with time-and-a-half for all hours worked in excess of 40 during the week. Payroll data for the current week are as follows: hours worked, 47; federal income tax withheld, $145; social security tax rate, 6.0%; Medicare tax rate, 1.5%; state unemployment compensation tax, 3.4% on the first $7,000; and federal unemployment compensation tax, 0.8% on the first $7,000. What is the net amount to be paid to the employee? Round your...
PART A Write a program that converts a total number of seconds to hours, minutes, and...
PART A Write a program that converts a total number of seconds to hours, minutes, and seconds. It should do the following: Prompt the user for input Read an integer from the keyboard Calculate the result Use printf to display the output Your output must be of the format: totalSeconds seconds = numHours hours, numMinutes minutes, and numSeconds seconds For example: If the user entered: 5000 Your program would output: 5000 seconds = 1 hours, 23 minutes, and 20 seconds...
C++ write a program that asks the user to enter the hours and rate then calculate...
C++ write a program that asks the user to enter the hours and rate then calculate the gross pay for an employee, the program should test if the hours are regular (40), any hour more than 40 should be paid with the overtime rate: 1.5*rate. The program should ask repeatedly the user if he/she wants to continue: y or n, if the user types y, then the program should ask for the hours and rate for another employee then display...
Write a program with two input values, Hours and Rate. The program should first calculate Gross...
Write a program with two input values, Hours and Rate. The program should first calculate Gross pay, which is your pay before deductions. The program should then calculate the following three deduction amounts: Federal Tax (20% of Gross), State Tax (5% of Gross), Social Security Tax (6.2% of Gross). Then your program should calculate Net pay, which is your Gross pay minus the three deductions. The output should be all five of the calculated values.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT