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


ADVERTISEMENT

C :: Calculate Different Measurements For A Cylinder - Width Modifier For End User Input

Sep 12, 2013

I have created a program to calculate different measurements for a cylinder. Anyways, the end user has to input 3 variables.

Enter the lower radius: 6
Enter the upper radius: 5
Enter slant height: 2.236

The numbers are what "End User" would input. But I need to make it look like this when said "End User inputs the numbers.

Enter the lower radius: 6
Enter the upper radius: 5
Enter slant height: 2.236

Here is what I have for it, but I don't know what to put where.

printf("
Enter the lower radius: ");
scanf("%f", &lower_rad);
printf("Enter the upper radius: ");
scanf("%f", &upper_rad);
printf("Enter slant height: ");
scanf("%f", &slant_h);

View 1 Replies View Related

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 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++ :: Calculate Area Of Circle Without Pi

Mar 22, 2013

I was given an assignment for class to calculate the area of a circle using only the radius as a user input and not using Pi in the code. I need to do this by calculating the areas of a series of rectangles under the curve and adding them together. Using nested loops to continuously reduce the size of these rectangles until the approximated area value is within a margin of error less than 0.1%.

Code:
#include<iostream>
#include<cmath>
using namespace std;
int main ()

[Code] .....

View 7 Replies View Related

C++ :: Calculate Area And Volume Of Cylinder?

Apr 27, 2013

I would like to calculate area and volume of cylinder but radious and height should be integer, float and double. How can i do?

View 9 Replies View Related

C++ :: Calculate Area Using Rectangle / Trapezoid Or Both

Feb 17, 2014

#include <iostream>
#include <cmath>
using namespace std;

//prototypes for all separate functions
int chooseFunc(int);
int chooseMethod(int);
int numRect(int);

[Code] .....

It seems that my program will ask the user for the number of rectangles and trapezoids but will fail to compute the area under the curve from the user input. Therefore, I believe I have a logical error somewhere or I'm forgetting to call something somewhere.

View 1 Replies View Related

C++ :: Calculate Area And Perimeter Of A Rectangle

Jan 28, 2013

Write a program that prompts the user to input the length of a rectangle and the width of a rectangle and then displays the rectangle's area and perimeter. The program should be broken down in 3 parts:

1. Input the length and the width (two input statements)

2. Calculate the area & perimeter (results should be saved in variables

3. print results.

Format the output so the user can easily read the results. Use the tab escape so its easy to read.
---------------------------------------------------------------
So here's what I have so far. I have been stuck for two days

#include iostream
using namespace std;
int main () {
int double length;
int width;
int area;
int perimeter;

[Code] ....

I dont want to get a zero for not turning this in...

View 14 Replies View Related

C :: Calculate Area Of Rectangle - Variable R Is Being Used Without Being Initialized

Mar 15, 2014

I am writing a program to calculate a rectangle's area.

Eg.
Enter top left point: 1 1 (User input)
Enter bottom right point: 2 -1 (User input)
Top Left x = 1.000000 y: 1.000000
Bottom Right x = 2.000000 y: -1.000000
Area = 2.000000 (Program output)

It keeps on prompting me my variable r is being used without being initialized, when I think I already did so.

Code:
typedef struct {
double x;
double y;
} Point;

[Code] ....

View 8 Replies View Related

C :: How To Calculate Surface Area And Volume For Rectangular Prism

Jan 24, 2015

So for my assignment, I have to write code to calculate the surface area and volume for a rectangular prism that involves the use of functions. I made the program without functions and it works perfectly but as I'm putting in the required functions, it conversely made it non-functional, ironically. How to call functions correctly and the online book we're using now is confusing me even more.

Code:

#include <stdio.h>
#include <math.h>
int main(void) {
double x1, x2, x3, x4, x5, x6, x7, x8 = 0;
double y1, y2, y3, y4, y5, y6, y7, y8 = 0;
double z1, z2, z3, z4, z5, z6, z7, z8 = 0;
double length, width, height=0;

[Code]....

And here is the version I'm using to test it (without the need to input the individual coordinates).

Code:

#include <stdio.h>
#include <math.h>
int main(void) {
double x1, x2, x3, x4, x5, x6, x7, x8 = 0;
double y1, y2, y3, y4, y5, y6, y7, y8 = 0;
double z1, z2, z3, z4, z5, z6, z7, z8 = 0;
double volumePrism, surfaceArea =0;

[Code]...

View 3 Replies View Related

C++ :: Calculate Surface Area Of Various Shapes - Symbolic Constant For The Value Of PI

Mar 2, 2013

This error keeps coming.

******************************************************************
CSCI 240 Program 5 Part 2 Spring 2013

Programmer:
Section: 1
Date Due: 3/1/13

Purpose: This program uses functions to calculate the surface area of various shapes. It is an exercise in learning to write functions.
******************************************************************/

#include <iostream>
#include <iomanip>
using namespace std;
#define PI 3.14
//Symbolic constant for the value of PI

int Menu();
int getValue( string prompt, int lowerBound, int upperBound );

[Code] .....

View 10 Replies View Related

C/C++ :: Application To Calculate Area And Perimeter Of Geometric Shapes

Oct 18, 2013

How would this look like in C? Develop an application to calculate the area and perimeter of geometric shapes. First the user is asked to enter a letter representing the shape. We use C for circle, R for rectangle and S for square. After the user chooses the shape, the program prompts for the appropriate dimensions of the shape accordingly.

For instance, if the user has chosen a square, the program will ask for a side. If it's a circle, the program will ask for radius. If it's a rectangle, it will ask for length and width. Upon receiving the appropriate dimensions, the program will calculate the area and the perimeter of the requested shape and print it on the screen. And again, the code will ask for another letter. If the user enters 'Q' the program terminates.

Please Enter Shape (C: Circle, S: Square, R: Rectangle Q:quit) >S
Please enter the side of the square > 8
The area is 64 and the perimeter is 32
Please Enter Shape (C: Circle, S: Square, R: Rectangle Q:quit) >R
Please enter the width of the rectangle > 5
Please enter the length of the rectangle > 7
The area is 35 and the perimeter is 24
Please Enter Shape (C: Circle, S: Square, R: Rectangle Q:quit) >Q

View 1 Replies View Related

C/C++ :: Using Semaphores On Critical Region - Processes Not In Correct Order

Mar 2, 2014

I'm trying to use semaphores on three different processes so that each process won't enter the critical region at the same time and also go in the order: process 1 -> process 2 -> process 3. However, everytime i run the code the process 3 keeps going before process 2.

Here's my code:

#include <stdio.h>
#include <sys/types.h>
#include <sys/ipc.h>

[Code].....

the processes should print out like this:

process 1: 100000
process 2: 300000
process 3: 600000

View 1 Replies View Related

C++ :: Analyze And Elaborate Data From Particle Energy Measurements

Oct 13, 2013

I have to analyze and elaborate datas from particle energy measurements. I have a file txt like this

1 126 17 20 23 32 39 55 68 81 98 111 129 141 151 164 170 182 180 183 187 187 181 186 178 174 175 172 163 159 155 147 140 138 128 122 105 100 99 87 80 66 59 55 48 42 40 33 31 25 25 22 19 19 18 15 15 16 15 16 15 13 13 14 14 14 14 13 13 14 14 13 15 15 14 15 14 14 13 12 13 14 13 14 14 14 13 14 14 13 12 13 13 13 13 14 13 13 13 13 14 14 14 13 13 14 14 14 12 12 13 12 13 11 12 13 12 13 14 12 12 12 11 13 12 13 13 15

2 124 20 34 9 34 51 50 61 76 71 69 95 99 108 103 101 95 89 117 98 107 76 86 66 97 97 80 17 54 45 44 39 40 18 13 29 20 16 15 15 16 14 15 16 16 15 15 14 13 12 14 14 14 12 14 13 12 15 12 12 14 14 11 12 12 14 12 12 13 12 12 13 12 12 12 13 12 13 13 13 12 14 12 12 13 10 12 13 12 13 13 13 12 12 12 13 12 12 13 12 10 15 13 13 12 14 12 12 14 12 12 13 13 13 12 12 12 11 11 13 14 12 12 12 13

The first two numbers are the Particle ID and its Energy, the rest of numbers are the loss of energy(different in number for every particle).

I have to elaborate 1000 events like this and to create a function able to read every line and to count the number of the loss energy measurement.

I use ifstream to read a file text, but my problem is: my program how to understand that it's passing to the new line? I have to divided every events in Arrays of different length, so i have to count each data for every particle and then create the array.

The instruction EOF it's not good...

View 5 Replies View Related

C++ :: Design A Class To Store Measurements - Unresolved Externals Error

Jul 8, 2013

Assignment: Design a class to store measurements. The class should have two data items, feet and inches, both integers. The class must make sure that the number of inches never gets below zero or above 11. If inches is outside that range, adjust feet accordingly. (Yes this means feet might be a negative number.)

Create a default constructor and one which receives one integer, a number of inches.

Overload the following operators: addition, subtraction, equality, inequality, incrementation (both pre and post) (should add one to inches), and output (in the form of: F’I”)

Code:
#include <iostream>
using namespace std;
class measurements {

private:
int inches;
double feet;

[Code] ....

I am getting a LNK2019 error and an LNK1120 errors:

Error 1 error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup

Error 2 error LNK1120: 1 unresolved externals

View 3 Replies View Related

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/C++ :: Build A Sales Company Class?

Jul 1, 2014

Build a class named "salesCompany". Save it's name with a string and an array with records which will be filled with values from sales in different cities of the company.

Build the constructor which must get as a parameter the name of the company and a text file which will fill the array. There is an example of the text file format. Every line saves the sold quantity of a product, identified by a code, in a certain city.

CodeCityQuantity
1a63bCity11200
45ab8City2550
#include <iostream>
#include <string.h>
using namespace std;
class salesCompany {

[code].....

what should I add more and how can make it available for the user to enter as an input a text file.

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 :: Obtain Check Number And Then Company Information From Datafile

May 13, 2013

I have to obtain a check number from a datafile and then also get company information also from a datafile.

So my first question is about the:

Code:
char outputFilename[]= "out.list"

Is this the name of the output file I'm going to write to? And also the file has to be created before being used...is that line of code creating the file or do i have to create it in notepad?

Code:
FILE *ifp, *ofp;
char *mode = "r";
char outputFilename[] = "out.list";
ifp = fopen("in.list", mode);
if (ifp == NULL) {
fprintf(stderr, "Can't open input file in.list!

[Code] .....

View 7 Replies View Related

C :: Create List With Employees Of Company Using Binary Trees

Dec 5, 2013

My colleague and I have been given a task to create a list with the employes of a company using binary trees. Each employee/node has to contain the following information:

- Employe name
- Rank
- ID Number
- monthly Salary

We have to write a C program (using Codeblocks) which builds the company tree with the information above and afterwards lists all the employes who have a salary bigger then a number specified by the user.

So far so good. We've had a look on the examples on the internet and after finding one which looked friendly enough we started working on that one to suit our needs. Credits for the original source code to: C Program to Implement Binary Search Tree Traversal - Basic C Programs | C Programming Examples

We've reached the point where we're able to insert the required information but being able to list all the employes who's salary is bigger then the number given by the user seems to be rather difficult to achieve. I'll include the code next. We have left almost the entire pieces of the original code and we are aware that the are still things which are not required for our assignment, which only requires to enter the 4 information above and afterwards display the employes with the before mentioned condition concerning their salary.

Code:
# include <stdio.h>
# include <conio.h>
# include <stdlib.h>
typedef struct BST

[Code] .....

View 1 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++ :: 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++ :: Calculating Area And Perimeter

Sep 28, 2014

I am having trouble with my C++ program. My program asks the user to enter any number greater than 0 and less than 20, and if the user enters any number(s) outside the acceptable range, the output should display:

input outside of exceptable range > 0 and < 20
length: 1 width: 1 area: 1 perimeter: 1

But in my program, this output displays no matter what the user types (even if the numbers are in the acceptable range, when it should be displaying the length and width the user enters and also displaying the calculated perimeter and area whenever the user enters number(s) in the acceptable range. Here is my code:

#include <iostream>
using namespace std;

float class_rectangle_area();
float class_rectangle_perimeter();
float class_rectangle_length();
float class_rectangle_width();

[Code] .....

View 4 Replies View Related

C/C++ :: Area Of Triangle Calculator?

Nov 16, 2014

I was asked to build a small program to calculate the are of a Triangle but my code must have some problem.. />

#include "stdafx.h"
void main()
{
int a,b;

[Code]....

I get this errors:

-warning C4996: 'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS.

-warning C4244: '=' : conversion from 'int' to 'float', possible loss of data

View 4 Replies View Related

C/C++ :: Program That Uses The Radius To Get Area?

Apr 28, 2012

How can i come up with a program that uses entered radius of a circle to find its area

View 1 Replies View Related

C++ :: Area And Volume Of Cylinder?

Apr 27, 2013

I would like to calculate area and volume of cylinder but radious and height should be integer, float and double.

View 14 Replies View Related







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