Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in c + + Programming Assignment 3 Deliveries 2 . cpp Program Description: The objective of this programming assignment is to practice using pointer syntax.

in c++
Programming Assignment 3
Deliveries2.cpp
Program Description:
The objective of this programming assignment is to practice using pointer syntax.
This assignment is very similar to assignment 2, but in this assignment you are
required to use functions.
This is Program Assignment 3 for COSC 1560 and is named Deliveries2.cpp. Please
use this name. You may append your name to it if desired. This program collects
information on deliveries by Webster Delivery Service (WDS) and determines
some related statistics such as the total number of packages delivered, the
average number of packages delivered, the minimum and the maximum delivery
days and the number of packages delivered for those days.
You are trying to calculate statistics related to the packages delivered previously
mentioned for 7 days of deliveries, and this program will provide that
information.
Again 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 pointer syntax in all manipulations of the
array i.e., not deliveries[i].
3. Your program should ask user to enter all data, calculate and display an
average, display all values with the same format as sample output and
sort all values from smallest to biggest using bubble sort (all
functionalities must be implemented with pointer syntax onlyi.e., not
deliveries [i]). Note you may want to use a swap function in the bubble
sort function. Use the sorted data to determine the minimum and
maximum delivery values.
4. The following functions are needed:
Use the function headers provided below, you may not change the
function headers.
Function header Explanation
void getAllData(int *
pArray, int size)
This function should ask the user to
enter all values into the array using
pArray as manipulator.
All values are between 0 and 300,
both 0 and 300 are acceptable.
double getAverage(const int
* pArray, int size)
This function should calculate and
return the average of all values to the
array using pArray as manipulator.
*No display messages.
void displayAllValue(const
int * pArray, int SIZE)
This function should display all
values of the array using pArray as
manipulator.
Display all values entered with same
output format as shown in the
sample output. I used left justified
setw(5) for display and 2 values after
decimal point for all floating point
values.
void bubbleSort(int * const
pArray, const int SIZE)
This function should sort the array
using bubble sort. Sort all values
from smallest to largest.
Notice the pointer is a constant
pointer. Do not use any display
messages in this function.
Other Specifications:
1. Use fixed << setprecision(2) to display two decimal values for the average
2. Bushels should be between 0 and 300(inclusive, both 0 and 300 are
acceptable)
3. Follow program style guidelines very carefully.
a. Points will be taken off for all violations.
b. Listed below are some common mistakes, please verify.
i. There should be no global constant variables at all.
ii. All functions must have prototypes.
iii. 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;
iv. 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 and 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) on Canvas before the due date.
7. See an example of the output below.
Sample Output:
This is programming assignment 3 for COSC 1560- OA(Deliveries2.cpp)
Webster Delivery Service Week Report
Please enter the number of deliveries on each day
Day 1: 500
Invalid value, please re-enter: -100
Invalid value, please re-enter: 100
Please enter the number of deliveries on each day
Day 2: 234
Please enter the number of deliveries on each day
Day 3: 256
Please enter the number of deliveries on each day
Day 4: 100
Please enter the number of deliveries on each day
Day 5: 274
Please enter the number of deliveries on each day
Day 6: 199
Please enter the number of deliveries on each day
Day 7: 66
The numbers of packages delivered were:
10023425610027419966
The total number of packages delivered was 1229 deliveries
The average daily number of packages was 175.57 deliveries
The sorted deliveries are:
66100100199234256274
The total number of packages delivered was 1229 deliveries
The minimum deliver

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

Step: 3

blur-text-image

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

More Books

Students also viewed these Databases questions

Question

2. What is the impact of information systems on organizations?

Answered: 1 week ago

Question

Evaluate the impact of technology on HR employee services.

Answered: 1 week ago