C++ :: Program To Calculate Company Weekly Payroll - Calling Functions?
Jun 9, 2014
This program in not completed. I am creating a large program in order to calculate a company's weekly payroll. For now I am filling in the separate functions piece by piece before the rest of the program is completed.
Right now I am trying to use separate functions to call other functions. I need to ask the user for the file name and then open the file. I am no longer getting any compiler errors however when I run the program all it displays is "Welcome."
So it's not actually calling the NameTheFile function and the OpenTheFile function. It just says "Welcome" and then closes down. Why is it doing this?
input values : a. Name of Employee b. Position in the company c. No. of hours worked d. No. of overtime hours e. rate per hour
formula: basic pay = number of hours worked x rate per hour ot pay = overtime hours x 150% of rate per hour gross pay = basic pay + ot pay tot deduc = tax + sss + med
tax can be computed based on the following table: basic pay tax 10000 or less 1% of basic pay 10001-15000 2% of basic pay 15001-20000 3% of basic pay 20001-30000 4% of basic pay 30001 or more 5% of basic pay
sss = 10% of basic pay med = 6% of basic pay
net pay= gross pay - total ded
*The payroll should have at least 5 employees in it.*
The question involves me writing a program using a overloaded function to calculate the Weekly rate of employees but they get paid hourly and weekly. I get this error but do not know why,
#include <iostream> using namespace std; int calcWeeklyPay(int paidWeekly, int annualSalaryWeekly) //Returns the Weekly salary of weekly paid Employees int calcWeeklyPay(int paidHourly, int annualSalaryHourly) //Returns the Weekly salary of Hourly paid Employees
You are writing a program to calculate the area for 500 different measurements for a playground company in the region. The company must calculate square footage of each prospective playground, as well as the total cost to mulch each area. The cost of mulch changes frequently, so the company would like to be able to input the current cost per square foot of mulch each time they run the program. Since the quantity of data is large, the input should come from a file called “measurements.txt”. You can assume the file includes the length of each prospective playground, followed by the width. The file will be in the following format.
450300 120210 . . .
Ask the user the name of the file they would like to write to, as well as the current price of mulch per square foot. Output the area of each playground, along with the total price of mulch to the file that the user specifies. The playground company would like each column of output to be 20 characters in width. Each column should have an appropriate heading in the output file. You should format your output data appropriately. For example, for the input data displayed above, along with a $2.00 per square foot mulch price, the output would be:
Area Total Mulch Price 135000 $270000.00 25200 $50400.00
I'm working on a parallel Fortran program by using MPI, which calls a very good random number generator function from C (drand48 and srand48 for seed).
My Fortran program file "Par_PICFort_4.f95" is smt. like:
Code: PROGRAM main IMPLICIT NONE Include 'mpif.h'
[Code]....
I compile the code as: Code: mpif77 -o PIC Par_PICFort_4.f95 drand48.c Program seem to be running, but after checking the simulation results, I see that drand48 is not working in a parallel way. Creating independent random numbers which different seeds is very important for me.
Question: Is it possible to run the drand48.c file as parallel?
You work for a painting company. Your job is to calculate the amount of paint needed for every contract assigned to the company. This time, you need to paint an outside wall. The dimensions of the wall are 5 X 7m. The window is a circle with the radius of 1m. Write a program that would calculate the following:
The amount of paint needed knowing that you need 1 gallon per 10 square meters. The amount of time to complete the job knowing that it takes 1 hour per 10 square meters to prepare the surface, 5 minute per square meter to pant it and 5 minute per square meter to clean up the area.
Summary: 6 companies have a product in 5 different warehouses. Each company is identified by a positive ID number and each warehouse is identified by a number (1 for the first, 2 for the second,…)
Object: the object of this assignment is to write a C++ program which asks the user to enter a company ID number, and the number of products in each of the warehouses. It then computes and prints the total number of products for that company
If the total number of product is less than 100, it prints the message “place a new order”
Input: for each company, its ID, and the number of products in each warehouse with appropriate prompt messages. Example: Enter company ID number: 101 Enter number of products in warehouse #1:30 Enter number of products in warehouse #2:60 Enter number of products in warehouse #3:0 Enter number of products in warehouse #4:5 Enter number of products in warehouse #5:27 The total for company 101 is:122
Output: for each company, the total number of product, and the message “place a new order” if the total number of product is less than 100.
Method: 1. Define global variable, int total_prod to hold the total number of products for a company 2. define the function void compute_total() that uses a loop to read the number of the products in all warehouses for one company, computer the total number of products and store it into the global variable total_prod. 3. Define the function void new_order() that determines if a new order need to be placed as follows: if the total number of products (in the global variable total_prod) is less than 100, it prints the message “place a new order” 4. Your function main does the following in a loop: - read a company ID number - call function compute_total() to read the number of the product in all warehouses for that company, and to compute their sum - print the total number of the product for that company with an appropriate message - call the function new_order() to determine if a new order need to be placed.
I already wrote a program that will calculate the gross pay for a set of employees.
I want modify the code by adding multiple functions.
I want to create a separate function whenever possible to break up the program.
For example, I would like have a function for obtaining the hours from the user, another function for calculating overtime hours, another for calculating gross pay and another function for producing the output.
#include <stdio.h> #include <stdlib.h> #define STD_HOURS 40.0 #define OT hour>STD_HOURS #define SIZE 5 int main() { int clockNumber[SIZE] = {98401, 526488, 765349, 34645, 127615}; /* employee ID */
I want this programming to call functions choose between a customer type and call the relevent function to calculate the final price but it is not calling the functions.
I'm trying to get this program to return total taxi cab fair an infinite number of times, however, when I use the while statement after for and try to run the program, it just keeps displaying the first total fair rapidly.
specifications:A cab company needs a program to calculate the cost of a cab ride.
The driver will enter the length of the trip in miles.
The miles entered must be greater than 0.
Create a function to calculate the charge. The function should receive one argument, the length of the trip, and should return the total fare for the ride.
The taxi charges a fixed charge of $2.50, plus an additional charge of $1.85 per mile.
Allow the user to calculate any number of trips.
At the end display the total of all the fares.
here is my code:
#include <iostream> #include <iomanip> using namespace std; //function prototypes double getLength (); int main () {
You are required to write a program for a Used Car Dealer company. In the system you need to maintain the cars’ inventory and details. Each car in the company contains the following details:
• Car Registration Number • Car Make or Brand • Car Model • Car Colour (eg. Silver, Black , Red) • Year of manufacturing (The year the car was manufacture) • Engine Capacity (in cc) • Transmission (manual or automatic) • Cost of the car (SGD)
The Car Registration Number is in the format of AAA1234 or AA1234A or A1234A which is accordance to the Malaysia car registration format. The A alphabet is in accordance to the registration number for respective in Singapore. (eg. AEW9829 or W1212Y or MCD1177). Note the A and the 1234 total count in the registration number can be less than 3 like AT9829 or BHY280. The Car Make is for the identifying the manufacturer of the car like Honda, Toyota, Proton..etc. The Car Model is to represent the Manufacturers’ respective model like Honda City, Honda Civic, Honda Accord, Toyota Vios, Toyota Camry … etc.
You are required to create menu and operations for:
1) Create a new Car account 2) Edit existing Car account details 3) Remove a car account from the system 4) Search for cars in the system (based on Car Make, Model, Year of manufacturing or Price) 5) Check total inventory in the system
My objective is to write a payroll program that among other things sorts the net pay by using pointers. I've already written most the program and have written a working program that sorts the net pay just not by pointers. So What I'll be posting below is my program so far without the pointer sort function.
What I need to do to finish my program is figure out how to add pointers to sort net pay into it.
#include <iostream> #include <fstream>//file input output stream #include <iomanip> #include <string> using namespace std; //function prototypes int readalldata(long int id[], string fname[], string lname[], int hoursworked[], float hourlyrate[], int n);
How do I call these functions from Mechanical.h???
Mechanical.h #ifndef MECHANICAL_H_ #define MECHANICAL_H_ class statics { public:
template<class T> struct Inertia_types { T Rec(T _x, T _y); T Tri(T _x, T _y);
[Code] ...
I am trying to create templated functions which I can apply all data types to except for strings and other types such as wchar. Am I also writing these correctly? This is my first attempt ever doing this.
Just a few moments ago i was just doing foolish things in c++ and discovered something new. Though some of you might have known this, for those who dont know, take a look at the follwing 2 small programs,
so here is my problem. i think u wud have figured out what m trying to do above. am actually calling the main() of the class and from there, i want to call the usual main... the problem is, during A.main()'s run, if i refer to main(); , that call represents itself, that it, it is like it calls itself. How on earth can i call the outside main?
I'm working on a payroll program and I'm having problems that are causing calculation errors.
My input file is 1234FredJones4025.00 2345 TerrySmith6010.00
The errors I get are from the regular pay, over time pay, gross pay, tax amount and net pay calculations. They all look similar to this (6e+002). I believe they are occurring because regular pay isn't calculating correctly and the rest depend on that for their calculations. However, I can't see why regular pay isn't calculating correctly.
#include <fstream> #include <iostream> #include <iomanip> using namespace std; class payroll{ ifstream fin; char employeeid[100];
I am trying to get this statistical equation to work. m! / n! (m-n)!.
Code: #include <stdio.h> long factorial_M(long); // function prototype // long factorial_N(long); long total (long); int main(int argc, const char * argv[]) {
I have a vector of pointers inside a seperate Exam class.
vector <Question* > question_list
The Question class is my base class in which I have derived sub classes for the different types of questions (MultipleChoice, LongAnswer, etc.). I am using my vector to hold the different types of questions.
in each of those classes I have virtual "write" functions in both the base and the derived classes, that write to a file differing for each type of question.
My problem now is calling the write function from a Exam function. I've tried several methods, such as:
for (size_t i = 0; i < question_list.size(); i++) { question_list[i].write(testfile.c_str()); }
but it comes with two errors: "error C2228:left of '.write' must have class/struct/union" along with "IntelliSense: expression must have class type"
I have made a write function for the exam class as well but am not sure what it should include since the Exam class is not a derived class of the Question class.
I want to create two threads which will be calling even and odd functions where even function should print even number and odd function should print odd number.Can it be possible with condition variable? What is the code in both the cases i.e. two separate function and with condition variable.
I have to do this assignment but really don't understand the calling and called functions yet. Rewrite your program for computing the value of a sinking fund so that there is a C++ function that is called to calculate the value, i.e., a function that returns the accumulated value based on the number of years with the annual interest rate compounded monthly and a fixed-size monthly deposit.
My program is:
#include <iostream> #include <cmath> using namespace std; int main() { double R, r, t;
I want to read the text file line by line, each time I find an instruction (that is, the keywords *sum or *subtract) I want to make a summation (in the case of *sum) of all the numbers in each of the following lines, and repeat until the next instruction appear. So the text file above should generate:
how can I implement a dictionary(I'm guessing a dictionary is the best way to go here) so that when I read the string *sum i can call a function that does the summation of the following lines.
the size of the text file may be big (several mb) and the number of different instructions to search for may be in the magnitude of hundreds.
Im currently working on a class assignment and the pseudo code containing the instructions that I need to complete list:
//-------------------------------------------------------------------------------------------------------------- // CTOR: Point() // // DESCRIPTION // Default constructor. Initializes the point to be at the origin (0, 0) and the color to black = (0, 0, 0). // // PSEUDOCODE // Call Init() and pass 0, 0, 0, 0, and 0 as the parameters. //--------------------------------------------------------------------------------------------------------------
My code for this is:
Point::Point(){ void Init(0, 0, 0, 0, 0); }
The code I wrote for the function Init is here:
Point::Init(int mX, int mY, color mColor){ mX = 0; mY = 0; mColor = pInitColor; }
My problem here is that whenever I try calling this function in the point class, I get an error next to void Init saying incomplete type is not allowed. Also visual studio is telling me that it expects a ')' after my first zero in that line.