Here is the link to the simple notepad files on Github https://github.com/spconger/SimpleNotepad
Tuesday, November 29, 2016
Monday, November 21, 2016
MySQL SQL Morning
Use Sakila; show tables; Select * from Customer; Select * from Actor; Select * from Film; Select * from film_actor; Create view artist_films As Select first_name, Last_name, title, release_year From actor inner join film_Actor on actor.Actor_Id = film_actor.actor_id inner join film on film.Film_id = film_actor.Film_id; Select * from artist_films where title = 'Academy Dinosaur'; Insert into Actor(first_name, last_name) values('Joe','Smith'), ('Mark', 'Jones'), ('Thomas', 'Tankengine'); Insert into film_actor(actor_id, film_id) values(201,1); Update actor Set Last_name = 'Smithers', first_name='Joseph' Where actor_id = 201; Start transaction; commit; Select * from Actor; Start Transaction; Update actor Set Last_name = 'Smithers', first_name='Joseph'; use sakila; select * from author;
Thursday, November 17, 2016
Class peer Excercise and Link to code for WPF form
The code for the Windows form is posted on Github at https://github.com/spconger/FirstWPFForm
Here is the code for the peer excercise:
Word
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ClassPeerExcercise { public class Word { public string Term { get; set; } public string Definition { get; set; } } }
TermDictionary
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ClassPeerExcercise { public class TermDictionary { private Listwords; public TermDictionary() { words = new List (); } public void AddWord(Word w) { words.Add(w); } public string GetDefinition(string wordTerm) { string def = null; foreach(Word w in words) { if(w.Term.Equals(wordTerm)) { def = w.Definition; break; } } return def; } } }
Program
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ClassPeerExcercise { class Program { TermDictionary td = new TermDictionary(); static void Main(string[] args) { Program p = new ClassPeerExcercise.Program(); Word w1 = new Word(); w1.Term = "shirt"; w1.Definition = "garmet with sleeves"; p.td.AddWord(w1); Word w2 = new Word(); w2.Term = "Book"; w2.Definition = "covers containing pages"; p.td.AddWord(w2); Word w3 = new Word(); w3.Term = "pencil"; w3.Definition = "writing utensil"; p.td.AddWord(w3); Console.WriteLine("Enter a word to get Definition"); string searchWord = Console.ReadLine(); string def = p.td.GetDefinition(searchWord); if(def != null) { Console.WriteLine(def); } else { Console.WriteLine("Not in dictionary"); } Console.WriteLine("Press any key to exit"); Console.ReadKey(); } } }
Tuesday, November 15, 2016
Classes one
I have put the files on Github
The first example is at a href="https://github.com/spconger/ITC110ClassExample1"
the second example is at https://github.com/spconger/ITC110ClassExample2
Monday, November 14, 2016
Requirements Discussion Python Club
Morning requirements
Data Requirements: Meetings Schedule: place, time, Date,speakers, subject, duration, Meeting minutes: participants (all the above), minutes, Topics to Follow up, results, Meetup: meetup place, time, Date, participants, speakers, subject, duration, contact, post date, member who posted Members: MemberId, name, email, member since, leadership role Posting: event Resources and Tutorials: member who posted, Post date, subject, URL, description, rating General Announcements: who posted, topic, Date Posted, Text Discussion Board: Topic, who posted, discussion, comments Login information-- Report inappropriate data--member reporting, post id, what is inappropriate, reviewed by, date, discussion Reporting Requirements Users: Officers, Members, public, Database Admin Views do you need--security Members, email list, List events, Upcoming events, history of events List of meetings with minutes List of Resources List of Analytics Advertizing Security Officers : what can they do Post meetings, Add members, Delete members, remove posts, post minutes, Post events, post resources, discussions Post meet ups, (Insert, update and delete in any table) Manage member interactions to keep them legal and civil View anything Roles members: Post events, discussion, announcements, add resources Edit their own posts, but no one elses view anything (question on member names and emails) member has option to make email public or not Members can report inappropriate content, only view own reports and discussion Non members View most things, not member emails, not reports on inappropriate material.
Afternoon list
Data Requirements: Meetings: time, location, subject, speaker, Date, RSVP, Description, email, Minutes: who attended, questions, Recap, comments,start and end time of meeting, Date time for post, Who posted it Members: names, emails, phone, Whether or not they is an officer, Category, date added Discussion or blog: date, time, topic, Text of blog, member who posted, comments, title, Public comment --registration Events, Presentations: time, Date, location, (city state zip), speaker, contact about, what member posted, topic, Description, fee, age restriction, sponsor. signup sheet Announcements: date time topic member who posted, content, appropriate: flag announcements, events, member who objects and reason for objecting which announcement or event or other. Resources name, url, date and time posted, Who posted it, comments, who posted it, rating List of persons who express interest in the club ( Stake holders: Members Officers Web site developers-- Public Database Admin Reporting Requirements Track members Calendar of events See who joined recently See meetings and minutes List of resources sorted by rating Contacts report Security Officers What permissions should they have (roles) Add remove members, Add remove most anything, change updating most everything, (probably through stored procedures) Select anything and veiw anything. members: add resources, add blog entries, discussions, events, Update what they post, but nothing else. Remove, but store Public view most things, view member (no, flag it yes or no)
Tuesday, November 8, 2016
Corrected code for troubleshooting
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace TroubleShootingExample { class Program { /******************************* This program creates an array Populates it with random numbers outputs the contents of the array and then returns the average, the minimum and the maximum values in the array. Several errors have been built in. Steve Conger 11/5/2016 ********************************/ int size = 0; static void Main(string[] args) { Program p = new Program(); p.Display(); p.PauseIt(); } private int[] CreateArray() { Console.WriteLine("Enter the size of the Array"); size = int.Parse(Console.ReadLine()); int[] myRandomArray = new int[size]; return myRandomArray; } private int[] PopulateArray() { int[] myArray = CreateArray(); Random rand = new Random(); for (int i = 0; i < myArray.Length; i++) { int number = rand.Next(1, 1001); myArray[i] = number; } return myArray; } private void DisplayArrayValues(int[] rArray) { foreach (int i in rArray) { Console.WriteLine(i); } } private int CalculateAverage(int[] rArray) { int total = 0; for (int i = 0; i < rArray.Length; i++) { total += rArray[i]; } int average = total / size; return average; } private int CalculateMaximum(int[] rArray) { int max = 0; foreach (int i in rArray) { if (max < i) max = i; } return max; } private int CalculateMinimum(int[] rArray) { int min = rArray[0]; foreach (int i in rArray) { if (min > i) min = i; } return min; } private void Display() { int[] newArray = PopulateArray(); DisplayArrayValues(newArray); Console.WriteLine(); Console.WriteLine("The Average array value is {0}", CalculateAverage(newArray)); Console.WriteLine("The maximum value is {0}", CalculateMaximum(newArray)); Console.WriteLine("The minimum value is {0}", CalculateMinimum(newArray)); } private void PauseIt() { Console.WriteLine("Press any key to exit"); Console.ReadKey(); } } }
Wednesday, November 2, 2016
SQL Afternoon
Select * from Person; Select PersonLastName, PersonFirstName, PersonEmail From Person; Select PersonLastName, PersonFirstName, PersonEmail From Person order by PersonLastName; Select PersonLastName, PersonFirstName, PersonEmail From Person order by PersonLastName Desc, PersonFirstName; Select PersonLastName, PersonFirstName, PersonEmail From Person Where PersonLastName='Lewis' Select * from Product Where ProductPrice > 3 Select * from Product Where ProductPrice between 3 and 5 Select * from Product Where ProductPrice >=3 and ProductPrice <=5 Order by ProductPrice desc Select * From Sale Where SaleDate>'11/2/2016'and saleDate < '11/3/2016' Select Month(SaleDate) as [Month], Year(SaleDate) as [Year] from Sale Select Sale.SaleKey, SaleDate, PersonLastName, EmployeeKey, ProductName, SaleDetailPriceCharged,SaleDetailQuantity, SaleDetailDiscount,SaleDetailSaleTaxPercent, SaleDetailEatInTax From Sale inner join Person on Sale.CustomerKey=Person.Personkey inner Join SaleDetail on Sale.SaleKey=SaleDetail.SaleKey inner join Product on Product.ProductKey=SaleDetail.ProductKey Where Sale.SaleKey = 1 Insert into Sale(SaleDate, CustomerKey, EmployeeKey) Values(GetDate(),5,2) Insert into SaleDetail(SaleKey, ProductKey, SaleDetailPriceCharged, SaleDetailQuantity, SaleDetailDiscount, SaleDetailSaleTaxPercent, SaleDetailEatInTax) Values(Ident_Current('Sale'), 3, 3.25,1,0,.09,.02), (Ident_Current('Sale'), 5, 2.25,1,0,.09,.02) Select * from SaleDetail Select * from Person Begin tran Update Person Set PersonLastName='Smith' Where PersonKey=3 Rollback tran Commit tran
Tuesday, November 1, 2016
Methods
The first examples
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MethodsExample { class Program { //int number; this would make available everwhere //in the class static void Main(string[] args) { Program p = new Program(); p.GetNumber(); p.Pause(); } private void GetNumber() { Console.WriteLine("Enter a number"); int number = int.Parse(Console.ReadLine()); Display(number); } private void Display(int numb) { int result = Cube(numb); Console.WriteLine("The cube of {0} is {1}", numb, result); } private int Cube(int num) { int cube = num * num * num; return cube; } private void Pause() { Console.WriteLine("Press any key to exit"); Console.ReadKey(); } } }
the tip program
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace TipMethodExample { class Program { //Determine the amount of the meal //Determine the percent of tip //Calculate tax amount //Calcualte tip amount //Display results (amount, tax, tip, total); //assign constant values private const double TAXPERCENT = .092; private const double PERCENTDIVISOR = 100; static void Main(string[] args) { //instantiate the class Program Program p = new Program(); //call the calculate method //which calls GetMealAmount and GetTipPercent p.Calculate(); //call the pause method p.Pause(); } private double GetMealAmount() { //this gets the meal amount and returns it to //the calling method Console.WriteLine("Enter the Meal Amount"); double amount = double.Parse(Console.ReadLine()); return amount;//the return must return the type //given in the method signature (double) //and must be the last statement in the method } private double GetTipPercent() { //this gets the tip percent and returns //it to the calling method Console.WriteLine("Enter the Tip Percent as a Whole number"); double tipPercent = double.Parse(Console.ReadLine()); return tipPercent; } private void Calculate() { //call get meal amount and assign returned value //to mealAmount //same for tipPerce double mealAmount = GetMealAmount(); double tipPerc = GetTipPercent(); double taxAmount = mealAmount * TAXPERCENT; double tipAmount = mealAmount * (tipPerc/ PERCENTDIVISOR); double total = mealAmount + taxAmount + tipAmount; //pass calculate values to Display method Display(mealAmount, taxAmount, tipAmount, total); } private void Display(double meal, double tax, double tip, double total) { Console.WriteLine("Meal:\t\t{0:C}", meal); Console.WriteLine("Tax:\t\t{0:C}", tax); Console.WriteLine("Tip:\t\t{0:C}", tip); Console.WriteLine("Total:\t\t{0:C}", total); } private void Pause() { Console.WriteLine("Press any key to exit"); Console.ReadKey(); } } }
here is the peer excercise--though without comments for now
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace PeerExcerciseMethods1 { class Program { //get a number //test the number //do the calculation //display the results static void Main(string[] args) { Program p = new Program(); int number=p.TestNumber(); p.Display(number); p.Pause(); } private int GetNumber() { Console.WriteLine("Enter an integer between 1 and 40"); int number=0; bool good = false; //this checks to make sure it is a valid while (!good) { good = int.TryParse(Console.ReadLine(), out number); if (!good) Console.WriteLine("Enter a valid integer"); } return number; } private int TestNumber() { int num = GetNumber(); //the while instead of an if //loops until they get it right while (num < 0 || num > 40) { num = GetNumber(); } return num; } private int GetPrime(int number) { return number * number - number + 41; } private void Display(int number) { Console.WriteLine("Your prime number is {0}", GetPrime(number)); } private void Pause() { Console.WriteLine("Press any key to exit"); Console.ReadKey(); } } }
Subscribe to:
Posts (Atom)