Reference no: EM132218876
Programming Assignment 1
This assignment will require the use of three arrays, which will be used in parallel. Create a program that keeps track of the sales of BBQ sauces for a company. The company makes several different types of sauces, Original, Sticky Sweet, Spicy, Sweet Heat, Hickory Bourbon and Smokey Mesquite.
One array will contain the names of the different BBQ sauces. This array will be initialized from a text file with the 6 different names. A second array will be used for the price of each bottle of BBQ sauce; this will also be initialized from a file. The two files can be different files.
The third array will be used to store the amount sold of each type of sauce. The program will then prompt the user for how many of each sauce has been sold. Once all the data is entered a report is created that displays each of the sauce types with the total amount sold and the total sales for each of the sauces. This output should be in a table format.
The program will also calculate the overall total of sales for all of the sauces. It will then determine which sauce was the highest selling and the lowest selling product.
Validations:
1. The files can be opened
2. No negative values for the amount of sales for each sauce. This should be a loop asking for the input again.
Requirements:
1. When prompting for the amount sold of a sauce, the name of the sauce must be used in the prompt.
2. Table output should have evenly spaced columns.
3. Where there is currency being displayed, it must be formatted with 2 decimal places and a $.
4. Method to display the table of output.
5. Method to calculate the total of overall sales, returns the amount.
6. Method to get the inputs from the user for the amount sold of each sauce.
7. Method to determine which is the highest and lowest product sold.
Programming Assignment 2
This assignment will require you to write a program that will keep track of a test score for each (4) student. This program will make use of two arrays. The two arrays are:
Array of strings with the students names
Array of doubles with the students test score
Note that the student name at index 0 of the first array will have the test score at index 0 of the second array.
Both arrays must be dynamically allocated using a pointer. The size of the arrays are based on the user's input, so the program must ask for how many students. The program must obtain the name of the student and that student's test score from the user. Once all the data is entered, the data will be sorted by scores in ascending order. Both arrays must be sorted so that the student still has the same test score.
So, both are sorted at the same time. The program will also display the sorted array along with the test score average. All methods/functions will use pointers as parameters and use only pointer notation and pointer arithmetic, not array notation.
Required Method/Functions:
void GetGrades(double* scores, string* students, int size);
void DisplayGrades(double* scores, string* students, int size, double avg);
void Sort(double* scores, string* students, int size);
double Average(double* scores, int size);
Validation requirements:
1. Do not accept a negative number of students to be entered (used for the size of the arrays).
2. Do not accept a negative test score.
a. If invalid prompt the user for a new test score until they enter a valid test score; use a loop.
Output should appear as:
Student Score
Richard 67.40
Mark 67.83
Jane 72.65
Sandy 95.32
Class average is: 75.80
Programming Assignment 3
This assignment will require you to write a program that will create an array of 10 string objects. The array will be initialized with the strings which contain the person's name and phone number in one string. The following is an example of test data:
"Renee Javens, 678-1223",
"Joe Looney, 586-0097",
"Geri Palmer, 223-8787",
"Lynn Presnell, 887-1212",
"Bill Wolfe, 223-8878",
"Sam Wiggins, 486-0998",
"Bob Kain, 586-8712",
"Tim Haynes, 586-7676",
"John Johnson, 223-9037",
"Jean James, 678-4939",
"Ron Palmer, 486-2783"
The program will prompt the user for the name or part of a name to search for. For example, the user may type in "Joe", and the program should then display "Joe Looney, 586-0097."
If the user enters "Pal" then the program should have two outputs from the above list. The program should make use of the string object methods to find the matches. The array should be created in main and use a method to search the array to find the name(s) in the array. If a match is not found then it should display a message indicating there is no match. The method must be passed the array of data.