Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The objective of this programming assignment is to practice using pointer syntax. You do not have to use functions for this assignment. Program Description: This

The objective of this programming assignment is to practice using pointer syntax.
You do not have to use functions for this assignment.
Program Description:
This is Program Assignment 2 for COSC 1560 and is named Deliveries.cpp. You
must use this name. If you want to append your name to it, that is fine. For this
program assume you opened up a package delivery service to supplement the
package deliveries done by the USPS (Unite States Postal Service). You do this
work under contract with the USPS. This program collects information on the
deliveries your company, Webster Delivery Service (WDS), makes and determines
some related statistics such as the total number of packages delivered, the
average number of packages delivered, the days on which the minimum and the
maximum packages were delivered and the number of those packages delivered.
In this program you are trying to calculate statistics related to WDS previously
mentioned for the 7 days of a week.
Please use the following variables in the main function.
const int SIZE =7;
int deliveries[SIZE];
int * ptr = deliveries;
1. Use a loop to access the array. You are required to use the pointer ptr as
pointer syntax to manipulate the array (not deliveries[i]).
2. You are also required to use at least 2 different ways of pointer
manipulations to the array.
3. Your program should ask the user to enter all data, calculate and display
the total, the average, the smallest number of deliveries and the largest
number of deliveries. Display all values with the same format as sample
output.
Other Specifications:
1. Use fixed << setprecision(2) to display two decimal values for the average
2. The number of deliveries should be between 0 and 300(inclusive, both 0
and 300 are acceptable) since that is what the contract with the USPS
allows.
3. Follow program style guidelines very carefully.
a. Points will be taken off for all violations, especially the following
(these pertain to all future programs as well):
i. Missing the comment block in every program file.
ii. Not checking for a valid file open when files are utilized.
iii. When functions are used, not placing function definitions after
the main function, and then using function prototypes to
declare the functions.
b. Listed below are some common mistakes, please verify.
i. There should be no global constant variables at all.
ii. Store all values as variables, do not hardcode any values, use
named constants instead. For example
1. const int MIN =0;
2. const int MAX =300;
iii. Use a line separator to separate blocks of programs.
(//****80stars******), line separator comes with a blank line
before and after.
1. Use it between each function definition.
2. Separate function prototypes and main function
definitions
3. Between using namespace std; and function
prototypes/main
4. All assignments must be submitted and run as specified to pass the course
(see syllabus)
5. Your output format must match with my output format, including the blank
lines.
6. Submit your assignment (.cpp only) via Canvas before the due date.
7. See an example of the output below.
Sample Output:
This is programming assignment 2 for COSC 1560- OA(Deliveries.cpp)
Webster Delivery Service Week Report
Please enter the number of deliveries on each day
Day 1: 500
Invalid value, please re-enter: 400
Invalid value, please re-enter: 299
Please enter the number of deliveries on each day
Day 2: 184
Please enter the number of deliveries on each day
Day 3: 228
Please enter the number of deliveries on each day
Day 4: 256
Please enter the number of deliveries on each day
Day 5: 281
Please enter the number of deliveries on each day
Day 6: 167
Please enter the number of deliveries on each day
Day 7: 42
The numbers of packages delivered were:
29918422825628116742
The total number of packages delivered was 1457 deliveries
The average daily number of packages was 208.14 deliveries
The minimum delivery was on day 7 and was 42 deliveries
The maximum delivery was on day 1 and was 299 deliveries
C:\Users\carol\Desktop\Stan's Stuff\___COSC1560-OA-Programming II - Spring
2024\__Program Assignments\Program Assignment
2\ProgramAssignment2\Debug\Assignment 1.exe (process 12616) exited with
code 0.
Press any key to close this window ...

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Multidimensional Array Data Management In Databases

Authors: Florin Rusu

1st Edition

1638281483, 978-1638281481

More Books

Students also viewed these Databases questions

Question

what are the major lloT communication methods?

Answered: 1 week ago

Question

6. Conclude with the same strength as in the introduction

Answered: 1 week ago

Question

7. Prepare an effective outline

Answered: 1 week ago