代写 statistic CMPSC121: Intro to Programming Techniques (Fall 2018)

CMPSC121: Intro to Programming Techniques (Fall 2018)
Homework 07 (20 points)
Due Sunday, October 7 at 11:59pm
Objectives
After this homework assignment, students should be able to:
• Declare, assign values to, and access values in arrays
• Declare, assign values to, and access values in vectors and use vector member functions Instructions
Task 1
Write a program named sales.cpp that:
• Prompts the user to enter floating point numbers that represent daily sale amounts at a store o Allows the user to indicate the end of user inputs with -1
o Validates the user input for numbers greater than 0
o Stores the numbers in an array
• Determines and displays the maximum, minimum, and arithmetic mean (average) of the sale amounts Task 2
Write a program named roster.cpp that:
• Prompts the user to enter the first names of 5 students: o Stores the names in an array of strings
• Determines and displays any duplicate names
Task 3
Write a program named stats.cpp that:
• Prompts the user to enter 7 integers:
o Validates the user input for values between 1 and 10 (inclusive) o Stores the numbers in an array
• Determines and displays the maximum, minimum, and arithmetic mean (average) of the integers Optional Bonus (+3 points)
Write a program named morestats.cpp that extends the functionality of stats.cpp by:
• Calculating the median and mode of the 7 integers

Sample Output
Task 1 Sample Output
Enter the sale amount: $2.00
Enter the sale amount: $-5.00
INVALID AMOUNT, TRY AGAIN!
Enter the sale amount: $1.00
Enter the sale amount: $3.00
Enter the sale amount: $4.00
Enter the sale amount: $5.00
Enter the sale amount: $-1
RESULTS:
Average sale amount: $3.00
Lowest sale amount: $1.00
Highest sale amount: $5.00
Thank you!
Task 2 Sample Output
Task 3 Sample Output
Optional Bonus Sample Output
Submission
Submit the following file(s) to Canvas before the deadline:
1. sales.cpp
2. roster.cpp
3. stats.cpp
4. (optional bonus) morestats.cpp
Please enter a name: John
Please enter a name: Joe
Please enter a name: James
Please enter a name: Jane
Please enter a name: John
John is a duplicate name!
Enter seven integers: 8 3 4 4 2 4 5
Array Statistics:
The minimum is: 2
The maximum is: 8
The average is: 4.28571
Enter seven integers: 8 3 4 4 2 4 5
Array Statistics:
The minimum is: 2
The maximum is: 8
The average is: 4.28571
The mode is: 4
The median is: 4