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


ADVERTISEMENT

C++ :: How To Implement Discounts - Calculate Shipping / Handling

Oct 3, 2013

How to implement the discounts and the shipping and handling

The store sells chocolates:
•Milk Chocolate @ $8.50 per pound
•Dark European Chocolate @ $9.75 per pound
•White Chocolate @ $10.50 per pound
•European Truffles @ $12.50 per pound

The store allows a customer discount based on:
1.$20.00 to $39.99 10% off
2.$40.00 to $59.9915% off
3.$60.00 to $79.9920% off
4.$80.00 and over25% off

Shipping & Handling is 10% of the net total (gross – discount).
Total Owed is Net Total plus Shipping and Handling)

You are using the switch to calculate the quantity discount. Since the switch does not allow a range, you have to set a “code” for the quantity range to use in the Switch such as and integer code 1, 2, 3, or 4 or maybe a char ‘a’, ‘b’, ‘c’ or ‘d’.

#include <iostream>
#include <conio.h>
using namespace std;
int main () {
int choice; // Hold a menu of choice
int pounds; // Hold the number of pounds
double charges; // Hold the price range
float discount; //Hold discount range

[Code] .....

View 3 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 Total Cost Given The Tax Values - Getting C2784 Error

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

C :: Calculate Cost For Production Of Open Top Cylinders - User Defined Functions

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

C++ :: Word Counter - Calculate Number Of Letters And Give Total Cost

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

Visual C++ :: Calculate Total Of Monthly Costs Of Expenses And Show Annual Cost

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

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 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++ :: Write Program That Uses Function To Compute The Cost?

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

Visual C++ :: Calculating Shipping Charges - Amount Always Comes Up As Flat Rate Variable

May 14, 2015

I'm currently working on a program that calculates shipping charges. However I'm stuck, whenever I compile the program the total amount at the end always comes up as my flat rate variable and not the total calculated number.

Code:
#include <iostream>
#include <iomanip>
#define FLAT_FEE 5
using namespace std;
int main() {
double num, pound, ship;
ship = FLAT_FEE;

[Code] ....

View 6 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++ :: Memory Cost On The Loop Of Menus?

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

C/C++ :: Declare And Initialize A Pointer To Variable Int Cost

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

C++ :: Equation That Determines The Lowest Possible Cost For Laying Power Line

Apr 9, 2013

I need an equation that determines the lowest possible cost for laying power line.

The variables are as follows:

1. The width of a river
2. The distance a factory is downstream from a station on the other side of the river.
3. The cost for laying line underwater.
4. The cost for laying line on land.

All these variables will be user input each use of program.

View 4 Replies View Related

C++ ::  Minimum Cost Path Visiting Half The Cells In A Grid?

Mar 11, 2013

I am trying solve this a problem: [URL] .....

In short:
1. Input is an N x N grid with a non-negative integer in each cell.
2. We can move from one cell to any of its adjacent cell in all four directions.
3. The 'cost' needed to move from one cell to another is the positive difference of their values.
4. We have to find the minimum cost such that we can visit atleast half of the cells with that cost;

I am not being able to think of any solution that runs in time O(N2) or better (N2 because of the size of N, any algorithm worse than it will not run within the time limit) for this problem.

So I need a hint on how to solve this problem optimally.

View 2 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/C++ :: Parking Garage Cost Calculator Based On Type Of Vehicle And Time

Nov 3, 2014

There are a few functions for this code and I am not very good with functions yet(we just learned about them last week).

//This program will calculate the cost of using a parking garage
//based on the type of vehicle and the time of parking.
#include<iostream>
#include<stdio.h>
#include<cmath>
#include<string>
using namespace std;
//define rates

[Code] ...

Error List:

Error1error C2100: illegal indirectionc:userscodydesktopgaragecodegaragecodesource.cpp971GarageCode
Error2error C2100: illegal indirectionc:userscodydesktopgaragecodegaragecodesource.cpp1051GarageCode
Error3error C2561: 'main' : function must return a valuec:userscodydesktopgaragecodegaragecodesource.cpp1161GarageCode

[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