C/C++ :: Create Program To Calculate A Percentage For Commission And Bonus?

Feb 11, 2014

I am using codeblocks for school and I am trying to create a program to calculate a percentage for commission and a bonus. I have tried using a decimal for percentage, int and floats with casting. Every time it I try it displays 0 or just the bonus. I even took and did a test page. My head is about to pop.

Write an algorithm that can be used to calculate the commission earned in a real estate transaction. The chart below describes the formulas used to calculate the commission.

Sales Price Commission
Less than $100,000 5% of Sales Price
$100,000 to $300,000 $5,000 + 10% of Sales Price over $100,000
More than $300,000 $25,000 + 15% of Sales Price over $300,000

// Commission and Bonuses.
#include <iostream>
#include <iomanip>

[Code].....

View 2 Replies


ADVERTISEMENT

C++ :: Program To Calculate Total Grade For N Classroom Exercises As Percentage

Mar 5, 2013

Write a program that calculates the total grade for N classroom exercises as a percentage. The user to input the value for N followed by each of the N scores and totals. Calculate the overall percentage (sum of the total points earned divided by the total point possible) and output it as a percentage. Sample input and output it as a percentage. Sample input and output is shown below.

How many exercises to input?
score1: 10
total points possible: 10
score2: 7
total points possible: 12
score3: 5
total points possible: 8

