CIS170C-Week 3 Lab Instructions
Lab 3 of 7: Arrays
You will code, build, and execute a program that will use looping to determine the score for a diver based on individual judge’s scores.
1. Become familiar with the using an array.
2. Populate an array with data.
3. Be able to debug a program of syntax and logic errors.
4. Be able to use the debug step-into feature to step through the logic of the program and to see how the variables change values.
Section Deliverable Points
All Steps in Lab Step 6: Program Listing and Output 30
If you are using the Citrix remote lab, follow the login instructions located on the lab area in Course Home.
Locate the Visual Studio 2015 icon, and launch the application.
Step 1: Requirements—parallel arrays
You need to store sales for seven differnet types of salsa: mild, medium, hot, sweet, fruit, verde, and zesty. You will need two parallel seven element arrays. An array of strings to hold the salsa names and an array of integers holding the number of jars sold during the past month for each type of salsa. Create a string array, and initialize it with the salsa types. The program should prompt the user to enter the number of jars sold for each type. Use input validation with a loop to ensure that negavie values are not input.
Once the data is input, the program should display a report that shows sales for each salsa type, total sales (total number of jars sold), and the names of the highest and lowest selling products.
Lab hints: When writing this lab, you will need a for loop to enter in the sales numbers and a nested while loop within it to ensure the number entered is greater than 0. After reading in all the sales, you will need another loop that will calculate the total number of jars sold. It will also evaluate the low and high sales. You will need to code something like this to keep track of which index contains the high sales product: if (sales[i] > sales[hiSalesProduct]).
hiSalesProduct = i;
You also need to have your program process multiple divers. Put this in an outer loop. After you process the information for one diver, prompt the user if she/he wants to process another diver. Allow the user to type either a Y or y to enter another diver’s information; otherwise, exit the loop. Write an event summary by calculating and displaying the average score for all divers and the total number of divers participating.
Garbage in Garbage Out (GIGO): The data being entered by the user needs to be validated. Scores by judges may range between 0 and 10. If the user enters an invalid score, display an error message, and prompt for the score again. Keep doing this until the user enters the score correctly. The degree of difficulty may range from 1.00 to 1.67.
Sample output from program
Jars sold last month of mild: 11
Jars sold last month of medium: 22
Jars sold last month of hot: 33
Jars sold last month of sweet: 44
Jars sold last month of fruit: 55
Jars sold last month of verde: 66
Jars sold last month of zesty: 77
Salsa Sales Report
Name Jars Sold
Total Sales: 308
High Seller: zesty
Low Seller: mild
Press any key to continue.
Step 2: Processing Logic
Using the pseudocode below, write the code that will meet the requirements.
Write report heading
Initialize string array, highest seller index and lowest seller index
Input sales for salsa
Validate to be sure sales are above 0
Calculate total jars sold
Test for low and high sales products
Display the sales for each type of salsa.
Display the total sales, salsa with the highest sales, and the salsa with the lowest sales.
Step 3: Create a New Project
Create a new project and name it LAB3.
Write your code using the Processing Logic in Step 2. Make sure to save your program.
Step 4: Build Solution
To compile the program, click Debug then Build solution (F7). You should receive no error messages. If you see some error messages, check the code above to make sure you didn’t key in something wrong. Once you make your corrections to the code, go ahead and click Build >> Build Solution again.
Step 5: Execute the Program
Once you have no syntax errors, to execute or run your program, click Debug on the menu bar, and then click Start Debugging.
Step 6: Capture the Output
1. Capture a screen print of your output. (Do a PRINT SCREEN, and paste into an MS Word document.)
2. Copy your code and paste it into the same MS Word document that contains the screen print of your output.
3. Save the Word document as Lab03_LastName_FirstInitial.
END OF LAB
* You can also use 2CO option if you want to purchase through Credit Cards/Paypal but make sure you put the correct billing information otherwise you wont be able to receive any download link.
* Your paypal has to be pre-loaded in order to complete the purchase or otherwise please discuss it with us at firstname.lastname@example.org.
* As soon as the payment is received, download link of the solution will automatically be sent to the address used in selected payment method.
* Please check your junk mails as the download link email might go there and please be patient for the download link email. Sometimes, due to server congestion, you may receive download link with a delay.
* All the contents are compressed in one zip folder.
* In case if you get stuck at any point during the payment process, please immediately contact us at email@example.com and we will fix it with you.
* We try our best to reach back to you on immediate basis. However, please wait for atleast 8 hours for a response from our side. Afterall, we are humans.
* Comments/Feedbacks are truely welcomed and there might be some incentives for you for the next lab/quiz/assignment.
* In case of any query, please donot hesitate to contact us at firstname.lastname@example.org.
* MOST IMPORTANT Please use the tutorials as a guide and they need NOT to be used for any submission. Just take help from the material.
******************************************** Good Luck ***************************************************
Any personal information received will only be used to fill your order. We will not sell or redistribute your information to anyone.
We will try our best to resolve the issue and if still persists we can discuss for a refund in case its required.