CSE3002 Announcements CSE 3002 Prof. Steven A. Demurjian Computer Science & Engineering Department The University of Connecticut 371 Fairfield Way, Box U-255 Storrs, CT 06269-3255 [email protected] http://www.engr.uconn.edu/~steve (860) 486–4818 (Office) (860) 486-3719 (CSE Office) OV-1.1 Upcoming Schedule and Due Dates CSE 3002 PLA6 Golang Assignment – Monday April 24, 11:59pm Among PLA1, PLA2, PLA3, PLA5, PLA6, take four highest Presentations Thursday, April 13 – Groups A and B Tuesday, April 19 – Groups C and D Thursday, April 20 – Groups E and F Tuesday, April 25 - Groups G and H Final Project Submittal: Friday April 28 at midnight at 11:59pm: OV-1.2 Grading Guesstimates – 30%PLA/20%Movie PLA1 PLA2 PLA4 PLA4 30pts 30pts 30pts 10pts PLA TTL 30 28 30 10 98 CSE 3002 PLA HoC TTL Movie 98 100 30% Guess 20% 30/20 98.8 A 30 27 28 30 30 30 10 10 98 97 98 97 100 100 98.8 98.2 A A 30 30 27 30 30 30 30 27 30 27 30 30 30 30 28 30 23 23 28 28 30 28 28 18 30 30 30 27 30 25 27 23 27 24 24 24 10 10 10 7 10 10 0 7 7 7 0 7 100 100 95 94 93 88 85 85 94 86 82 79 100 100 95 94 93 88 85 85 94 86 82 79 95 95 100 100 100 100 100 100 85 95 100 100 98 98 97 96.4 95.8 92.8 91 91 90.4 89.6 89.2 87.4 A A A A A A AAAAAA- 30 27 24 24 30 30 27 30 21 24 24 15 15 28 20 18 28 18 15 25 20 18 18 23 10 15 20 27 30 20 20 22 10 15 27 15 5 15 5 10 7 0 0 7 10 5 5 0 5 5 5 0 88 81 72 72 75 77 67 70 66 62 57 45 35 88 81 72 72 75 77 67 70 66 62 57 45 35 85 95 100 100 90 85 100 95 95 95 95 90 95 86.8 86.6 83.2 83.2 81 80.2 80.2 80 77.6 75.2 72.2 63 59 AAB+ B+ B+ B+ B+ B+ B B B BB- OV-1.3 Grading Guesstimates – 40%PLA/10%Movie CSE 3002 PLA1 PLA2 PLA4 PLA4 30pts 30pts 30pts 10pts PLA TTL 30 30 30 10 100 30 30 30 10 100 30 28 30 10 98 PLA HoC TTL Movie 100 95 100 95 98 100 40% Guess 10% 40/10 99 A 99 A 98.4 A 30 27 27 30 30 30 30 30 27 27 30 30 28 30 28 30 23 30 23 28 28 28 28 28 30 30 30 27 30 27 25 27 23 24 20 24 10 10 10 7 10 7 10 0 7 7 10 0 98 97 95 94 93 94 88 85 85 86 88 82 98 97 95 94 93 94 88 85 85 86 88 82 100 100 100 100 100 85 100 100 100 95 85 100 98.4 97.6 96 95.2 94.4 92.2 90.4 88 88 87.8 87.4 85.6 A A A A A AAAAAAB+ 27 30 30 30 24 24 30 27 21 24 24 15 15 20 18 15 18 18 28 20 25 18 18 23 10 15 27 24 22 20 30 20 15 10 27 15 5 15 5 7 7 10 7 0 0 5 5 0 5 5 5 0 81 79 77 75 72 72 70 67 66 62 57 45 35 81 79 77 75 72 72 70 67 66 62 57 45 35 95 100 85 90 100 100 95 100 95 95 95 90 95 83.8 83.2 78.6 78 77.6 77.6 75 73.6 71.8 68.6 64.6 54 47 B+ B+ B+ B+ B+ B+ B B B BBBC+ OV-1.4 Reminders CSE 3002 PLA4 Assignment Extend PLAv3 Due March 9, 11:59pm One-page list of issues/questions on your Topic Why exactly, did things in your topic unfolded as they did. What are the implications? How the history of computing unfold in your topic? What lessons we can draw or learn for the future in your topic? Due March 2, 11:59pm HoC Movie Assignment Due Date: March 22, 2017 11:59pm OV-1.5 CSE 3002 PL5 Logic Programming with Prolog Due Monday, April 3, 11:59pm. Relational database consisting of four tables of information on suppliers (S), parts (P), projects (J), project (SPJ) Supplier numbers (S#), part numbers (P#), and project numbers (J#), are unique in tables S, P, and J http://wiki.c2.com/?SupplierPartsProjectsDatabase Represent DB as Prolog Facts Define Relevant Prolog Rules Write Prolog Queries OV-1.6 Databases Tables CSE 3002 OV-1.7 Prolog Facts and Rules CSE 3002 supp(s1,'Smith',20,'London'). supp(s2,'Jones',10,'Paris'). supp(s3,'Blake',30,'Paris'). supp(s4,'Clark',20,'London'). supp(s5,'Adams',30,'Athens'). part(p1, 'Nut', 'Red', 12, part(p2, 'Bolt', 'Green', 17, part(p3, 'Screw', 'Blue', 17, part(p4, 'Screw', 'Red', 14, part(p5, 'Cam', 'Blue', 12, part(p6, 'Cog', 'Red', 19, proj(j1, 'Sorter', 'Paris'). proj(j2, 'Display', 'Rome'). proj(j3, 'OCR', 'Athens'). proj(j4, 'Console', 'Athens'). proj(j5, 'RAID', 'London'). proj(j6, 'EDS', 'Oslo'). proj(j7, 'Tape', 'London'). sppj(s1, p1, j1, 200). sppj(s1, p1, j4, 700). sppj(s2, p2, j1, 400). sppj(s2, p2, j2, 200). sppj(s2, p2, j3, 200). sppj(s2, p2, j4, 500). sppj(s2, p2, j5, 600). sppj(s2, p2, j6, 400). sppj(s2, p2, j7, 800). sppj(s2, p5, j2, 100). sppj(s3, p2, j1, 200). sppj(s3, p4, j2, 500). sppj(s4, p6, j3, 300). sppj(s4, p6, j7, 300). sppj(s5, p2, j2, 200). sppj(s5, p2, j4, 100). sppj(s5, p5, j5, 500). sppj(s5, p5, j7, 100). sppj(s5, p6, j2, 200). sppj(s5, p1, j4, 100). sppj(s5, p2, j4, 200). sppj(s5, p4, j4, 800). sppj(s5, p5, j4, 400). sppj(s5, p6, j4, 500). 'London'). 'Paris'). 'Oslo'). 'London'). 'Paris'). 'London'). supp(s# part(p# proj(j# sppj(s# sname status city) pname color weight jname city) p# j# qty) city) suppliesparts(S,P,N,T,C,J,A):-supp(S,N,T,C),sppj(S,P,J,A). usedbyproject(P,N,C,A,L,S,J,D):-part(P,N,C,A,L),sppj(S,P,J,D). usesparts(J,A,B,P,N,S,J,X,G,H):- proj(J,A,B), sppj(S,P,J,X), part(P,N,G,H). notinlocation(S,N,T,C,J,A,B):-supp(S,N,T,C),proj(J,A,B), not(C=B). OV-1.8 Prolog Queries CSE 3002 When given a pair of projects, find all suppliers who supply both projects. Return the entire entry (i.e., S#, Sname, Status, City) for the supplier. When given a city, find all parts supplied to any project in that city. Once again, return the entire entry for the part. Find all parts supplied to any project by a supplier in the same city. In this case, results are organized by all parts for every city in the database. Find all projects supplied by at least one supplier not in the same city. Find all suppliers that supply at least one part supplied by at least one supplier who supplies at least one red part. Find all pairs of city values such that a supplier in the first city supplies a project in the second city. Find all triples of city, part#, city, such that a supplier in the first city supplies the specified part to a project in the second city, and the two city values are different. When given a supplier, find all projects supplied entirely by that supplier. OV-1.9 CSE 3002 PL4 Word Index Using Strings in Ada Due March 9, 11:59pm Extend PLA3v3 with a word index that tracks the line(s) within the input file where each word occurs. There may be multiple occurrences of the word in a file. Current output of PLA3v3 is: Goodbye 4 Hello 1 World 1 You are to update the output to: Goodbye: in lines 1-2-5-6 wc=4 Hello: in lines 3 wc=1 World: in lines 3 wc=1 Assume: Each word must be at least one character and start with a letter. If a word has 2 or more characters, then the second and successive characters can be letters, digits, the underscore, or the hyphen OV-1.10 new_u_words_min.adb CSE 3002 -- Read one word per line and print list of unique words and their frequencies -- Case sensitive -- This is a minimalist version. No bells or whistles. with ada.integer_text_io; use ada.integer_text_io; with ada.text_io; use ada.text_io; procedure new_u_words_min is type Word is record s: String(1 .. 120); -- The string. Assume 120 characters or less wlen: Natural; -- Length of the word Count: Natural := 0; -- Total number of occurrences of this word LineNo: Natural :=0; -- Word found on LineNo end record; type Word_Array is array(1 .. 1000) of Word; type Word_List is record words: Word_Array; -- The unique words Num_Words: Natural := 0; -- How many unique words seen so far curr_line: Natural := 1; -- Current Line end record; OV-1.11 new_u_words_min.adb CSE 3002 procedure get_words(wl: out Word_List) is begin wl.num_words := 0; -- only to get rid of a warning while not End_of_File loop declare s: String := Get_Line; found: Boolean := false; begin for i in 1 .. wl.num_words loop if s = wl.words(i).s(1 .. wl.words(i).wlen) then wl.words(i).count := wl.words(i).count + 1; found := true; end if; exit when found; end loop; if not found then -- Add word to list wl.num_words := wl.num_words + 1; wl.words(wl.num_words).s(1 .. s'last) := s; wl.words(wl.num_words).wlen := s'length; Wl.Words(Wl.Num_Words).Count := 1; Wl.Words(Wl.Num_Words).LineNo:= wl.curr_line; -- set LineNo of word wl.curr_line := wl.curr_line + 1; -- one word per line so increase curr_line end if; end; -- declare end loop; end get_words; OV-1.12 new_u_words_min.adb CSE 3002 procedure put_words(wl: Word_List) is begin for i in 1 .. wl.num_words loop put(wl.words(i).LineNo); put(wl.words(i).count); put(" " & wl.words(i).s(1 .. wl.words(i).wlen)); new_line; end loop; end put_words; the_words: Word_List; begin get_words(the_words); put_words(the_words); end new_u_words_min; OV-1.13 Output of Revised Program CSE 3002 First number is last line it appeared Second number occurence OV-1.14 Suggested Solution Approach CSE 3002 Build an dedicated output string for the word, its occurrences in lines, and final word count. Programmatically, for the word “Goodbye” the string would be built in the following steps: Goodbye Goodbye Goodbye Goodbye Goodbye Goodbye -- Etc… in in in in in in lines: lines: lines: lines: lines: lines: -- create when the word is first found 1 -- append “ 1” when the word is first found 1-2 -- append “-2” when the word is found in line 2 1-2-5 -- append “-5” when the word is found in line 5 1-2-5-6 -- append “6” when the word is found in line 7 1-2-5-6-6 -- append “6” when the word is found again in line 7 Built as the words are recognized on each line After EOF reached for all words, you print out the new dedicated output string for the word and append “wc=” and then print out the word count 5 as an integer You can also convert the word count to string and append OV-1.15 CSE 3002 PL3 Software Evolution of an Ada Program Due February 23, 11:59pm Modify an existing word frequency function Ada program (u_words_min.adb) or (u_words_tight.adb) http://www.engr.uconn.edu/~steve/Cse3002/Commo nProbBackground.pdf This programming project is an exercise in learning a new language by having to modify and extend someone else’s code OV-1.16 Two Current Ada Programs CSE 3002 Assume a word of 20 characters as a string – in the posted web copies of the two files, this has been increased to 120 Assumes one word per line including spaces Generated Output as follows/Use CTRL-Z <CR> OV-1.17 Three Versions CSE 3002 V1 Change the original program to alphabetically sort the outputted list of words – first executable. V2 + V1 Change the logic so that the words within each line are identified – this would then result in a full word frequency functionality and if the sort has been implemented, it will now sort the entire list – second executable. V3+V1+V2 Change the program so that the data is read from input.txt and written to output.tex – third executable. OV-1.18 u_words_min.adb CSE 3002 -- Read one word per line and print list of unique words and their frequencies -- Case sensitive -- This is a minimalist version. No bells or whistles. with ada.integer_text_io; use ada.integer_text_io; with ada.text_io; use ada.text_io; procedure u_words_min is type Word is record s: String(1 .. 120); -- The string. Assume 120 characters or less wlen: Natural; -- Length of the word count: Natural := 0; -- Total number of occurrences of this word end record; type Word_Array is array(1 .. 1000) of Word; type Word_List is record words: Word_Array; -- The unique words num_words: Natural := 0; -- How many unique words seen so far end record; OV-1.19 u_words_min.adb CSE 3002 procedure get_words(wl: out Word_List) is begin wl.num_words := 0; -- only to get rid of a warning while not End_of_File loop declare s: String := Get_Line; found: Boolean := false; begin for i in 1 .. wl.num_words loop if s = wl.words(i).s(1 .. wl.words(i).wlen) then wl.words(i).count := wl.words(i).count + 1; found := true; end if; exit when found; end loop; if not found then -- Add word to list wl.num_words := wl.num_words + 1; wl.words(wl.num_words).s(1 .. s'last) := s; wl.words(wl.num_words).wlen := s'length; wl.words(wl.num_words).count := 1; end if; end; -- declare end loop; end get_words; OV-1.20 u_words_min.adb CSE 3002 procedure put_words(wl: Word_List) is begin for i in 1 .. wl.num_words loop put(wl.words(i).count); put(" " & wl.words(i).s(1 .. wl.words(i).wlen)); new_line; end loop; end put_words; the_words: Word_List; begin get_words(the_words); put_words(the_words); end u_words_min; OV-1.21 u_words_tight.adb CSE 3002 -- Read one word per line and print list of unique words and their frequencies -- Case sensitive -- This is a minimalist version. No bells or whistles. with ada.integer_text_io; use ada.integer_text_io; with ada.text_io; use ada.text_io; procedure u_words_min is type Word is record s: String(1 .. 120); -- The string. Assume 120 characters or less wlen: Natural; -- Length of the word count: Natural := 0; -- Total number of occurrences of this word end record; type Word_Array is array(1 .. 1000) of Word; type Word_List is record words: Word_Array; -- The unique words num_words: Natural := 0; -- How many unique words seen so far end record; OV-1.22 u_words_tight.adb CSE 3002 -- Read one word per line and print list of unique words and their frequencies -- Case sensitive -- This is a minimalist version. No bells or whistles. with ada.integer_text_io; use ada.integer_text_io; with ada.text_io; use ada.text_io; procedure u_words_min is type Word is record s: String(1 .. 120); -- The string. Assume 120 characters or less wlen: Natural; -- Length of the word count: Natural := 0; -- Total number of occurrences of this word end record; type Word_Array is array(1 .. 1000) of Word; type Word_List is record words: Word_Array; -- The unique words num_words: Natural := 0; -- How many unique words seen so far end record; OV-1.23 u_words_tight.adb CSE 3002 -- Read one word per line and print list of unique words and their frequencies -- Case sensitive -- This is a minimalist version. No bells or whistles. -- This version has a fast inner loop. It has only one comparison. -- This is done by always putting the word being sought at the -- end of the list. If the word being sought is found earlier -- in the list, then the value at the end is ignored. If it is -- not found earlier, then it has already been added. -- The final location in the list can't hold a word that is -- being counted. It can only be used to hold a sentinal during -- a search. with ada.integer_text_io; use ada.integer_text_io; with ada.text_io; use ada.text_io; procedure u_words_tight is type Word is record str: String (1 .. 120); -- The string. Assume 120 characters or less wlen: Natural; -- Length of the word count: Natural := 1; -- Total number of occurrences of this word end record; type Word_Array is array(1 .. 1000) of Word; type Word_List is record words: Word_Array; -- The unique words num_words: Natural; -- How many unique words seen so far end record; OV-1.24 u_words_tight.adb CSE 3002 procedure get_words (wl: out Word_List) is i : Natural; begin wl.num_words := 0; -- Initialize here to avoid a warning while not End_of_File loop declare s: String := Get_Line; begin wl.words (wl.num_words + 1).str (1 .. s'Last) := s; wl.words (wl.num_words + 1).wlen := s'Length; i := 1; while s /= wl.words (i).str (1 .. wl.words (i).wlen) loop i := i + 1; end loop; -- s = wl.words(i) if i = wl.num_words + 1 then wl.num_words := wl.num_words + 1; else wl.words(i).count := wl.words(i).count + 1; end if; end; -- declare end loop; end get_words; OV-1.25 u_words_tight.adb CSE 3002 procedure put_words (wl: Word_List) is begin for i in 1 .. wl.num_words loop put (wl.words(i).count); put (" " & wl.words(i).str(1 .. wl.words(i).wlen)); new_line; end loop; end put_words; the_words: Word_List; begin get_words (the_words); put_words (the_words); end u_words_tight; OV-1.26 PL2 Modula-2 Program - Due February 9, 11:59pm CSE 3002 Implement the Word Frequency Functional (WFF) in Modula-2 using findwords.mod as a basis: http://www.engr.uconn.edu/~steve/Cse3002/Commo nProbBackground.pdf You need to develop a dual solution (two programs): Single module solution using records based off of findwords.mod sample code that outputs to stdout a list of words and their frequency. Single module reworking your solution from I into a read procedure that reads the lines into the document variable of type AllLines, a wff procedure that generates the word frequency in the wordsindoc variable of type AllWords &WordFreq record, and a sortandprint procedure that outputs to stdout a list of words and their frequency in alphabetical order. OV-1.27 Expanding the Sample Program CSE 3002 program readwritetofiles; var readfilename : string; writefilename : string; myreadfile : text; mywritefile : text; line : packed array [1..100] of char; i : integer; num_characters: integer; begin (* put files in c:\Dev-Pas directory *) readfilename:='inputfile.txt'; writefilename:='outputfile.txt'; assign(myreadfile, readfilename); reset(myreadfile); assign(mywritefile, writefilename); rewrite(mywritefile); while NOT EOF (myreadfile) do begin readln(myreadfile, line); num_characters := 0; for i:=1 to 100 do if ord(line[i]) <> 0 then begin num_characters := num_characters + 1; write(mywritefile, line[i]) end; writeln(mywritefile, num_characters); end; writeln(mywritefile,'Completed writing'); close(myreadfile); close(mywritefile); end. OV-1.28 Expanding the Sample Program CSE 3002 line : packed array [1..100] of char; i : integer; num_characters: integer; while NOT EOF (myreadfile) do begin readln(myreadfile, line); num_characters := 0; for i:=1 to 100 do if ord(line[i]) <> 0 then begin num_characters := num_characters + 1; write(mywritefile, line[i]) end; writeln(mywritefile, num_characters); end; OV-1.29 Input CSE 3002 Desk Set (1957) Billion Dollar Brain (1967) 2001: A Space Odyssey (1968) The Computer Wore Tennis Shoes (1969) Colossus: The Forbin Project (1970) The Andromeda Strain (1971) The Aries Computer (1972) Demon Seed (1977) Blade Runner (1982) Tron (1982) WarGames (1983) Electric Dreams (1984) D.A.R.Y.L. (1985) Prime Risk (1985) Flight of the Navigator (1986) Short Circuit (1986) Defense Play (1989) Sneakers (1992) Disclosure (1994) Hackers (1995) The Net (1995) OV-1.30 Output CSE 3002 Desk Set (1957)15 Billion Dollar Brain (1967)27 2001: A Space Odyssey (1968)28 The Computer Wore Tennis Shoes (1969)37 Colossus: The Forbin Project (1970))36 The Andromeda Strain (1971) (1970))35 The Aries Computer (1972)) (1970))34 Demon Seed (1977) (1972)) (1970))33 Blade Runner (1982)1972)) (1970))33 Tron (1982) (1982)1972)) (1970))32 WarGames (1983)82)1972)) (1970))32 Electric Dreams (1984)2)) (1970))33 D.A.R.Y.L. (1985)984)2)) (1970))32 Prime Risk (1985)984)2)) (1970))32 Flight of the Navigator (1986)970))35 Short Circuit (1986)or (1986)970))34 Defense Play (1989)or (1986)970))33 Sneakers (1992)89)or (1986)970))32 Disclosure (1994))or (1986)970))32 Hackers (1995)4))or (1986)970))31 The Net (1995)4))or (1986)970))31 Completed writingCompleted writing OV-1.31 Today’s Speaker – Prof. Keith Barker CSE 3002 University Teaching Fellow at UConn Professor of CS&E Professor of Education Curriculum & Instruction Former Positions at Uconn Department Head in CSE Associate Vice Provost for Undergraduate Education & Instruction and the Director of Institute for Teaching and Learning (ITL) Leader of Computer Engineering Curriculum in CSE Developing Logic Circuit Design (at least twice) Involvement in Accreditation for CSE, CS, CompE in ABET and CSAB Past Chair of CS Accreditation Committee One of three faculty in CSE longer than Steve OV-1.32 Today’s Speaker – Prof. Heidi Ellis CSE 3002 Ph.D. CSE, UConn, 1995 Professor at Western New England University Former Department Head Leader in Humanitarian Free and Open Source Software PI of Multiple NSF Awards Recognized by Business Insider Week 26 of the most powerful female engineers in 2016 https://www.nsf.gov/awardsearch/showAward?AWD_ID=1524898 https://www.nsf.gov/awardsearch/showAward?AWD_ID=1225738 http://www.businessinsider.com/26-most-powerful-women-engineersin-2016-2016-2 Nominated for 2016 Women in Open Source Award by Redhat OV-1.33
© Copyright 2026 Paperzz