Get Instant Help From 5000+ Experts For
question

Writing: Get your essay and assignment written from scratch by PhD expert

Rewriting: Paraphrase or rewrite your friend's essay with similar meaning at reduced cost

Editing:Proofread your work by experts and improve grade at Lowest cost

And Improve Your Grades
myassignmenthelp.com
loader
Phone no. Missing!

Enter phone no. to receive critical updates and urgent messages !

Attach file

Error goes here

Files Missing!

Please upload all relevant files for quick & complete assistance.

Guaranteed Higher Grade!
Free Quote
wave
Alzarius Engineering Convention Workshops
Answered

Task

General problem description


The Alzarius Engineering Convention is holding a 3-day collection of workshops. They are going to offer a certificate to anyone who completes at least 5 credits' worth of workshops. Workshops are worth either 1 or 2 credits, so the certificate could be earned by attending five 1-credit workshops, three 2-credit workshops, or a mix of the two, such as three 1-credit workshops and one 2-credit workshop.

Each workshop has a specified start and stop time (using a 24-hour clock). A person can't participate in two workshops at once, so it's important to make sure that people don't sign up for two workshops that are happening at the same time.


Each workshop occurs on only one day (day 1, 2, or 3 of the Convention). No workshop occurs earlier than 6am (0600) or later than 11pm (2300).


You will write a program that checks a participant's proposed Convention schedule and determines

1) whether the proposed list of workshops is possible to attend, without any time conflicts, and

2) whether the proposed list contains at least 5 credits' worth of workshops, so that the attendee will earn a certificate.


A person's Convention schedule will be represented as a list of workshops, where each workshop entry contains these items:  

1. A workshop number (a positive integer)
2. A day number (1, 2, or 3, indicating which day the workshop falls on)
3. A number of credits (1 or 2)
4. A start time, using a 24-hour clock
5. A stop time, using a 24-hour clock 

All of these numbers are positive integers.  

1. Scheme problem


Write a Scheme program to solve the problem described above. Define a function (certificate Workshop_List) which takes a single parameter, Workshop_List, and returns #T or #F. Workshop_List is a list of 5-element lists containing


1. A workshop number (a positive integer)
2. A day number (1, 2, or 3)
3. A number of credits (1 or 2)
4. A start time (an integer in the range 0600-2300)
5. A stop time (an integer in the range 0600-2300)


The function should return #T if the list of workshops totals at least 5 credits and contains no time conflicts, and should return #F otherwise.


You may assume that list Workshop_List will be in the correct format when the function is called; you do not have to error-check for a non-list or an incorrectly formed list. The events in list Workshop_List are not necessarily sorted by workshop numbers, starting times, or any other order. In your program, you may write and call any additional functions that are helpful in the computation. 

General problem description

2. Ada problem


Write a Ada program to solve the problem described above. The input will contain an integer N on a line by itself, representing the number of workshops in the list. This is followed by N lines, each containing 5 positive integers:


1. A workshop number (a positive integer)
2. A day number (1, 2, or 3)
3. A number of credits (1 or 2)
4. A start time (an integer in the range 0600-2300)
5. A stop time (an integer in the range 0600-2300)


The output will be one of two messages: "Certificate earned" or "No certificate". You may assume that the input will be properly formatted with correct data (all workshop numbers will be positive integers, and all times will be integers in the range 0600-2300). The input is not guaranteed to be sorted by workshop numbers, starting times, or any other order. 

3. Prolog problem


Write a Prolog program to solve the problem described above. Define a predicate certificate(+Workshop_List) which takes a single parameter, Workshop_List. Workshop_List is a list of 5-element lists containing


1. A workshop number (a positive integer)
2. A day number (1, 2, or 3)
3. A number of credits (1 or 2)
4. A start time (an integer in the range 0600-2300)
5. A stop time (an integer in the range 0600-2300)


The predicate should succeed if the list of workshops totals at least 5 credits and contains no time conflicts, and should fail otherwise.


You may assume that list Workshop_List will be in the correct format when the function is called; you do not have to error-check for a non-list or an incorrectly formed list. The events in list Workshop_List are not necessarily sorted by workshop numbers, starting times, or any other order. In your program, you may write and call any additional predicates that are helpful in the computation. 

4. Python problem


Write a Python program to solve the problem described above. Define a function certificate(Workshop_List) which takes a single parameter, Workshop_List, and returns True or False. Workshop_List is a list of 5-element lists containing

 
1. A workshop number (a positive integer)
2. A day number (1, 2, or 3)
3. A number of credits (1 or 2)
4. A start time (an integer in the range 600-2300)
5. A stop time (an integer in the range 600-2300)

 
The function should return True if the list of workshops totals at least 5 credits and contains no time conflicts, and should return False otherwise.

You may assume that list Workshop_List will be in the correct format when the function is called; you do not have to error-check for a non-list or an incorrectly formed list. The events in list Workshop_List are not necessarily sorted by workshop numbers, starting times, or any other order. In your program, you may write and call any additional functions that are helpful in the computation.


Note: In Python, decimal integer constants may not start with leading zeros. This is reflected in the test data below, and in the test suite.

support
close