Skip to main content

Posts

Showing posts with the label Arrays

DSDP Arrays Lab

Week 2 Lab Ex 1 In this lab we learn about Sorting an array, using ForEach loop, and Random class: Open Visual Studio 2012 Create a new project  by going to File --> New --> Project Select Visual C# --> Windows Desktop -->  Console Application In the Name field, type "W2Lab1-[Last_name]", where [Last_Name] is replaced with your last name. In the location field, give a directory location and click ok. Add code to declare and initialize an Int array that can hold 7 Integers. Using a For loop assign random numbers from the range 1 to 49 inclusive to the above array. Sort the array Using a ForEach loop display the seven numbers separated by tabs to console Week 2 Lab Ex 2  In this lab we learn about Linear Search and break: Add new console application project to the above solution Create an array which hold 20 random numbers in the range of 1 and 100. Using a For loop search for an integer given by user. Break out of the loop if the i...

W3 Lab Lottery

Write a console application that mimic popular lottery. Ensure that you choose the right data structure to complete this exercise. The application asks user how many QuickPick numbers she wants. Once the user enters an integer, application should generate specified number of QuickPick numbers. The each QuickPick will have 6 integers in the range of 1-49 inclusive sorted in the ascending order without any duplicates.. Once QuickPick numbers are generated they are sorted in the ascending order and displayed on console.  Then, Winning Number is generated. If the winning number is matches the User Number. The application should calculated the reward, if any, and display appropriate message on the Console screen.    The reward is based on the following  Number of Matches Win 6/6 80.5 % of the 30million 5/6 + Bonus 5.75 % of the 30million 5/6 4.75 % of the 30million 4/6 9 % of the 30million 3/6 $10 prize 2/6 + Bonus $5 prize...