I'm getting an Error: LNK1561: entry point must be defined. Can someone edit it with using the basic iostream and string libraries, only basic lib.
In a population, the birth rate and death rate are calculated as follows: Birth Rate = Number of Births ÷ Population Death Rate = Number of Deaths ÷ Population For example, in a population of 100,000 that has 8,000 births and 6,000 deaths per year, Birth Rate = 8,000 ÷ 100,000 = 0.08 Death Rate = 6,000 ÷ 100,000 = 0.06 Design a Population class that stores a current population, annual number of births, and annual number of deaths for some geographic area. The class should allow these three values to be set in either of two ways: by passing arguments to a three-parameter constructor when a new Population object is created or by calling the setPopulation, setBirths, and setDeaths class member functions. The class should also have getBirthRate and getDeathRate functions that compute and return the birth and death rates. Write a short program that uses the Population class and illustrates its capabilities. Input Validation: If a population figure less than 2 is passed to the class, use a default value of 2. If a birth or death figure less than 0 is passed in, use a default value of 0
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
class Population {
private:
int curPopulation;
int annualBirths;
int annualDeaths;
public:
Population();
Population(int p, int b, int d);
void setPopulation(int pop);
void setBirths(int births);
void setDeaths(int deaths);
double getBirthRate();
double getDeathRate();
};
Population::Population()
{
};
Population::Population(int a, int b, int c)
{
if (a>=2)
{
}
else
p=2;
//cout<<curPopulation<<endl;
if(b<0)
{
annualBirths=0;
}
else
annualBirths = b;
//cout<<numBirths<<endl;
if(c<0)
{
annualDeaths=0;
}
else
annualDeaths = c;
//cout<<numDeaths<<endl;
};
Population::setPopulation(int p)
{
if(p >= 2)
{
curPopulation = p;
}
else
p=2;
}
Population::setBirths(int b)
{
if(b<0)
{
annualBirths=0;
}
else
annualBirths = b;
}
Population::setDeaths(int d)
{
if(d<0)
{
annualDeaths=0;
}
else
annualDeaths = d;
}
Population::getBirthRate()
{
double c = curPopulation;
double b = annualBirths;
double br = 0;
br = b/c;
cout << "The Birth rate is:" << br << endl;
return br;
}
Population::getDeathRate()
{
double c = curPopulation;
double d = annualDeaths;
double dr = 0;
dr = d/c;
//dr = (numDeaths/ curPopulation);
cout << "The Death rate is:" << dr << endl;
return dr;
}
int main(){
double d=0;
Population p1 = Population(100000, 8000,6000);
d =p1.getBirthRate();
d = p1.getDeathRate();
cout << endl;
Population p2 = Population();
int temp;
cout<<"Enter the poulation: ";
cin >> temp;
p2.setPopulation(temp);
cout << "Enter the number of Births: ";
cin >> temp;
p2.setBirths(temp);
cout << "Enter the number of Deaths: ";
cin >> temp;
p2.setDeaths(temp);
cout << endl;
p2.getBirthRate();
p2.getDeathRate();
cout << endl;
return 0;
};
We need at least 10 more requests to produce the answer.
0 / 10 have requested this problem solution
The more requests, the faster the answer.
I'm getting an Error: LNK1561: entry point must be defined. Can someone edit it with using...
Am I getting this error because i declared 'n' as an int, and then asking it to make it a double? This is the coude: #include "stdafx.h" #include <iostream> #include <fstream> #include <string> #include <algorithm> #include <vector> using namespace std; void sort(double grades[], int size); char calGrade(double); int main() { int n; double avg, sum = 0;; string in_file, out_file; cout << "Please enter the name of the input file: "; cin >> in_file; ...
When running the program at the destructor an exception is being thrown. Can someone help me out? vararray.h: #ifndef VARARRAY_H_ #define VARARRAY_H_ class varArray { public: varArray(); // void constructor int arraySize() const { return size; } // returns the size of the array int check(double number); // returns index of element containg "number" or -1 if none void addNumber(double); // adds number to the array void removeNumber(double); // deletes the number from the array ...
EXPLAIN HOW THIS PROGRAM WORKS, USING DEV C++ #include <iostream> #include <cmath> #define PI 3.1415926535897 using namespace std; typedef struct ComplexRectStruct { double real; double imaginary; } ComplexRect; typedef struct ComplexPolarStruct { double magnitude; double angle; } ComplexPolar; double radToDegree (double rad) { return (180.00 * rad) / PI; } double degToRadian (double deg) { return (deg * PI) / 180; } ComplexPolar toPolar (ComplexRect r) { ComplexPolar p; p.magnitude = round(sqrt(pow(r.real,...
please help me fix the error in here #include<iostream> #include <string> using namespace std; string getStudentName(); double getNumberExams(); double getScoresAndCalculateTotal(double E); double calculateAverage(double n, double t); char determineLetterGrade(); void displayAverageGrade(); int main() { string StudentName; double NumberExam, Average, ScoresAndCalculateTotal; char LetterGrade; StudentName = getStudentName(); NumberExam = getNumberExams(); ScoresAndCalculateTotal= getScoresAndCalculateTotal(NumberExam); Average = calculateAverage(NumberExam, ScoresAndCalculateTotal); return 0; } string getStudentName() { string StudentName; cout << "\n\nEnter Student Name:"; getline(cin, StudentName); return StudentName; } double getNumberExams() { double NumberExam; cout << "\n\n Enter...
Need to implement Account.cpp and AccountManager.cpp code //Account.hpp #ifndef _ACCOUNT_HPP_ #define _ACCOUNT_HPP_ #include <string> using std::string; class Account { public: Account(); Account(string, double); void deposit(double); bool withdraw(double); string getName() const; double getBalance() const; private: string name; double balance; }; #endif ////////////////////////////////////////////// //AccountManager.hpp #ifndef _ACCOUNT_MANAGER_HPP_ #define _ACCOUNT_MANAGER_HPP_ #include "Account.hpp" #include <string> using std::string; class AccountManager { public: AccountManager(); AccountManager(const AccountManager&); //copy constructor void open(string); void close(string); void depositByName(string,double); bool withdrawByName(string,double); double getBalanceByName(string); Account getAccountByName(string); void openSuperVipAccount(Account&); void closeSuperVipAccount(); bool getBalanceOfSuperVipAccount(double&) const;...
81. The following function call doesn’t agree with its prototype: cout << BoxVolume( 10, 5 ); int BoxVolume(int length = {1}, int width = {1}, int height = {1}); T__ F__ 82. The following function is implemented to swap in memory the argument-values passed to it: void swap(int a, int b) { int temp; temp = a; a = b; b = temp; ...
Add and subtract polynomials using linked lists:
The output should look like the following:
The code for the header file, Polynomial.h, is given as
such:
***********HEADER*************
#include <iostream>
#include <cstdlib>
using namespace std;
class polyll { //this is class POLYLL, but all lower case
private:
struct polynode {
float coeff;
int exp;
polynode* link;
} * p;
public:
polyll();
void poly_append(float c, int e);
void display_poly();
void poly_add(polyll& l1, polyll& l2);
void poly_subtract(polyll& l1, polyll& l2);
~polyll();
};
polyll::polyll()
{...
I'm not getting out put what should I do
I have 3 text files which is in same folder with main
program.
I have attached program with it too.
please help me with this.
------------------------------------------------------------------------------------
This program will read a group of positive numbers from three
files ( not all necessarily the same size), and then calculate the
average and median values for each file. Each file should have at
least 10 scores. The program will then print all the...
Need help with my ksmall program. I get an error saying segmentation dump. Thanks #include<iostream> using namespace std; int ksmall(int*, int, int , int); void swap(int*, int*); int main() { int SIZE = 10; int target; int begining=0; int ending=SIZE-1; int *array1= new int[SIZE]; cout << "Enter 10 integers: " << endl; for (int i=0; i<SIZE; i++) { cin>>array1[i]; } cout << " What is the Kth smallest number...