Code:
# include <iostream>
using namespace std;
int main () {
double N=0, score, total, totalScore=0, totalGrade=0, GRADE;
cout<<"How many excersices will be scored?/n";

[Code] .....

Error:
1>------ Build started: Project: HOMEWORK5, Configuration: Debug Win32 ------
1>LINK : error LNK2001: unresolved external symbol _mainCRTStartup
1>C:UsersWORKHOMEWORK5DebugHOMEWO… : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

View 4 Replies View Related

C++ :: Dice (with Varying Number Of Sides) Program To Calculate Percentage Of Results

Oct 28, 2013

I am trying to code and compile a program that requests a uses to first inpu the number of sides they wish for a dice to have and secondly input the number of dice throws they would like to calculate the value for. The program will print an error message and default the number of sides the dice has to 5 if the number entered is below 4. Finally it will print out a percentage figure for each value that results from all the the dice rolls.

I have attached my header, driver and class files below along with accompanying error messages below them

// file name Exercise.cpp
#include <iostream>
#include "Die.h"
using namespace std;
int main() // the main program begins here
{
char restart = 'y'; // declare variables
double numRolls = 0.0;
int diceTot = 0;

[Code] .....

View 5 Replies View Related

C++ :: Looping And Calculate The Percentage?

Mar 7, 2013

#include <iostream>
#include <iomanip>
#include <math.h>

[Code].....

I AM HAVING TROUBLE CALCULATING THE PERCENTAGE. I HAVE TO CALCULATE THE AMOUNT OF MONEY FOR 6 YEARS.

View 1 Replies View Related

C/C++ :: Calculate Cost From Wholesale To Final With Percentage Markup

Apr 15, 2014

Program calculates cost from wholesale to final cost with percentage markup!

#include <iostream>
using namespace std;
int calculate_retial(int,int);
int main () {
int wholesale;
int markup;
int cost;

[Code] ....

View 5 Replies View Related

C/C++ :: Calculate Percentage Of Even Numbers Entered By User In Array

Nov 18, 2014

exercise in c: write a program which calculates % of even numbers entered by a user in an array;

1) check if user hasn't entered float value; if has issue warning;
2) give the option for user to press "stop" to exit program any time.

int c,sk[100],i,sum1=0, sum2=0, rel;
printf ("How many numbers will you enter?
");
scanf ("%d", &c);
printf ("Enter %d numbers (to exit program press - stop)
", c);

[Code] ....

View 1 Replies View Related

C++ :: Calculate Percentage Of Times Coin Flipped Either Heads Versus Tails

Feb 10, 2015

I'm having trouble getting the program to calculate the percentage of times it flipped either heads versus tails. I realize what I currently have doesn't work because above I initialized heads and tails by giving them values of 0, but I'm unsure of how to fix it.

#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main () {
srand(time(0));

[Code] .....

View 2 Replies View Related

C :: Create A Program That Will Calculate A Shipping Cost?

Feb 16, 2015

So im trying to create a program that will calculate a shipping cost. I'm stuck on trying to calculate the actual milage and cost. Example being 1400 miles for a 2lb package would be $2 for every 500miles. so it would cost $6. But Im having trouble getting the program to round up the 1400 to 1500 so it charges the correct amount.

I know there would have to be a way to do this without programming all the conditions.

Also the course has not reached loops yet.

Code:

// This program will calculate the shipping charges.// The shipping rates are based on per 500 miles shipped.
// They are not pro-rated, i.e., 600 miles is the same rate as 900 miles or 1000 miles.
#include <stdio.h>
#include <stdlib.h>

[Code]......

View 1 Replies View Related

C++ :: Create A Program That Reads Numbers And Calculate Them On A Separated Subroutine

Nov 15, 2013

I need to create a program that reads some numbers, and calculate them on a separated subroutine, and the return of this subroutine must be the sum of all the numbers. I'm getting an error but I can't figure out why =/

#include <iostream>
using namespace std;
int calc(int val, int qtd){
int sum=0;
for (int cont=0; cont<qtd; cont++)
sum=sum+val;
return sum;

[Code]...

The error that I'm getting is on the line 22.

The error message: "invalid conversion from 'int*' to 'int' [fpermissive]

View 4 Replies View Related

C/C++ :: Create Program To Calculate Flight Time And Fuel Burn Of Airplane?

Aug 8, 2014

I'm trying to create a program to calculate the flight time and fuel burn of an airplane. However when I repeated the whole calculation, it did not show any data or result like the previous calculation. In addition, the "If" statement that I used to test the "fuelRemain" doesn't work properly. I can't figure out why.

Here are the outputs [URL]

#include <iostream>
#include <fstream>
#include <string>

[Code].....

View 2 Replies View Related

C++ :: Program To Display Percentage Of Calories Come From Fat

Mar 18, 2013

Write a program that asks the user to enter the number of calories and fat grams in a food item. The program should display the percentage of the calories that come from fat. One gram of fat has 9 calories, so:

(Calories from fat) = (fat grams) * 9

The percentage of calories from fat can be calculated as:

(Calories from fat) / (total calories)

Extend as follow

1. The user first enters from a menu whether it is breakfast (B or b), lunch (L or l) or dinner (D or d). Use character and process by a switch.
2. The threshold for low calorie is different, for breakfast 10%, lunch 20%, dinner 30% (this value has to be assigned to some threshold variable in the above switch).
3. Include validation of menu choice.
4. In case any validation fails, display detailed error and exit the program by calling return 1 or return EXIT_FAILURE
5. Display the % from fat with one decimal digit.

Example 1:
What you have to eat:
B - breakfast
L - lunch
D - dinner
What you have: C
Error: C is not a valid menu choice

Example 2:
What you have to eat:
B - breakfast
L - lunch
D - dinner
What you have: L
How many calories: 600
How many grams of fat: 10
Your food has 15.0% calories from fat
It is a low calories food

Process the menu in a switch, setting the threshold as either 10, 20, or 30%. The rest of the program will be the same regardless what was the menu choice.

Incremental development: first do the textbook problem without input validation, then extend with validation, then extend for the additional parts.

View 4 Replies View Related

C :: Create Function That Is Then Called To Calculate Powers

Nov 11, 2014

As I am taking my first steps in C, I study K&R (I guess most of you did the same, right?)

In the introductory chapter about functions (1.7) there is an example showing how to create a function that is then called to calculate powers (b**n). I simplified it to calculate only one given power, 2**5:

Code:

#include <stdio.h>
int power(int m, int n);
main() {
printf("%d", power(2,5));

[Code]....

It will then be called to make the calculation in the above string.

First things first: we already know how to use while(getchar!=EOF) to count characters (K&R chapter 1.5.2) but what if -instead- the input is a specific string? How to "read" it and how to tell my program that the string is finished? And most important: "reading" will be done in the function or in the rest of the body?

View 1 Replies View Related

C++ :: Float Function Of Percentage

May 28, 2013

Below is the code of a program using classes and functions ,, my float function doesn't show answer in fractions ,, show something else...

#include <iostream>
using namespace std;
class khan{
public:
void print(){
cout<<"welcome to the online Addition System!!!" <<"

[Code] ...

View 6 Replies View Related

C++ :: Show Percentage When File Is Being Updated

Jun 19, 2014

I want to update a file but I want to show the percentage when it is being updated. How can I do this? Do I need to use threads?

View 2 Replies View Related

C# :: Progress Bar Percentage Disappears When Loading

Mar 1, 2014

Why does my progressbar percentage text disapear when progressbar starts loading?? Am I missing out anything?

int percent = (int)(((double)(progressBar1.Value - progressBar1.Minimum) /
(double)(progressBar1.Maximum - progressBar1.Minimum)) * 100);
using (Graphics gr = progressBar1.CreateGraphics()) {
gr.DrawString(percent.ToString() + "%",
SystemFonts.DefaultFont,

[Code] ....

View 1 Replies View Related

C :: User Inputted Validated Grade As Percentage

Jan 2, 2014

I am trying to get this program to accept two inputs Student number and grade and validate them both

However the program skips over the student number

Code attached AssignmentProgram.c

View 1 Replies View Related

C++ :: How To Compare Two Files And Display Their Comparison Percentage

Feb 10, 2013

How to compare two files(two texts documents) and display their similarity percentage by using C++?

View 10 Replies View Related

C# :: Constant Read CPU Percentage And Display It To Textbox?

Feb 18, 2015

What I need to do Is constantly read the cpu percentage and display it to a textbox, but the issue is I am using the windows form not the console so I cant use a while loop. I think my best bet is to use an event, but I am not sure how.

View 6 Replies View Related

C++ :: Program To Calculate BMI

Oct 7, 2013

I'm trying to successfully run a program that calculates your BMI but, although it runs, it is not giving the the correct math. Instead, it gives me the number i've submitted as my weight as an answer. I'm using Visual Studio 2008 and the formula: weight / (height/100)*2

Here is my code

#include <iostream>
#include <cmath>
using namespace std;
int main() {
int weight;
int height;
double BMI;

[Code] ....

View 2 Replies View Related

C++ :: Program To Calculate Fractions?

Oct 24, 2013

I need to write a program that can calculate fractions.

View 2 Replies View Related

C++ :: Program That Calculate Discounts

Nov 8, 2013

So my midterm exam for programming is done. My program didn't run. Tried rewriting it once I got home. I am still getting an error that the program could not be run. Also, we weren't allowed to use the internet. So I didn't know how to calculate for the discounted rate.

I am using Microsoft Visual Studio 2010.

Given problem:

ABC Hotel offers 5-10% discounts depending on how much money has the user spent. If item purchase is lesser than 1000php (1USD is 43.19PHP) 5% discount is availed. Greater than 1000php then 10% discount is availed. Total price and discounted price should be displayed.

#include<iostream>
using namespace std;
main() {
float a,b,c,d,e,f,g,h,i,j,total,discounted_price;
cout<<"Please input price of first 1st item: ";

[Code] .....

View 1 Replies View Related

C :: Calculate Offset Of Simple Program

Sep 28, 2013

I would to learn how could i calculate the offset of simple c program?

Lets say that I have that simple program:

Code:
#include <stdio.h>
int main() {
int x=1;
printf("x = %d", x);
return 0;
}

View 9 Replies View Related

C :: How To Write A Program That Will Calculate Stress

Feb 7, 2013

I recently signed up for ES201 class and am confused with how to compile a program in the C language that will convert ACT scores to SAT scores.

View 5 Replies View Related

C :: Program That Will Calculate Strain Of Object

Feb 7, 2013

The equation for strain is:

delta(x)/x_0
delta(x) is the change in length of the rod(final length - initial length) x_0 is the original length of the rod

I'm trying to figure out how to write a program that will calculate the strain of an object, given its initial length and final length.

View 2 Replies View Related

C :: Program To Calculate Difference In Time?

Nov 6, 2014

i writing a code which will calculate the difference between time_in and time out. Can i use a 2 dimensional array for example

int time_in[hours][minutes]
int time_out[hours[minutes]

View 3 Replies View Related

C++ :: Program To Calculate How Many X Or / And Y From Specific Range

Nov 7, 2013

X and Y are numbers

For example: how many 2 or/and 5 are inside range of 0 to 30.
for or: there are 8 (2,5,12,15,22,25)
for and: there is only one (25).

View 1 Replies View Related







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