Write a complete C++ program that helps a cerkat Muscat Post Office, to do the following tasks: 1 Record each mailing package's weight 2 Calculate and store each package's delivery cost 3 Calculate the average weight of all the packages. 4 Calculate the total cost of all packages greater than or equal to the cost of average weight Your program should include the following functions: 1 Function called packageRead is used to read the weight of the packages from a file named "weights txt" and store them into an array called Packages. It returns the number of package read from input file. The total number of packages cannot be more than 100. 2 Function cal_Costs is used to calculate the cost of each package 'and store it in another array called Cost based on the following rules. - If the weight is less than or equal to 1 KG, the cost is 3 OMR - If the weight is greater than 1 KG but less than or equal to 3

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Write a complete C++ program that helps a clerkat Muscat Post
Office, to do the following tasks:
Record each mailing package's weight
1-
Calculate and store each package's delivery cost
2-
3 Calculate the average weight of all the packages.
Calculate the total cost of all packages greater than or equal to
the cost of average weight.
4
Your program should include the following functions:
1 Function called packageRead is used to read the weight of the
packages from a file named “weights.txt" and store them into
an array called Packages. It returns the number of package
read from input file. The total number of packages cannot be
more than 10.
2 Function cal_Costs is used to calculate the cost of each
package 'and store it in another array called Cost based on the
following rules:
- If the weight is less than or equal to 1 KG, the cost is 3 OMR
- If the weight is greater than 1 KG but less than or equal to 3
KG, the cost is 2 S OMR for each KG.
* If the weight is greater than3 KG, the cost is 1.9OMR for
each KG
This function also outputs the cost of each package and total
Cost to the o
Transcribed Image Text:Write a complete C++ program that helps a clerkat Muscat Post Office, to do the following tasks: Record each mailing package's weight 1- Calculate and store each package's delivery cost 2- 3 Calculate the average weight of all the packages. Calculate the total cost of all packages greater than or equal to the cost of average weight. 4 Your program should include the following functions: 1 Function called packageRead is used to read the weight of the packages from a file named “weights.txt" and store them into an array called Packages. It returns the number of package read from input file. The total number of packages cannot be more than 10. 2 Function cal_Costs is used to calculate the cost of each package 'and store it in another array called Cost based on the following rules: - If the weight is less than or equal to 1 KG, the cost is 3 OMR - If the weight is greater than 1 KG but less than or equal to 3 KG, the cost is 2 S OMR for each KG. * If the weight is greater than3 KG, the cost is 1.9OMR for each KG This function also outputs the cost of each package and total Cost to the o
E learning services
SQU Libraries
SOU Portal Attendance English (en
3. Function Average is used to find the average weight of all
packages and output the value of the average weight to the output
file named "results.txt".
4. Function FindCost is used to output the total cost of all packages
greater or equal the cost of average weight in a file called
"results.txt".
Hint: Use the following function prototype.
int packageRead(double 1);
void cal_Costs(double], double), int),
double Average(double ], int);
void FindCost(double ), double 0, int);
Run sample is given in results.txt file as shown below.
results.txt
Package O costs:5 OMR.
Package I costs :7.5 OMR
Package 2 costs : 24.7 OMR.
Package 3 costs : 3 OMR.
Package 4 costs 9.5 OMR.
Package 5 costs 3,75 OMR.
Package 6 costs : 145.54 OMR.
Package 7 costs: 43.7 OMR
Total Costs: 242.69 OMR.
Average Weight: 15.6 OMR.
Total cost of all packages greater than or equal to the cost of average weight
15.6 Kg 189.24 OMR
weights.tst
3.
13
07
15
16.6
21
Paragraph
Transcribed Image Text:E learning services SQU Libraries SOU Portal Attendance English (en 3. Function Average is used to find the average weight of all packages and output the value of the average weight to the output file named "results.txt". 4. Function FindCost is used to output the total cost of all packages greater or equal the cost of average weight in a file called "results.txt". Hint: Use the following function prototype. int packageRead(double 1); void cal_Costs(double], double), int), double Average(double ], int); void FindCost(double ), double 0, int); Run sample is given in results.txt file as shown below. results.txt Package O costs:5 OMR. Package I costs :7.5 OMR Package 2 costs : 24.7 OMR. Package 3 costs : 3 OMR. Package 4 costs 9.5 OMR. Package 5 costs 3,75 OMR. Package 6 costs : 145.54 OMR. Package 7 costs: 43.7 OMR Total Costs: 242.69 OMR. Average Weight: 15.6 OMR. Total cost of all packages greater than or equal to the cost of average weight 15.6 Kg 189.24 OMR weights.tst 3. 13 07 15 16.6 21 Paragraph
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 6 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY