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?

/*Program to determine company's weekly payroll*/

#include <iostream>
#include <string>
#include <fstream>
using namespace std;
void NametheFile() {

ifstream inputFile;

[Code] ....

View 1 Replies


ADVERTISEMENT

C++ :: Payroll Program Of A Company That Have At Least 5 Employees

Oct 1, 2014

Make a c++ program of the payroll of a company

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.*

View 11 Replies View Related

C++ :: Using Overloaded Function To Calculate Weekly Rate Of Employees

Aug 5, 2013

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

[Code]...

View 3 Replies View Related

C++ :: Program To Calculate Fine Using Class - Calling Constructor

Sep 7, 2013

// Program to calculate fine using class.

#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
class library {
long bookid;
char bookname[25];

[Code] ....

In the above program, how do I call the diff. constructors in main?

View 5 Replies View Related

C++ :: Calculate Area For 500 Different Measurements For Playground Company In Region

Feb 13, 2014

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

View 3 Replies View Related

C :: Calling Functions From Parallel (MPI) Fortran Program

Apr 24, 2013

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?

View 2 Replies View Related

C++ :: Painting Company - Calculate Amount Of Paint Required For Every Contract

Dec 15, 2014

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.

View 8 Replies View Related

C++ :: Void Function To Calculate Payroll

Dec 9, 2014

The purpose of this code is to calculate a pagecheck for intered hours and overtime for any hours over 40! This is what I have so far!

#include<iostream>
using namespace std;
void Amount (int hours, int wage, int sum);
void printCheck(int sum);
int main()

[code]....

View 1 Replies View Related

C++ :: Functions Without Parameters - Compute And Print Total Number Of Products For Company

Mar 27, 2013

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.

View 17 Replies View Related

C/C++ :: Program Using Multiple Functions That Will Calculate Salary?

Feb 21, 2014

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 */

[code]....

View 2 Replies View Related

C++ :: Program To Call Relevant Functions To Calculate Final Price

Sep 14, 2014

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.

#include <iostream>
using namespace std;
double amount;
double studendOrPensioner(int&choice, double &origPrice);
double OtherCustomers(int&choice,double& origPrice);

[Code]...

View 1 Replies View Related

C++ :: Cab Company Program / Endless Loop?

Jan 14, 2015

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 () {

[code]....

View 3 Replies View Related

C++ :: Program For Used Car Dealer Company To Maintain Cars Inventory And Details

Aug 25, 2014

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

View 1 Replies View Related

C/C++ :: Payroll Program Net Pay By Pointers

May 15, 2014

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);

[Code] ....

View 14 Replies View Related

C++ :: Calling Template Functions

Feb 21, 2013

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.

View 1 Replies View Related

C++ :: Calling Functions Of Class And Outside With Same Name?

Apr 6, 2013

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,

#include <iostream.h>
#include <conio.h>
void main();
void loop()

[Code]....

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?

View 7 Replies View Related

C++ :: Calling Functions From Templates?

Mar 14, 2013

Having issues calling my arguments from my templates, when i declare x and n in the main it comes up with errors

code below:

#include <iostream>
#include <cmath>
#include <cstring>
#include <string>
#include <string.h>
using namespace std;
int intInput1, intInput2;

[code].....

View 4 Replies View Related

C++ :: Payroll Program - Calculation Error?

May 22, 2014

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];

[Code] .....

View 14 Replies View Related

C :: Writing Factorials And Calling Other Functions To Do So

Jul 6, 2013

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[]) {

[Code] .....

View 13 Replies View Related

C++ :: Calling Functions - Vector Of Pointers

Mar 27, 2013

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.

View 15 Replies View Related

C++ :: Create Two Threads Calling Even And Odd Functions

Mar 1, 2013

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.

View 6 Replies View Related

C++ :: Sinking Fund And Calling Functions

Nov 17, 2014

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;

[code].....

View 1 Replies View Related

C++ :: Calling Functions From Text Files?

Jan 5, 2015

I'm working on a code that reads a text file and follows the instructions written in that file. An example of the text file:

*sum
11 4 61 2
1 2 0 14
17 99 1 1
*subtract
5 6 7
1 1 1
45 6 9

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:

78
17
118
-8
-1
30

That is:

11 + 4 + 61 + 2 = 78
1 + 2 + 0 + 14 = 17
17 + 99 + 1 + 1 = 118
5 - 6 - 7 = -8
1 - 1 - 1 = -1
45 - 6 - 9 = 30

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.

View 5 Replies View Related

C/C++ :: Calling Functions Inside A Class?

Nov 4, 2014

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.

View 1 Replies View Related

Visual C++ :: Mq4 Platform Calling Functions From DLL

Feb 10, 2013

I have Mq4 platform calling functions from DLL some how it doesnt make any differents when I make the call....

// DLL Code

#define WIN32_LEAN_AND_MEAN
#define MT4_EXPFUNC __declspec(dllexport)
using namespace std;
std::string My_String;
#define stringify(mymonths ) # mymonths

[Code] ....

I call this function

bool counts = StartRulls(bars);
Print("counts =",counts );
2013.02.09 23:03:242010.03.31 16:37 My_Mq4.mq4 EURCAD,M5: counts = 1

My result always stays 1

View 4 Replies View Related

C/C++ :: Employee Payroll Calculations Program For A Class

Sep 30, 2013

getting output from my code when I compile, the codeblocks ide doesnt show any errors it just doesn't give me any out put when I compile?

Here is my code:

#include <iostream>
#include <string>
#include <iomanip>  
using namespace std;  
//
//CLASS DECLARATION SECTION

[code].....

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved