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
ADVERTISEMENT
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
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
Sep 3, 2014
// Purpose: calculate total cost given the tax values
#include <iostream>
#incluse <string>
using namespace std;
int main() {
double purchasePrice, stateTaxAmt, countyTaxAmt, totalCost;
//Display purchase price
[Code] ....
View 2 Replies
View Related
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
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
View Related
Aug 27, 2014
#include <stdio.h>
float total, avg, max, min;
float judge[4];
int index;
int array[4];
int main() {
total = 0.0;
max = array[0];
min = array[0];
[Code] ....
I dont understand how to make the array when it prints out only print out the final average and the final maximum score with the final minimum score but what its doing at the moment is just giving an average for each individual score taken...
Minimum and maximum scores are displaying 0.0
And it displays these things 4 times in a row i just want it to be displayed once.
View 1 Replies
View Related
Feb 20, 2013
I have this program I wrote to calculate cost for the production of open top cylinders and how to translate it into user defined functions. Here are the user defined functions I need to use instruct() get_area() comp_area() and print_area_cost() so the program will be in 4 parts.
Code:
#include <stdio.h>
int main()
{double radius,height,cost,single,all;
float surface_area;
int count;
double pi=3.14159265;
printf("Enter the radius of the base in cm^2:
[Code] ......
View 2 Replies
View Related
Nov 4, 2013
I am currently working on an assignment.
#include <iostream>
using namespace std;
int main(int argc, char *argv[]) {
char letter;
int count = 0;
double ppl = 0;
double finalCost = ppl * (count - 1);
[Code] ....
I am trying to create a word counter program that asks for the price per letter and then asks for the sentence they are writing. The app should then calculate the number of letters and give the total cost similar to:
You have 40 letters at $3.45 per letter, and your total is $138.00.
Everything compiles fine but when I run it the inputs don't work and it outputs:
You have -1 per letter, and your total cost is $-0.
View 2 Replies
View Related
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
Oct 5, 2012
The point of this is to calculate the total of the monthly costs of these 6 expenses and then to show the annual cost. However, there's just a couple of things that's giving me problems and it's the calcMonCost in my code. The error says that it is more than one instance of overload function and also that an unresolved external symbol. Everything else is fine. What does this mean?
Code:
#include <iostream>
#include <iomanip>
using namespace std;
void calcMonCost (double, double, double, double, double, double &);
void calcAnnCost (double, double, double, double, double, double &);
void getData(double &lnPymnt, double &insure, double &gas, double &oil, double &tires, double &maint);
[Code] .....
View 1 Replies
View Related
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
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
Feb 20, 2013
Write a C program that calculates the final value of an investment made in a TSX Market Linked GIC.
Specification
The return on this type of GIC (Guaranteed Investment Certificate) is based on the initial investment, the number of years (1, 2 or 3), a minimum return rate, a maximum return rate, a participation rate, the values of the TSX (Toronto Stock Exchange) index at specified intervals during the years, and the type of averaging of these values. The final investment value can only be calculated once all the TSX values are known.
If averaging is not used the TSX rate is determined from the opening and closing values only. If averaging is used the TSX rate is determined by calculating the TSX average at 6 monthly intervals, then is based on this average relative to the opening value. The TSX rate is then multiplied by the participation rate. If this new rate is below the minimum rate, then the minimum rate is used, and if it is above the maximum rate, then the maximum rate is used. Rates are printed to 2 decimal places, and the final investment is rounded down, and formatted using commas.
Only round down for the final investment. If the TSX rate is negative do not print the line for rate adjusted for participation. Assume that the final investment is less than one million dollars. (Hint: if you need to print leading zeros in a number, use the %0m.n format: example - the format specifier %06.2f prints 4.56 as 004.56)
Example 1: See below; averaging is not used, so TSX rate = (107-100)/100 = 7%. After using a participation rate of 80%, get 5.6% (which is between min & max rates).
Example 2: See below; averaging is used over 5 values to get a rate of 68% which equals 54.4% due to participation. This is more than the max rate, so the max rate is used.
The GIC calculator must use the following layout exactly.
+------------------------------------+
| TSX MARKET LINKED GIC CALCULATOR |
+------------------------------------+
Enter initial investment : 1000.00
Enter number of years [1,2,3] : 3
Enter minimum and maximum rates [%] : 1 20
Enter participation rate [%] : 80
Enter if averaging used [1=yes,0=no]: 0
Enter open and close values : 100 107
TSX rate . . . . . . . . . . . . . . 7.00%
Rate adjusted for participation . . 5.60%
Final investment . . . . . . . . . . $ 1,056.00
+------------------------------------+
| TSX MARKET LINKED GIC CALCULATOR |
+------------------------------------+
Enter initial investment : 2000.00
Enter number of years [1,2,3] : 2
Enter minimum and maximum rates [%] : 1 20
Enter participation rate [%] : 80
Enter if averaging used [1=yes,0=no]: 1
Enter 5 TSX values : 200 190 320 430 540
TSX rate . . . . . . . . . . . . . . 68.00%
Rate adjusted for participation . . 54.40%
Maximum rate is applicable . . . . . 20.00%
Final investment . . . . . . . . . . $ 2,040.00 i wrote something like
Code:
#include <stdio.h>
int main (void)
{
int years, minimum, maximum, partrate, x, open, close, tsxvalue;
float investment, tsxrate, y, finalinvestment, maxrate, minrate;
printf("+------------------------------------+
[Code] ....
I don't know what the exact calculation should be here now to get the rest....so I'm stuck here
View 2 Replies
View Related
Jan 31, 2014
I have to create a program that calculates the final scores per diver, who each get five dives. I have to include the difficulty level when figuring out this score, and I need to drop the highest and lowest scores.
Now, I'm reading from a file where the values are something like:
234 :Diver number
2.3 :Difficulty
2.1 3.2 4.0 2.3 3.8 :Scores
Would I create a parallel array for the difficulty, or include it in a 2D array with the scores. Something like
score[Difficulty][individualScores]; ?
Also, would I include a findMin and findMax in a function that calculates the total, seeing as how the highest and lowest must be dropped to determine the final score?
View 11 Replies
View Related
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
Sep 15, 2014
I am trying to code a program that takes in user inputted data about percentages and using it to later on calculate a final grade. 4 percents are inputted, for Assignments, Midterm1, Midterm2, and Finals. If the percents dont add up to 1 (i tell the user to enter the decimal value) I set up and if statement to catch it and end the program. Except that if i type in
Assignments = .3
Midterm1 = .3
Midterm2 = .3
Finals = .1
the program doesn't recognize that they add up to 1. Heres the relevant portion of my code [URL] ....
Here's some examples of how it works [URL] ....
And heres what i dont understand [URL] ....
Why is it saying .3 + .3 + .3 + .1 != 1 when .1 + .3 + .3 + .3 == 1?
View 1 Replies
View Related
Jan 28, 2015
I have a program that is reading six characters from a text file, swapping every other character(ABCD would read BADC), and then adjusting their value based on a user's adjusted value input. If the adjusted value is 5 then letter A becomes F.
The final output line should print the initial six characters followed by the final six characters after the swap and encrypt adjustment.
I can only manage to print the final characters. Am I far off thinking I need to use pointers to point to the original character values?
One more thing: instructor wants us to complete this project as simply as possible meaning without the use of arrays, loops, switch statements, etc.
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main() {
//declarations
char c1,
[Code] ....
View 4 Replies
View Related
Apr 7, 2013
I'm writing a program to calculate a final grade by adding 4 numbers minus the lowest grade and dividing by 3. My knowledge in c is not extensive I thought that a simple assigment operator would do the job but I'm getting a strange large numbers in the execution.
Code:
#include <stdio.h>
#include <stdlib.h>
main(){
int eg, g1, g2, g3, g4, fg, s1, s2, sg;
[Code] ....
View 4 Replies
View Related
Jun 26, 2014
I have a question on the wasting of the memory on the use of menus. What is the task: I have mainMenu, subMenu1, subMenu2, subMenu3, ... Entry from mainMenu, and chose 1(or 2, 3,..) to subMenu1. If tasks done, go back to the mainMenu.
The Codes:
void mainMenu(){
//input 1-3 by user
switch(choice) //choice is the input
[Code].....
My problem is: the call for mainMenu() in subMenus looks like a recursion, which means the memory would be reallocated again for the called maniMenu. Is that right?
If so, times of the memory space for mainMenu function are required if going back to mainMenu several times from subMenus. But what i wanna just a choice and I dont want to wast the memory.
View 4 Replies
View Related
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
Nov 1, 2013
Write a program that uses a function to compute the cost of a pizza with given diameter and the number of toppings. Constant will be the cost per toppings and cost per square inch. It will contain a reputable structure as well.
diameter=17
number of toppings=3
//complier directives
#include<iostream>
#include<iomanip>
#include<cmath>
#include<cstdlib>
[Code].....
View 6 Replies
View Related
Mar 2, 2014
this question would their be a different process if they asked "declare and initialize a pointer to the variable int cost[N][N]" Here's what I have so far
[#include<stdio.h>
int main() {
int a; // Step 1
int *ptr; // Step 2
a = cost; // Step 3
ptr = &a; // Step 4
return(0);
[Code] .....
View 5 Replies
View Related
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
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
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