tutorbin

programming language principle and paradigm homework help

Boost your journey with 24/7 access to skilled experts, offering unmatched programming language principle and paradigm homework help

tutorbin

Trusted by 1.1 M+ Happy Students

Place An Orderand save time
man
phone
  • United States+1
  • United Kingdom+44
  • Afghanistan (‫افغانستان‬‎)+93
  • Albania (Shqipëri)+355
  • Algeria (‫الجزائر‬‎)+213
  • American Samoa+1
  • Andorra+376
  • Angola+244
  • Anguilla+1
  • Antigua and Barbuda+1
  • Argentina+54
  • Armenia (Հայաստան)+374
  • Aruba+297
  • Ascension Island+247
  • Australia+61
  • Austria (Österreich)+43
  • Azerbaijan (Azərbaycan)+994
  • Bahamas+1
  • Bahrain (‫البحرين‬‎)+973
  • Barbados+1
  • Belarus (Беларусь)+375
  • Belgium (België)+32
  • Belize+501
  • Benin (Bénin)+229
  • Bermuda+1
  • Bhutan (འབྲུག)+975
  • Bolivia+591
  • Bosnia and Herzegovina (Босна и Херцеговина)+387
  • Botswana+267
  • Brazil (Brasil)+55
  • British Indian Ocean Territory+246
  • British Virgin Islands+1
  • Brunei+673
  • Bulgaria (България)+359
  • Burkina Faso+226
  • Burundi (Uburundi)+257
  • Cambodia (កម្ពុជា)+855
  • Cameroon (Cameroun)+237
  • Canada+1
  • Cape Verde (Kabu Verdi)+238
  • Caribbean Netherlands+599
  • Cayman Islands+1
  • Central African Republic (République centrafricaine)+236
  • Chad (Tchad)+235
  • Chile+56
  • China (中国)+86
  • Christmas Island+61
  • Cocos (Keeling) Islands+61
  • Colombia+57
  • Comoros (‫جزر القمر‬‎)+269
  • Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)+243
  • Congo (Republic) (Congo-Brazzaville)+242
  • Cook Islands+682
  • Costa Rica+506
  • Côte d’Ivoire+225
  • Croatia (Hrvatska)+385
  • Cuba+53
  • Curaçao+599
  • Cyprus (Κύπρος)+357
  • Czech Republic (Česká republika)+420
  • Denmark (Danmark)+45
  • Djibouti+253
  • Dominica+1
  • Dominican Republic (República Dominicana)+1
  • Ecuador+593
  • Egypt (‫مصر‬‎)+20
  • El Salvador+503
  • Equatorial Guinea (Guinea Ecuatorial)+240
  • Eritrea+291
  • Estonia (Eesti)+372
  • Eswatini+268
  • Ethiopia+251
  • Falkland Islands (Islas Malvinas)+500
  • Faroe Islands (Føroyar)+298
  • Fiji+679
  • Finland (Suomi)+358
  • France+33
  • French Guiana (Guyane française)+594
  • French Polynesia (Polynésie française)+689
  • Gabon+241
  • Gambia+220
  • Georgia (საქართველო)+995
  • Germany (Deutschland)+49
  • Ghana (Gaana)+233
  • Gibraltar+350
  • Greece (Ελλάδα)+30
  • Greenland (Kalaallit Nunaat)+299
  • Grenada+1
  • Guadeloupe+590
  • Guam+1
  • Guatemala+502
  • Guernsey+44
  • Guinea (Guinée)+224
  • Guinea-Bissau (Guiné Bissau)+245
  • Guyana+592
  • Haiti+509
  • Honduras+504
  • Hong Kong (香港)+852
  • Hungary (Magyarország)+36
  • Iceland (Ísland)+354
  • Indonesia+62
  • Iran (‫ایران‬‎)+98
  • Iraq (‫العراق‬‎)+964
  • Ireland+353
  • Isle of Man+44
  • Israel (‫ישראל‬‎)+972
  • Italy (Italia)+39
  • Jamaica+1
  • Japan (日本)+81
  • Jersey+44
  • Jordan (‫الأردن‬‎)+962
  • Kazakhstan (Казахстан)+7
  • Kenya+254
  • Kiribati+686
  • Kosovo+383
  • Kuwait (‫الكويت‬‎)+965
  • Kyrgyzstan (Кыргызстан)+996
  • Laos (ລາວ)+856
  • Latvia (Latvija)+371
  • Lebanon (‫لبنان‬‎)+961
  • Lesotho+266
  • Liberia+231
  • Libya (‫ليبيا‬‎)+218
  • Liechtenstein+423
  • Lithuania (Lietuva)+370
  • Luxembourg+352
  • Macau (澳門)+853
  • North Macedonia (Македонија)+389
  • Madagascar (Madagasikara)+261
  • Malawi+265
  • Malaysia+60
  • Maldives+960
  • Mali+223
  • Malta+356
  • Marshall Islands+692
  • Martinique+596
  • Mauritania (‫موريتانيا‬‎)+222
  • Mauritius (Moris)+230
  • Mayotte+262
  • Mexico (México)+52
  • Micronesia+691
  • Moldova (Republica Moldova)+373
  • Monaco+377
  • Mongolia (Монгол)+976
  • Montenegro (Crna Gora)+382
  • Montserrat+1
  • Morocco (‫المغرب‬‎)+212
  • Mozambique (Moçambique)+258
  • Myanmar (Burma) (မြန်မာ)+95
  • Namibia (Namibië)+264
  • Nauru+674
  • Nepal (नेपाल)+977
  • Netherlands (Nederland)+31
  • New Caledonia (Nouvelle-Calédonie)+687
  • New Zealand+64
  • Nicaragua+505
  • Niger (Nijar)+227
  • Nigeria+234
  • Niue+683
  • Norfolk Island+672
  • North Korea (조선 민주주의 인민 공화국)+850
  • Northern Mariana Islands+1
  • Norway (Norge)+47
  • Oman (‫عُمان‬‎)+968
  • Palau+680
  • Palestine (‫فلسطين‬‎)+970
  • Panama (Panamá)+507
  • Papua New Guinea+675
  • Paraguay+595
  • Peru (Perú)+51
  • Philippines+63
  • Poland (Polska)+48
  • Portugal+351
  • Puerto Rico+1
  • Qatar (‫قطر‬‎)+974
  • Réunion (La Réunion)+262
  • Romania (România)+40
  • Russia (Россия)+7
  • Rwanda+250
  • Saint Barthélemy+590
  • Saint Helena+290
  • Saint Kitts and Nevis+1
  • Saint Lucia+1
  • Saint Martin (Saint-Martin (partie française))+590
  • Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)+508
  • Saint Vincent and the Grenadines+1
  • Samoa+685
  • San Marino+378
  • São Tomé and Príncipe (São Tomé e Príncipe)+239
  • Saudi Arabia (‫المملكة العربية السعودية‬‎)+966
  • Senegal (Sénégal)+221
  • Serbia (Србија)+381
  • Seychelles+248
  • Sierra Leone+232
  • Singapore+65
  • Sint Maarten+1
  • Slovakia (Slovensko)+421
  • Slovenia (Slovenija)+386
  • Solomon Islands+677
  • Somalia (Soomaaliya)+252
  • South Africa+27
  • South Korea (대한민국)+82
  • South Sudan (‫جنوب السودان‬‎)+211
  • Spain (España)+34
  • Sri Lanka (ශ්‍රී ලංකාව)+94
  • Sudan (‫السودان‬‎)+249
  • Suriname+597
  • Svalbard and Jan Mayen+47
  • Sweden (Sverige)+46
  • Switzerland (Schweiz)+41
  • Syria (‫سوريا‬‎)+963
  • Taiwan (台灣)+886
  • Tajikistan+992
  • Tanzania+255
  • Thailand (ไทย)+66
  • Timor-Leste+670
  • Togo+228
  • Tokelau+690
  • Tonga+676
  • Trinidad and Tobago+1
  • Tunisia (‫تونس‬‎)+216
  • Turkey (Türkiye)+90
  • Turkmenistan+993
  • Turks and Caicos Islands+1
  • Tuvalu+688
  • U.S. Virgin Islands+1
  • Uganda+256
  • Ukraine (Україна)+380
  • United Arab Emirates (‫الإمارات العربية المتحدة‬‎)+971
  • United Kingdom+44
  • United States+1
  • Uruguay+598
  • Uzbekistan (Oʻzbekiston)+998
  • Vanuatu+678
  • Vatican City (Città del Vaticano)+39
  • Venezuela+58
  • Vietnam (Việt Nam)+84
  • Wallis and Futuna (Wallis-et-Futuna)+681
  • Western Sahara (‫الصحراء الغربية‬‎)+212
  • Yemen (‫اليمن‬‎)+967
  • Zambia+260
  • Zimbabwe+263
  • Åland Islands+358
