So I have an assignment, I want to believe that the pieces are there, but I'm failing to connect some dots. What exactly am I doing wrong here? I'm newish to C++ so I might not follow along the first time around, for that I apologize. Anyhow, the assignment that I am working is to Create a class called Postage. Provide a function called setWeight to set the weight of a package in pounds. Packages cannot weigh more than 70 pounds. The sendEconomy function returns a price based on the formula: $2.00 plus 40 cents per pound. The sendPriorty function returns a price of $5.00 plus 50 cents per pound. The sendOvernight function returns a price of $18.00 plus $2.00 per pound.
Using the class from the prior question, write a main function that asks for the weight of a package and prints out the postal charges (Economy, Priority, and Overnight).
this is my header file:
#pragma once
#include <iostream>
#include <iomanip>
using namespace std;
do {
cout << "how much does your package weigh?" << endl << "Please enter the weight here: " << endl;
cin >> weight;
if (weight <= 70) {
cout << "you have entered " << weight << endl;
}
else if (weight >= 71 || weight <= 0) {
cout << "We do not ship items that are over 70 pounds. What do you think we are amazon? Try again: ";
cin >> weight;
}
} while (weight >= 70 || weight <= 0);
return weight;
}
/*
Create a class called Postage. Provide a function called setWeight to set the weight of a package in pounds. Packages cannot weigh more than 70 pounds. The sendEconomy function returns a price based on the formula: $2.00 plus 40 cents per pound. The sendPriorty function returns a price of $5.00 plus 50 cents per pound. The sendOvernight function returns a price of $18.00 plus $2.00 per pound.
Using the class from the prior question, write a main function that asks for the weight of a package and prints out the postal charges (Economy, Priority, and Overnight).
*/
#include <iostream>
#include <iomanip>
#include "Source.h"
using namespace std;
int main() {
int input;
int weight = 0;
cout << "How fast would you like to ship it?" << endl;
cout << "choose 1 to ship standard shipping" << endl;
cout << "choose 2 to ship priority shipping" << endl;
cout << "choose 3 to ship overnight shipping" << endl;
cout << "Please choose a shipping option: " << endl;
cin >> input;
switch (input) {
case 1:
int setWeight();
void initiailize();
void standard();
void printInfo();
void printMessage(void);
system("pause");
break;
case 2:
void initialize();
void priority();
void printInfo();
void printmessage();
system("pause");
break;
case 3:
void initialize();
void overnight();
void printInfo();
void printMessage();
system("pause");
break;
default:
cout << "You choose something I don't understand. We don't tolerate your wasting of time. Go away! " << endl;
break;
}
system("pause");
return 0;
}
When I execute it goes through the switch, hits the system("pause") twice then exits. I'm fairly certain that I am not getting into the function calls and I assume that is because I don't have them set up correctly. Anything helps, I don't need anyone to do the assignment for me, just need some advice on what it is I am missing. Thank you in advance. Also if the question posts in a strange or unorthodox way I also apologize.
case 1:
int setWeight();
void initiailize();
void standard();
void printInfo();
Do you realize that these are function prototypes, not function calls? And note that you have not implemented these functions (they are not your class member functions).