Define a class called Bookorder
Instance variable :
String title: To store title of the book
double weight : To store weight of the book
double cost : To store cost one book
double totalbooks : To store total numbered of books order
Methods()
Bookorder() : Default constructor to initialize data members to default values void input() : To input all related values
void calculate() : Find total weight and total cost
total weight ; total books * weight;
total cost = total books * weight;
total cost = total books * cost;
Write main method and call all above member method.
Spammers will be reported.
Answers
Answered by
1
#include <iostream>
using namespace std;
class Bookorder {
private:
string title; double weight; double cost; double totalbooks;
public:
Bookorder() {
//
}
void input() {
cin >> title >> weight >> cost >> totalbooks;
}
void calculate() {
cout << totalbooks*weight << endl;
cout << totalbooks*cost;
}
};
int main() {
Bookorder obj;
obj.input();
obj.calculate();
}
Answered by
5
Answer:
........,........,......
Similar questions
Science,
2 months ago
Math,
2 months ago
Science,
2 months ago
English,
5 months ago
Political Science,
5 months ago
Math,
10 months ago
English,
10 months ago
Political Science,
10 months ago