*Get instant homework help from top tutors—just a WhatsApp message away. 24/7 support for all your academic needs!

Recently Asked programming language principle and paradigm Questions

Expert help when you need it
  • Q1:Programming Languages - Project WJ Inc., is a company with offices around the world. The HR team wants to build reports on the number of employees around the world, in different departments. But they do not want to use the raw data for the reporting purpose. They want some consolidation and aggregation to be done prior to being loaded into their reporting system. The data is provided to the software engineer in CSV files. There are 3 CSV files, each holding the department, location and employee headcount data. The department and location information is provided as a flattened hierarchy. Given below is a snapshot of the department file content: level1 WJ Group WJ Group WJ Group level2 WJ Inc. WJ Inc. WJ Ino level? level3 level4 level5 level5 DEPT 1 DEPT 11 DEPT 111 DEPT 1111 DEPT 11111 DEPT 1 DEPT 12 DEPT 1 DEPT 13 DEPT 133 level! The department hierarchy has 7 levels. The file has columns level1 - level7 and an additional column to indicate the the bottom level. The department hierarchy is a jagged hierarchy meaning not all hierarchies have 7 levels. Similarly the location data is also provided. The screen shot is given below: level1 level2 laval3 World North America USA Califomia World North America USA Califomia World North America USA Califomia laval7 level5 loval6 leve! bottom_level Northern California San Jose Main Campus SJG1 8JC 1 Northern Califomia San Jose Main Campus SJC2 SJC2 Southern California Los Angeles LA Techspace LA 1 LA 1 The head count data includes the department, location. Each row in the file gives the number of employees for a particular department at a particular location. The headcount data is only available at bottom levels. Given below is a screenshot of the data: location department DEPT_11111 SJC 1 SJC 1 SJC 1 SJC 1 SJC 1 DEPT 12 DEPT 133 bottom_level DEPT 11111 DEPT 12 DEPT 133 DEPT_2222 DEPT_2244 head_count 12 42 122 3 12See Answer
  • Q2:3. Write a recursive function that returns the nth number in Fibonacci series. But instead of addition of previous 2 numbers, the function will take a code block and apply the code block to the previous 2 numbers. So the regular fibonacci series is a special case where the code block specifies summation.See Answer
  • Q3:4. Write a recursive function that accepts an array, and returns an array with the order reverses. [1, 2, 3, 4, 5, 6] should return [6, 5, 4, 3, 2,1].See Answer
  • Q4:5. Write a class Fraction to represent a fraction. It has a constructor to accept a numerator and denominator. The denominator should be 1 by default. The constructor should automatically simplify the fraction. So if 2 and 4 are passed to the constructor the fraction should be 1/2. Implement a method that takes another Fraction, adds it to the current fraction. The addition function should be chain able, i. e. if function name is add, the we should be able call f.add (1/2).add (1/3). Leverage the add function to implement a + function that can add two fractions and returns the result, (1/2 + 1/3 should return 5/6). Use helper methods as needed, with appropriate access levels. The numerator and denominator attributes should not be accessible outside the class. Implement a to_s to return the fraction as a string in proper format (like "1/2").See Answer
  • Q5:2. Write a function that takes a list of strings and a suffix, and returns a list of strings, in which each string is built by appending the suffix to each string in the original list. eg: (my- append (list "util" "main" "delta") ".cpp") will return ("util.cpp", "main.cpp", "delta.cpp"). Use the builtin string-append function to append strings.See Answer
  • Q6:3. In an academic institute, students records include id, first name and last name. Write a function that accepts a list of student records. Each record is a list of integer, string, string - eg: '(1, "Sam", "Roger"), and records of new students may not have the id, they have only first and last name as in' ("Kang" "Lee"). The function should return a list ids. If the student has an id then that is used, if the student does not have an id, full name is used as id so the returned list would look like (1 "Kang Lee" 2 3 "Ravi Kumar" "Sarah Smith")See Answer
  • Q7:1. Write a Ruby class that represents an Item ordered by a customer. The attributes include item id, item name, item price, item count and total price. The class should include the Ruby builtin mixin Comparable, so that Items in a list can be sorted by item count in descending order, followed by total price in descending order, followed by item name in alphabetic order. Documentation for Comparable can found at https://rubyapi.org/2.6/o/ comparable.See Answer
  • Q8:2. Given below is SML code that implements a simple way to define expressions and operations on them: datatype exp = Constant of int Negate of exp | Add of exp * exp fun eval e = case e of Constant (i) => i Negate el => ~ (eval el) | Add (el, e2) => (eval el) + (eval e2) eval (Add (Constant 19, Negate (Constant 4))); (* result is 15 *)See Answer
  • Q9: Write a shellscript to append two files accepted as command line input, if they exist. Display the content of the new file, and the number of words in all the files. Write a shell script to input a file name. If the file exist, perform the following using menu-driven programming according to the options given below: Option 1 2 Any other value Process to be done Display the line at the middle of the file Display the background processes display all the files in the current directory that has size ranging from 100 kb to 500 kb A user is typing a Shell script in vi editor. He wants to delete a line in his file. To which mode should he change and how? A user wants to get a list of devices and the points at which they will be attached to the main filesystem. From Choose... which of the following files can he get the required information? An administrator types the following command on an RPM- based Linux distribution: # rpm -ev nx-3.5.0- Choose... 2.el6.centos.i686.rpm What is the effect of is command? Choose... ◆ * What is the output of the following shell script? #! /bin/bash x=3 y=5 if [ $x -eq 3 -a $y -ge 5 ] then echo -n $(($x+2)) FL echo "$y+2 Choose... Match the Following: A user is typing a Shell script in vi editor. He wants to delete a line in his file. To which mode should he change and h✓ Choose... A user wants to list of devices ar points at which will be attached main filesystem. which of the foll files can he get t required informa An administrato types the follow command on an based Linux Choose... 3+27 5 5+2 Command, press Esc key /etc/fstab Remove the package Insert, press Esc key /etc/filestab enable the package distribution: # rpm -ev nx-3.5.0- el6.centos.i686.rpm Choose... ◆See Answer
  • Q10:(50 handprints, unvarying sizes) Which one of the following programs is not equivalent to this one? Select one: set sine to ask. Du yis mani varying handprint siams? (V or N)] and wait repeat_mundser_of_handprints make_kandprint set change sice by ask | o yes mant); and wall set culer effect to pick random €210 to 200 Mamp steps AA u want varying handprint sizes? (Vorh] and wait angebo repeat sumber_of_handprists Lai definmake_handprint if an edge, bence tare (degrees color affect >200 thes 100 – effect to pick randers €209 to 200 define get input define make handprist learn2.open.ac.uk move steps if an edge, bence tare (degrees m Esins? (Vorh}] and wait 200 rSee Answer
  • Q11: TMA 02 Tutor-marked assignment TMA 02 Assignment submission This module requires all assignments to be submitted electronically. To submit an assignment, please follow the link(s) from your StudentHome page to the online TMA/EMA service. If you foresee any difficulty with submitting your assignment on time, you should contact your tutor well in advance of the cut-off date. Help with assignment questions You should read the TM112 Assessment guide in the Assessment section of the TM112 website before answering the questions here. If you need further guidance on any assignment questions, please ask your tutor, who will be happy to help. Do not discuss TMA questions on the forums. Your TMA answers must be your own work. The University takes copying answers from others, collusion with other students and soliciting answers from others very seriously. Assignments are checked both automatically and by your tutor. Any offences can have grave consequences, from disallowing part or whole of an assessed piece of work to withholding or withdrawing qualification, credit or registration. https://learn2.open.ac.uk/mod/oucontent/view.php?id=2263345&printable=1 07/06/2024, 11:16 Page 1 of 17 Word count You must provide a word count for each question or question part where a limit is specified. Evidence of Block 2 quiz engagement for this TMA 02 The final question of this TMA asks you for evidence of engagement with the Block 2 quiz. Read the final question first to make sure you know what will be required. Question 1 (23 marks) You must give a word count for any question with a maximum word limit. This question is about Block 2 Part 1. In Question 1, Question 3 and Question 6 of this TMA you will explore the roles of cloud computing, smart devices and location-based services in a smart parking system. Before answering these three TMA questions, you will need to read the article that can be found here: https://www.mokosmart.com/smart-parking-system-using-iot/. Your answers will be based on the content of the article and the module materials. Note that if (and only if) this external link becomes inaccessible, a pdf copy will be made available to download from the Assessment page. Each of Questions 1, 3 and 6 can be answered independently of each other, but you may find it useful to read all three questions before you start so as to avoid any duplication in your answers. a. Define what is meant by the Internet of Things (IoT). Then continue by relating each part of your definition to the context given in the article, being clear as to what the 'things' are, the kind of data being processed in the cloud and the technologies being used to connect them together within a bigger system. The maximum word limit for part a. is 125 words. (8 marks) https://learn2.open.ac.uk/mod/oucontent/view.php?id=2263345&printable=1 07/06/2024, 11:16 Page 2 of 17 b. Do you think that smart parking is 'green'? Give at least one point on either side of the argument and come to a clear conclusion. The maximum word limit for part b. is 120 words. (8 marks) c. Cloud providers say that the cloud offers elasticity and scalability in terms of its processing capabilities. Explain what the terms in italics mean and suggest how the owner of a smart parking scheme might benefit from each. The maximum word limit for part c. is 70 words. (4 marks) d. Write a reference for this article using the Cite Them Right version of Harvard guidance here: Cite Them Right It is important that you follow the format carefully as you will be assessed on your accuracy in following a referencing guide. (3 marks) (Total 23 marks) Question 2 (18 marks) This question provides an opportunity for you to demonstrate your understanding of the problem- solving approach taught in TM112 and the patterns introduced in Block 1 Part 4 and Block 2 Part 2. You can find an overview of the problem-solving approach and a list of all the patterns TM112 teaches in the Problem solving and Python quick reference and you will need to refer to this document as you work on the question. Important note: you do not need to get a working program in part a. in order to attempt part b. A student wants to write a program to check whether a book ISBN number is valid or not. Here is a top-level decomposition: https://learn2.open.ac.uk/mod/oucontent/view.php?id=2263345&printable=1 07/06/2024, 11:16 Page 3 of 17 > Check ISBN number >> Initialise a list to the 13 digits of the ISBN number to be checked >> Make a new list by leaving the items at the even indexes (0, 2, 4 etc.) unchanged and multiplying the items at the odd indexes by 3 >> Find the sum of the items in the transformed list >> If the remainder of the sum divided by 10 is 0, result is valid, else the result is invalid >> Print the result So, for example, if an ISBN number is 978-0-141-18321-3 the input is this list: [9, 7, 8, 0, 1, 4, 1, 1, 8, 3, 2, 1, 3] and the output will be valid. One of the tests of your code should be for an input list representing a possible ISBN number partly based on the example given above and partly derived from your Pl number. So, the first six digits in your ISBN list should be the first six digits from your PI number and the remaining digits will be 1, 1, 8, 3, 2, 1, 3. So, for example, for the Pl number B9081720, your ISBN list will be: [9, 0, 8, 1, 7, 2, 1, 1, 8, 3, 2, 1, 3] The first part of this question will only consider the following part of the decomposition. >Check ISBN number >> Initialise a list to the 13 digits of the ISBN number to be checked >> Make a new list by leaving the items at the even indexes (including 0) unchanged and multiplying the items at the odd indexes by 3 You may want to temporarily add a print statement to check the output. https://learn2.open.ac.uk/mod/oucontent/view.php?id=2263345&printable=1 07/06/2024, 11:16 Page 4 of 17 a. i. Describe the input data and the output data for this first task. ii. Specify one further input list you might use in testing in addition to the list you have created using your PI number. Make sure that you state the test input, the expected output and a brief explanation of why you selected this test. iii. Write an algorithm based on Pattern 2.4. iv. Implement your algorithm as Python code. Your code must match the steps of your algorithm and you should use comments in the code to make it clear how the two correspond. Marks will be lost if the program does not follow the algorithm. Copy your Python code, as text, into your Solution document. Name your Python file Q2a_OUCU.py, where ‘OUCU' is your OU computer username, e.g. abc123. Then include the code file in your TMA zip file. You should aim to use only the Python features that are introduced in the module. If you decide to use techniques or language features that TM112 does not cover, you must give a justification for your decisions; otherwise, marks will be lost. (9 marks) b. In this part of the question, you will implement the final steps in the top-level decomposition given at the beginning of this question: >> Find the sum of the items in the transformed list >> If the remainder of the sum divided by 10 is 0, result is valid, else result is invalid >> Print the result So, for example, for this step, if the input is the list: [9, 21, 8, 0, 1, 12, 1, 3, 8, 9, 2, 3, 3] The output valid will be printed. https://learn2.open.ac.uk/mod/oucontent/view.php?id=2263345&printable=1 07/06/2024, 11:16 Page 5 of 17See Answer
  • Q12: CIT129 Introduction to Programming - Spring 2024 Assignment #5 (based on chapter 6 of your textbook) – 100 points Date Assigned: 2/12 ● ● ● DO NOT post the text of this assignment on any web sites. DO NOT share your answers with anyone. DO NOT collaborate on completing work with anyone. DO NOT use the Internet to search for solution to assignments. DO NOT pay anyone to write your code. Avoid web sites that offer solutions to assignments. These include AI tools such as ChatGPT, chegg.com, CourseHero, etc. If you copy work from such web sites, keep in mind that other students are also looking at the same information and will therefore submit duplicated work. Failure to meet these requirements leads to the violation of the academic integrity principles as stated in your syllabus. Objective: Demonstrate your understanding of solving problems that involve using nested loops and decisions in programs. Assignment: Write Raptor code to process student age values. Deliverable: One Raptor code files (.rap). Save your file using the format: firstNameLastNameCIT129_pa5.rap. Submit the file through the Canvas Assignment dropbox. Date Due: 2/20 Documentation: I am also asking for code documentation. I explained the process in our last assignment. I hope you understand that code documentation is different than output from programs. Code documentation explain the code, output show the interaction of the code with the user. NOTE: There is no need to submit your pseudocode file. It's always best to start with one, but you would not submit it. Process: The program: a) Asks for a password. b) If the password is not "123", the program issues an error message and terminates. HINT: This is a simple decision structure. If the password is 123: CIT129 - Assignment 5 - Chapter 6 (more loops and decisions) Page 1 i. ii. Ask the user for the number of students. Validate the input so that the input number is within 1 and 100 students. If the number of students is out of this range, allow the student to enter another number until we have a "good" number of students. For each student: a. b. Ask the user for the student's age in years. Do not allow the user to enter an invalid age (A number less than 1 or more than 120 is invalid). Issue an error message and allow the user to enter a valid age. Display the age along with the message "that is odd” if the age is odd, otherwise, display the age along with the message "you are even" c. Calculate and display the total of all even age values in years. d. Calculate and display the total of all odd age values in years. e. Calculate and display the total age of all students in years. f. Find and display the lowest age value in years. g. Find and display the highest age value in years. h. Calculate and display the average age for all students in years and in days. Assume 365 days in a year. == Hint: Using the MOD function might come in handy for determining if a number is even or odd. IF num MOD 2 1 then it must be ODD. If num MOD 2= 0 then must be even. So, if num happens to happen to be 13, 13 MOD 2 = 1, so 13 is odd. Recall that the MOD operator in Raptor gives you the remainder of division of 2 whole numbers. == Here are sample test cases: <<<< These are just sample runs - your code must work in all situations. Enter the password: 777 Wrong password! - I'm terminating Enter the password: 123 Enter the number of students: -1 Invalid - try again Enter the number of students: -5 Invalid - try again Enter the number of students: 1000 Invalid - try again Enter the number of students: 3 Enter the age of the student: 20 20 you are even Enter the age of the student: -1 Invalid - try again CIT129 - Assignment 5 - Chapter 6 (more loops and decisions) Page 2 Enter the age of the student: 130 Invalid – try again Enter the age of the student: 30 30 you are even Enter the age of the student: 15 15 that is odd Total of even age values = 50 Total of even odd values = 15 Total age in years = 65 Lowest age in years = 15 Highest age in years 30 Average age in years = 21.6667 Average age in days = 7908.3333 - CIT129 - Assignment 5 - Chapter 6 (more loops and decisions) Page 3See Answer
  • Q13:c. Calculate and display the total of all even age values in years. d. Calculate and display the total of all odd age values in years. e. Calculate and display the total age of all students in years. f. Find and display the lowest age value in years. g. Find and display the highest age value in years. h. Calculate and display the average age for all students in years and in days. Assume 365 days in a year.See Answer
  • Q14:4. Background: The num data type is composed of three variants: Inty of int: Represents an integer value. Floaty of float: Represents a floating-point value. Stringy of string: Represents a string which is guaranteed to be either a valid integer or a valid floating-point number. Objective: Define an infix operator +++ that sums 2 num values and returns a result of the num type, adhering to the following rules: Intv + Intv: Sum as integers, return as Intv. Floaty + Floaty: Sum as floats, return as (Floaty). Intv + Floaty Of Floaty + Inty: Convert the Intv to a float, sum as floats, and return as Floaty Stringy + any num type: Convert the stringy to its numeric representation (Intv) or Floaty ). Sum according to the rules above. Stringy + Stringy: Convert both stringy values to their numeric representations and sum the 2 values Return the result as stringy, converting the numeric result back to string format. Note: The conversion from stringy should account for the possibility that the string could represent either an integer or a float. The problem guarantees that the string will always be a valid representation of one of these two. 5. Write a function freq) that takes a list of strings and returns a hash table where the keys are the unique strings from the list and the values are their respective frequencies in the list. 6. Given a hash table that maps strings to integers (representing some kind of ID), write a function hashiny to create a new hash table where the integers map back to their original strings. Assume no two strings map to the same integer. 7. Write a program that computes the frequency of each string provided as command-line arguments. Your program should print the frequencies in the format "string count", where each string-count pair is on a separate line. The output should be ordered alphabetically based on the string. Hint: Consider using the Map module from the OCaml standard library to efficiently track the frequencies and obtain an ordered output. Input: Strings provided as command-line arguments, Example: ./prog apple banana apple cherry Output: Ordered string-count pairs printed line by line, e.g., apple 21 banana 1 cherry 1See Answer
  • Q15: CIT129 Introduction to Programming - Spring 2024 Assignment #6 (based on chapter 7 of your textbook) – 100 points ● ● ● DO NOT post the text of this assignment on any web sites. DO NOT share your answers with anyone. DO NOT collaborate on completing work with anyone. DO NOT use the Internet to search for solution to assignments. Objective: Demonstrate your understanding of solving problems that involve using basic arrays. DO NOT pay anyone to write your code. Avoid web sites that offer solutions to assignments. These include AI tools such as ChatGPT, chegg.com, CourseHero, etc. If you copy work from such web sites, keep in mind that other students are also looking at the same information and will therefore submit duplicated work. Failure to meet these requirements leads to the violation of the academic integrity principles as stated in your syllabus. Assignment: Use arrays to write code to process employee income data. Deliverable: One text file for the pseudocode. Save your file using the format: firstNameLastNameCIT129_pa6.docx (or any text file format that I can open on my computer). One Raptor code file (.rap). Save your file using the format: firstNameLastNameCIT129_pa6.rap. Submit file(s) through the Canvas Assignment dropbox. Documentation: I am also asking for code documentation. I explained the process in our last assignment. I hope you understand that code documentation is different than output from programs. Code documentation explain the code, output show the interaction of the code with the user. ● NOTES: ● Don't worry about formatting the output with a certain number of digits after the decimal point. Don't worry about exact lining up of the output as shown in the sample run. Process: Write the pseudocode and the Raptor code to solve the following problem. CIT129 - Assignment 6 - Chapter 7 (arrays) Page 1 Process and additional criteria: a) Ask the user for the number of employees whose income we would like to process. Make sure that the number of employees being processed is a number between 1 and 200, inclusive. Use a loop to validate this input. b) Ask the user for the identification number and income value for each employee and store the data in two arrays. c) Display the header "INCOME REPORT". d) Display the identification number and income values, separated by a comma and a $symbol before the value of income, one per line. See the sample interaction. Calculate and display the total income. e) f) Calculate and display the average income. g) Display the header "List of income values more than the average". h) Display the income values larger than the average income. SAMPLE interaction: Of course, this is just a sample run. Your code should work for any number of input values. Enter the number of people: -1 Invalid number of people - try again: 300 Invalid number of people - try again: 3 Enter Employee Identification Number: 8120 Enter income: 2500.5 Enter Employee Identification Number: 1234 Enter income: 3000 Enter Employee Identification Number: 4242 Enter income: 2800.8 INCOME REPORT 8120, $2500.5000 1234, $3000 4242, $2800.8000 Total Income = 8301.3000 Average income = 2767.1000 List of income values more than the average 3000 2800.8000 CIT129 - Assignment 6 - Chapter 7 (arrays) Page 2/nSee Answer
  • Q16:INSTRUCTIONS · Need to Use F# programming . Note: Your test cases should include some indication of what the correct result is. You may choose to do this with a comment, by printing the correct result along with your result, by using an if statement, etc. But both the correct result and the actual result should be clear./nCS 341, Spring 2024 Overview In this homework assignment, you are going to write three functions in F#. The code containing your five functions must be in a file named: hw06.fs. The code is to be called from the F# code in a file named: main.fs. The file "main.fs" will act as the testing code that will contain all of the code needed to verify correct execution of the functions in the file "hw06.fs". The initial code in "main.fs" only has one test case included. You are expected to create additional test cases in "main.fs" to verify the functionality of your functions in "hw06.fs". Note that the version of "main.fs" that is part of the autograder code is fairly long and contains quite a number of test cases. The test cases for the autograder will not be released. You are encouraged to be very thorough when creating your own test cases. The functions that are to be written for this assignment are described below. Make sure you follow the directions specified in the comments for each function regarding the function's parameter(s), return value, implementation details, and helper functions. Some of the functions may expect you to create helper functions to make sure they run properly. Exercise #1 - duplicateValues (tail recursive) // duplicateValuesTR L // Given a list L, create a new list that duplicates each element // in L. // Example: duplicateValuesTR [1;2;3;3;7] => [1;1;2;2;3;3;3;3;7;7] Example: duplicateValuesTR ['a'; 'b';'a'; 'a' ] => ['a';'a'; 'b'; 'b'; 'a'; 'a'; 'a'; 'a'] // NOTE: write a tail-recursive version using a helper function; // do not change the API of the original duplicateValuesTR // function. Exercise #2 - duplicateValues (higher-order approach) // duplicateValuesHO L // Given a list L, create a new list that duplicates each element // in L. // Example: duplicateValuesHO [1;2;3;3;7] => [1;1;2;2;3;3;3;3;7;7] // Example: duplicateValuesHO ['a' ; 'b'; 'a'; 'a' ] => ['a';'a'; 'b'; 'b';'a';'a'; 'a'; 'a'] NOTE: write this using higher-order function(s). Exercise #3 - shiftList // shiftList L N // Given a list L and an integer N, shift the list N places to // the left. Example: shiftList [1; 2; 3; 4; 5; 6; 7; 8] 3 => [4; 5; 6; 7; 8; 1; 2; 3] Example: shiftList ['a'; 'b'; 'c'; 'd'; 'e'; 'f'; 'g'; 'h'] (-2) => ['g' ; 'h'; 'a'; 'b'; 'c'; 'd'; 'e'; 'f' ] // You can solve using recursion or higher-order function(s). // If you are solving recursively, tail recursion is required. Extra Credit Exercise - leapYears leapYears YR // Given a year YR as an integer, create a list of integers of // all the leap years since that year, up until 2025, in order. // If the year given is a leap year, include that year. // A leap year in the Gregorian calendar occurs: - in every year that is evenly divisible by 4 - if the year is evenly divisible by 100, it is only a leap year if the year is also evenly divisible by 400. // The first year in the Gregorian calendar was in 1582, so you // do not need to worry about years before that. // Example: leapYears 1998 => [2000; 2004; 2008; 2012; 2016; 2020; 2024] Example: leapYears 2000 => [2000; 2004; 2008; 2012; 2016; 2020; 2024] Example: leapYears 2025 => [] // You can solve using recursion or higher-order approaches. // If you are solving recursively, tail recursion is required. // You are not allowed to use the IsLeapYear () method. Requirements In order to earn full points for this homework assignment, your code must meet the following requirements: · No variables (i.e. no use of the keyword mutable). · No loops. Instead, use recursion or higher-order functions, e.g. List.map, List.iter, etc. You must use recursion or higher-order programming as noted in the header comments for each of the functions. Failure to use the proper approach for each exercise will result in deduction of points after the assignment deadline. Proper tail recursion is quite specific. Double check that any solutions you come up with really do use tail recursion. In previous semesters, many students submitted assignments that did in fact NOT implement proper tail recursion. CS 341, Spring 2024 Submission Login to Gradescope.com and look for the assignment "Homework 06". Submit your F# program file "hw06.fs" and your testing file "main.fs". You have unlimited submissions. Keep in mind we grade your last submission unless you select an earlier submission for grading. If you do choose to activate an earlier submission, you must do so before the deadline. Add your name to the header comment and comment any functions you write! No late submissions will be accepted for this assignment. We will be grading your submission as follows: . The three functions required for "hw06.fs" will account for 60 points of the assignment. These will be graded via the autograder. . The test cases you write in "main.fs" will account for 40 points of the assignment. These will be graded manually for correctness and thoroughness. o Your test cases should include some indication of what the correct result is. You may choose to do this with a comment, by printing the correct result along with your result, by using an if statement, etc. But both the correct result and the actual result should be clear. . The extra credit will be worth 10 additional points. Six of those ten points will be graded via the autograder, checking that your function works as intended. The other four points are for the test cases you write in "main.fs" for the extra credit exercise and will be graded manually. Academic Integrity All work is to be done individually - group work is not allowed. While we encourage you to talk to your peers and learn from them, this interaction must be superficial with regards to all work submitted for grading. This means you cannot work in teams, you cannot work side-by-side, you cannot submit someone else's work (partial or complete) as your own, etc. The University's policy is available here: https://dos.uic.edu/community-standards/ In particular, note that you are guilty of academic dishonesty if you extend or receive any kind of unauthorized assistance. Absolutely no transfer of program code between students is permitted (paper or electronic), and you may not solicit code from family, friends, or online forums (e.g. you cannot download answers from Chegg). Other examples of academic dishonesty include emailing your program to another student, sharing your screen so that another student may copy your work, copying-pasting code from the internet, working together in a group, and allowing a tutor, TA, or another individual to write an answer for you. CS 341, Spring 2024 Academic dishonesty is unacceptable, and penalties range from a letter grade drop to expulsion from the university; cases are handled via the official student conduct process described at the link above./n/nSee Answer
  • Q17: A list of 5 unsigned numbers (1H,68H,64H,65H,0H,34,100,101,70H,4,98H) is stored starting at memory location LIST in code memory (ROM). Write a program that will: Copy the numbers from code memory (ROM) to program memory (RAM)starting at address 40H. Sum the value of the numbers then output the result on PO. Find the number of values that are greater than 1510 and output the result on P1 LEDS. 2. (5 points) Write a program that will convert a string of characters in to an all-upper-case string: The string named "MyString " defined using appropriate assembler directives and ended with 0. The original string consists of a mixture of upper- and lower-case characters in addition to spaces. - The converted string should be stored RAM starting at address 40H.See Answer
  • Q18: 3. (2 points) Answer the following questions. If necessary, consult a reference on C (and cite your source). (a) What is the scope and what is the lifetime of a static local variable? (b) What is the scope and what is the lifetime of a static global variable?See Answer
  • Q19: 1. public int summation (int start, int end) { 3.return start; 2. if (start == end) 4.else 5.return start + summation (start+1, end); Show the runtime stack that is built in order to calculate summa-tion(3,6). You should show the stack's state whenever an activation record is pushed on or popped off. Be sure your representation of the stack includes all dynamic links, current values for all parameters, and,when appropriate, give the return value of the function.See Answer
  • Q20: 2. (3 points) Find some online material to learn C#'s namespace mecha-nism (cite your source). Explain briefly how it works and its benefits.See Answer

TutorBin Testimonials

I found TutorBin Programming Language Principle And Paradigm homework help when I was struggling with complex concepts. Experts provided step-wise explanations and examples to help me understand concepts clearly.

Rick Jordon

5

TutorBin experts resolve your doubts without making you wait for long. Their experts are responsive & available 24/7 whenever you need Programming Language Principle And Paradigm subject guidance.

Andrea Jacobs

5

I trust TutorBin for assisting me in completing Programming Language Principle And Paradigm assignments with quality and 100% accuracy. Experts are polite, listen to my problems, and have extensive experience in their domain.

Lilian King

5

I got my Programming Language Principle And Paradigm homework done on time. My assignment is proofread and edited by professionals. Got zero plagiarism as experts developed my assignment from scratch. Feel relieved and super excited.

Joey Dip

5

TutorBin helping students around the globe

TutorBin believes that distance should never be a barrier to learning. Over 500000+ orders and 100000+ happy customers explain TutorBin has become the name that keeps learning fun in the UK, USA, Canada, Australia, Singapore, and UAE.