Up till now, we provide 9999 solutions for all subjects which include Mathematics, Finance, Accounting, Management, Engineering, Computer Science, Natural Sciences, Medicine Science, etc.

Please DO NOT respond to this question by copy/pasting the code provided elsewhere on the site, none of those work. Thanks. Virtual Memory Lab This lab project addresses the implementation of page-replacement algorithms in a demand-paging system. Each process in a demand-paging system has a page table that contains a list of entries. For each logical page of the process, there is an entry in the table that indicates if the page is in memory. If the page is in memory, the memory frame number that page is resident in is indicated. Also, for each page, the time at which the page has arrived in memory, the time at which it has been last referenced, and the number of times the page has been referenced since the page arrived in memory are maintained. The page table data structure is a simple array of page-table entries (PTEs). Each PTE contains five fields as defined below: struct PTE { int is_valid; int frame_number; int arrival_timestamp; int last_access_timestamp; int reference_count; } Each process in the system has a page table that is simply an array of PTEs. Each process also has a pool of frames that is allocated. The frame pool for a process is represented as an array of integers, where each Integer represents the frame number of a frame that is free and is available for use by the process. Note that in order to get the frame number in the pool, you first need to access the integer in the array. This lab project aims to exercise the various policies for page replacement. In particular, we study the following three page-replacement policies: First-In-First-Out (FIFO) Least-Recently-Used (LRU) Least-Frequently-Used (LFU) In order to implement the above policies, we need to develop corresponding functions that process page accesses for a process. That is, for each process, given its page table, a logical page number being referenced and the free frame pool of the process, the functions should determine the memory frame number for the logical page. Also, the functions should modify the page table and the free frame pool appropriately. The details of the functions with respect to the different policies are described below. You need to develop code for these functions that implement the specifications. Place the code in a file called virtual.c. You should include the oslabs.h file.

1 Solutions

See Answer
Using LC-3 Programming Exercise 1 Use .BLKW to set up a remote array of 10 values, starting at memory location x4000, as in lab 3. Now programmatically populate the array with the numbers 0 through 9 (note - NOT the characters '0' through '9'!) – i.e. hard-code just the first value (0), then calculate the rest one at a time, storing them in the array as you go. Remember the proper way of setting a register to 0! After you've stored them all, grab the seventh value (i.e. 6) and store it in R2. Clearly, you can't access this location via a label, so you'll need its actual address. How will you obtain that? And how will you use that address to get the value stored there? As always, step through your program and examine the values as they are stored in the array, and examine the final value stored in R2, to make sure your program works as expected. Exercise 2 You'll notice that Exercise 1 didn't ask you to output to console the array you built. Why not? Because as you know by now, numbers are not characters! So now copy your exercise 1 code into lab4_ex2.asm, and add an output loop, making it output the characters corresponding to the numbers stored in your array. Exercise 3 Let's try another modification of our well-used array program from Exercise 1: This time, instead of calculating and storing the numbers from 0 to 9 in the array, calculate and store the first ten powers of 2, starting with 20 = 1 in array index 0. Finally, grab the seventh value (26) from the array, and store it in R2. In order to do this, you will have to figure out how to calculate powers of 2. Some hints: Mathematically speaking: How do I obtain 2n+1 if I know 2n? What LC-3 operation could I use to multiply a number by 2? As always, place a breakpoint in your program, and step through it, examining the values as they are being stored in the array, and examine the final value stored in R2,  to make sure your program works as expected. Pay attention to both the decimal and hex representations of the values being stored. You already understand that you can't simply output the values in the array to the console “as is”, so we have to manipulate them somehow to turn them into characters. But this time all but the first four are multi-digit numbers when represented as decimal values, so our trick from the last exercise won't work – it can only convert the numbers from 0 to 9 into the single-digit ascii characters '0' through '9'.  Exercise 4 For now, we will instead observe what happens if we attempt to do what we just said can't be done - output the contents of the array "as is", i.e. as if they were ascii codes (which they are not!). Copy your exercise 3 code into your lab4_ex4.asm file, and add a second loop that loads the content of each element of the array into R0 and outputs it to the console using OUT. Now place a breakpoint at the start of your display loop and step through it: You will need to keep an eye on the Console to understand what is going on!! Please add comments!!!

1 Solutions

See Answer
Part VI: Compare algorithms, and try to speed things up! In this last part of the project, you will write code to facilitate the comparison of the different state-space search algorithms, and you will also attempt to speed things up so that your code can more easily solve puzzles that require many moves. Your tasks In eight_puzzle.py, write a function named process_file(filename, algorithm, param). It should take the following three inputs: a string filename specifying the name of a text file in which each line is a digit string for an eight puzzle. For example, here is a sample file containing 10 digit strings, each of which represents an eight puzzle that can be solved in 10 moves: 10_moves.txt a string algorithm that specifies which state-space search algorithm should be used to solve the puzzles ('random', 'BFS', 'DFS', 'Greedy', or 'A*') a third input param that allows you to specify a parameter for the searcher – either a depth limit (for the uninformed search algorithms) or a choice of heuristic function (for the informed search algorithms). Your function should open the file with the specified filename for reading, and it should use a loop to process the file one line at a time. We discussed line-by-line file processing earlier in the semester. For each line of the file, the function should: obtain the digit string on that line (stripping off the newline at the end of the line) take the steps needed to solve the eight puzzle for that digit string using the algorithm and parameter specified by the second and third inputs to the function report the number of moves in the solution, and the number of states tested during the search for a solution In addition, the function should perform the cumulative computations needed to report the following summary statistics after processing the entire file: number of puzzles solved average number of moves in the solutions average number of states tested For example: >>> process_file('10_moves.txt', 'BFS', -1) 125637084: 10 moves, 661 states tested 432601785: 10 moves, 1172 states tested 025318467: 10 moves, 534 states tested 134602785: 10 moves, 728 states tested 341762085: 10 moves, 578 states tested 125608437: 10 moves, 827 states tested 540132678: 10 moves, 822 states tested 174382650: 10 moves, 692 states tested 154328067: 10 moves, 801 states tested 245108367: 10 moves, 659 states tested solved 10 puzzles averages: 10.0 moves, 747.4 states tested (In this case, because BFS finds optimal solutions, every solution has the same number of moves, but for other algorithms this won’t necessarily be the case.) Notes/hints: You can model your code for solving a given puzzle on the code that we’ve given you in the eight_puzzle driver function. In particular, you can emulate the way that this function: creates Board and State objects for the initial state calls the create_searcher helper function to create the necessary type of searcher object, and handles the possible return value of None from that function Important: Make sure to create a new searcher object for each puzzle (i.e., for each line of the file). Otherwise, the searcher will still have information inside it from previous searches when it starts to solve a new puzzle. When calling the searcher object’s find_solution method, you should do so as follows: soln = None try: soln = searcher.find_solution(s) except KeyboardInterrupt: print('search terminated, ', end='') Making the call to find_solution() in this way will allow you to terminate a search that goes on too long by using Ctrl-C. In such cases, soln will end up with a value of None (meaning that no solution was found), and you should make sure to properly handle such cases. You should not use a timer in this function. This function should not return a value. Testing your function: If you haven’t already done so, download the 10_moves.txt file, putting it in the same folder as the rest of your files for the project. Try to reproduce the results for BFS shown above. Try applying Greedy Search to the same file. You may find that it takes Greedy a very long time to solve some of the puzzles, at least when using h1 (the num-misplaced-tiles heuristic). If this happens, use Ctrl-C as needed to terminate the problematic searches. When we processed 10_moves.txt using our implementation of Greedy, we ended up using Ctrl-C to terminate two of the searches: >>> process_file('10_moves.txt', 'Greedy', h1) 125637084: 204 moves, 658 states tested 432601785: 12 moves, 13 states tested 025318467: search terminated, no solution 134602785: 78 moves, 221 states tested 341762085: 26 moves, 339 states tested 125608437: 162 moves, 560 states tested 540132678: 68 moves, 749 states tested 174382650: search terminated, no solution 154328067: 10 moves, 16 states tested 245108367: 48 moves, 49 states tested solved 8 puzzles averages: 76.0 moves, 325.625 states tested It’s also possible for none of the puzzles to have a solution, and you should handle that situation appropriately. For example, this can happen if you impose a depth limit that is too small: >>> process_file('10_moves.txt', 'DFS', 5) # depth limit of 5 125637084: no solution 432601785: no solution 025318467: no solution 134602785: no solution 341762085: no solution 125608437: no solution 540132678: no solution 174382650: no solution 154328067: no solution 245108367: no solution solved 0 puzzles Note that you can’t compute any averages in this case, so you shouldn’t print the averages line in the results. Create a plain-text file named results.txt, and put your name and email (and those of your partner, if any) at the top of the file. Conduct an initial set of experiments in which you try all of the algorithms on the puzzles in the following files: 5_moves.txt - puzzles that can be solved in 5 moves 10_moves.txt - puzzles that can be solved in 10 moves 15_moves.txt - puzzles that can be solved in 15 moves More specifically, you should run the following algorithms on each file: random BFS DFS with a depth limit of 20 DFS with a depth limit of 50 Greedy (using h1 – the num-misplaced-tiles heuristic) A* (using the same heuristic) Note that it may be necessary to use Ctrl-C to terminate searches that take too much time. You might want to pick a given amount of time (e.g., 30 seconds or 1 minute), and use Ctrl-C to terminate any search that doesn’t complete in that time. In your results.txt file, create three tables that summarize the results of these initial experiments. Use a separate table for each file’s results. For example, the results for 5_moves.txt should be put into a table that looks like this: puzzles with 5-move optimal solutions ------------------------------------- algorithm num. solved avg. moves avg. states tested ------------------------------------------------------------------------ random BFS DFS (depth limit 20) DFS (depth limit 50) Greedy Search (using h1) A* (using h1) Below these tables, write a short reflection (one or two paragraphs) in which you summarize the key points that are illustrated by the results. For example, you might discuss whether the algorithms produce reliably optimal results, and how much work they do in finding a solution. There’s no one correct reflection; we just want to see that you have reflected intelligently on the results and drawn some conclusions. Even informed search algorithms like Greedy Search and A* can be slow on problems that require a large number of moves. This is especially true if the heuristic function used by the algorithm doesn’t do a good enough job of estimating the remaining cost to the goal. Our h1 heuristic function–which uses the number of misplaced tiles as the estimate of the remaining cost–is one example of a less than ideal heuristic. For example, consider the following two puzzles: Both of them have 4 misplaced tiles (the ones displayed in red), but the puzzle on the left can be solved in 4 moves, whereas the puzzle on the right requires 24 moves! Clearly, it would be better if our heuristic could do a better job of distinguishing between these two puzzles. Come up with at least one alternate heuristic, and implement it as part of your classes for informed searchers (GreedySearcher and AStarSearcher). To do so, you should take the following steps: As needed, add one or more methods to the Board class that will be used by your new heuristic function. (Adding a new method to the Board class is not required, but it can be helpful to add one so that the heuristic function can obtain the information needed for its estimate.) Add your new heuristic function(s) to searcher.py, and follow these guidelines: Continue the numbering scheme that we established for the earlier heuristic functions. Call your first alternate heuristic function h2, your next heuristic function (if any) h3, etc. Make sure that each heuristic function is a regular function, not a method. In addition, make sure that it takes a single State object and returns an integer. When conducting tests using a new heuristic function, use its name in the same ways that you would use h0 or h1. For example: >>> g = GreedySearcher(h2) >>> eight_puzzle('142358607', 'Greedy', h2) >>> process_file('15_moves.txt', 'A*', h2) You are welcome to design more than one new heuristic function, although only one is required. When testing and refining your heuristic(s), you can use the files that we provided above, as well as the following files: 18_moves.txt - puzzles that can be solved in 18 moves 21_moves.txt - puzzles that can be solved in 21 moves 24_moves.txt - puzzles that can be solved in 24 moves 27_moves.txt - puzzles that can be solved in 27 moves. Compare the performance of Greedy and A* using the h1 heuristic to their performance using your new heuristic(s). Keep revising your heuristic(s) as needed until you are satisfied. Ideally, you should see the following when using your new heuristic(s): Both Greedy and A* are able to solve puzzles more quickly – testing fewer states on average and requiring fewer searches to be terminated. Greedy Search is able to find solutions requiring fewer moves. A* continues to find optimal solutions. (If it starts finding solutions with more than the optimal number of moves, that probably means that your heuristic is overestimating the remaining cost for at least some states.) Although you are welcome to keep more than one new heuristic function, we will ultimately test only one of them. Please adjust your code as needed so that the heuristic function that you want us to test is named h2. Also, please make sure that we will still be able to test the num-misplaced-tiles heuristic if we specify h1 for the heuristic. In your results.txt file, briefly describe how your best new heuristic works: heuristic h2 ------------ This heuristic ... If your code includes other alternate heuristics, you are welcome to describe them as well, although doing so is not required. Conduct a second set of experiments in which you try both your new heuristic function(s) and the h1heuristic function on the puzzles in the four new files provided above (the ones that require 18, 21, 24, and 27 moves). In your results.txt file, create four tables that summarize the results of these experiments. Use a separate table for each file’s results. For example, the results for 18_moves.txt should be put into a table that looks like this: puzzles with 18-move optimal solutions -------------------------------------- algorithm num. solved avg. moves avg. states tested ---------------------------------------------------------------------- Greedy (heuristic h1) Greedy (heuristic h2) # Greedy with any other heuristics A* (heuristic h1) A* (heuristic h2) # Greedy with any other heuristics Below these tables, write a short reflection (one or two paragraphs) in which you summarize the key points that are illustrated by the results. Here again, there is no one correct reflection; we just want to see that you have reflected intelligently on the results and drawn some conclusions.

1 Solutions

See Answer
You are tasked with designing a system to supply energy to a new block of 30 ‘eco’ flats, providing heat (150 kWh per flat) and electricity (at a constant rate of 5 KW per flat) for one day (24 hours). Electricity will be supplied by proton exchange membrane fuel cells (PEMFCs), fed by hydrogen, and operating under standard conditions (P = 1atm, T = 25°C), with a fuel utilisation of 80% and oxygen utilisation of 100%. For the given property, it would be appropriate to install commercial stacks of 15 individual cells, arranged in series. Hydrogen gas necessary for the 1-day operation is stored in 100L tanks, at 700 atm and room temperature, T = 25°C. Heat will be delivered by an air-source cascade heat pump system, operating under the vapour-compression refrigeration cycle, between temperatures of 10°C (assume air temperature is stable) and 100°C, and using water as the working fluid. The cascade system has two cycles, and an intermediate temperature of 46°C. You are requested to prepare a report for the client, containing the following sections and information: Section 1. Calculations and estimations of the energy parameters, justifying assumptions made. In the fuel cells subsystem: (i) Minimum number of hydrogen tanks required for storage. [20 marks] (ii) Overall subsystem efficiency. [10 marks] In the heat pump subsystem: (i) Sketch of the vapour-compression refrigeration cycle (T-S diagram) [5 marks (ii) Work done at the compressor. [15 marks] (iii) Overall subsystem efficiency. [10 marks]  

1 Solutions

See Answer
help 1. Value Iteration for Markov Decision Process ద Bookmark this page Homework due Aug 17, 2022 14:59 +03 Consider the following problem through the lens of a Markov Decision Process (MDP), and answer questions 1 - 3 accordingly. Damilola is a soccer player for the ML United under-15s who is debating whether to sign for the NLP Albion youth team or the Computer Vision Wanderers youth team. After three years, signing for NLP Albion has two possibilities: He will still be in the youth team, earning 10,000 (60\% chance), or he will make the senior team and earn 70,000 (40\% chance). Lastly, he is assured of making the Computer Vision Wanderers senior team after three years, with a salary of 37,000. Q2 1 point possible (graded) Let us now assume that Damilola cares about the utility derived from the salary as opposed to the salary $S$ itself. And his utility function, which baffles economists, is given by Utility, $U=\Psi S^{2}+\zeta$ where $\Psi, \zeta>0$, and $\Psi$ \& are constants. In this scenario, the optimal policy $\pi^{*}$ (ML United under-15s) would be to sign for NLP Albion. True False Submit You have used 0 of 1 attempt Save Q3 1 point possible (graded) There are 3 unique states defined in total in this setting. True False b 3 points possible (graded) If we initialize the value function with 0 , enter the value of state $B$ after: one value iteration, $V_{B 1}^{*}$ two value iterations, $V_{B 2}^{*}$ infinite value iterations, $V_{B}^{*}$ Submit You have used 0 of 3 attempts Save C 1 point possible (graded) Select all that are true In an MDP, the optimal policy for a given state $s$ is unique The problem of determining the value of a state is solved recursively by value iteration algorithm For a given MDP, the value function $V^{*}(s)$ of each state is known a priori $V^{*}(s)=\sum_{s^{\prime}} T\left(s, a, s^{\prime}\right)\left[R\left(s, a, s^{\prime}\right)+\gamma V^{*}\left(s^{\prime}\right)\right]$ $Q^{*}(s, a)=\sum_{s^{\prime}} T\left(s, a, s^{\prime}\right)\left[R\left(s, a, s^{\prime}\right)+\gamma V^{*}\left(s^{\prime}\right)\right]$

1 Solutions

See Answer
facilitates a catalog of books for its faculty and students. Several books are available for the students and faculty members. Catalog has a pool of books of different authors. The faculty members and students can access books depending on the availability. Each book has a unique code.   You should provide methods to support the following operations:   The book administrator can add new books and its information. The book administrator can remove and update the information of the faculty or student who borrowed the books. The faculty and students can inquire about the specific books including the author information. The faculty and students can request for a new book. The faculty and the students can raise a complain about the non-availability of the books or any other. The book administrator can generate the reports of the book based on: Book title Book Author Book ISBN The system should be able to handle other kinds of reports to be generated in the future.     You may create three classes, one for Book, the second for Administrator and the third for Users. Use the linked list and the files for database.[reference from class exercise]   Project Output Screen: When I run the project, it should look like the following: Please select the user: Administrator User After selecting administrator, the following menu should be displayed: Add new books and its information in the beginning, at the end and as per the position required. Add the information of the user who borrowed the book Delete a particular book and its information as per its “Book ISBN” Inquire about the specific books including the author information. Check the number of books available. Generate the reports of the book based on: Book title Book Author Book ISBN Note: Add the book information in files After selecting user, the following menu should be displayed:   Inquire about the specific books including the author information. Request for a new book (This is not a linked list operation) Complain if any (This is not a linked list operation)   Now, after I see the above menu, I will make a selection. Based on my selection, your program should call some methods to carry out the operation needed for that selected task. After that operation is performed, you should show me the above mentioned selection menu again. This should continue in an infinite loop until I want to exit the program. facilitates a catalog of books for its faculty and students. Several books are available for the students and faculty members. Catalog has a pool of books of different authors. The faculty members and students can access books depending on the availability. Each book has a unique code.   You should provide methods to support the following operations:   The book administrator can add new books and its information. The book administrator can remove and update the information of the faculty or student who borrowed the books. The faculty and students can inquire about the specific books including the author information. The faculty and students can request for a new book. The faculty and the students can raise a complain about the non-availability of the books or any other. The book administrator can generate the reports of the book based on: Book title Book Author Book ISBN The system should be able to handle other kinds of reports to be generated in the future.     You may create three classes, one for Book, the second for Administrator and the third for Users. Use the linked list and the files for database.[reference from class exercise]   Project Output Screen: When I run the project, it should look like the following: Please select the user: Administrator User After selecting administrator, the following menu should be displayed: Add new books and its information in the beginning, at the end and as per the position required. Add the information of the user who borrowed the book Delete a particular book and its information as per its “Book ISBN” Inquire about the specific books including the author information. Check the number of books available. Generate the reports of the book based on: Book title Book Author Book ISBN Note: Add the book information in files After selecting user, the following menu should be displayed:   Inquire about the specific books including the author information. Request for a new book (This is not a linked list operation) Complain if any (This is not a linked list operation)   Now, after I see the above menu, I will make a selection. Based on my selection, your program should call some methods to carry out the operation needed for that selected task. After that operation is performed, you should show me the above mentioned selection menu again. This should continue in an infinite loop until I want to exit the program.

1 Solutions

See Answer
IN JAVA PLEASE. In this project we are going to create a class Sedan. A sedan is a four wheeled automobile with 4 doors. Each sedan can have a different gas tank that has a fixed capacity, and it can contain certain number of gallons of fuel. We will assume that each sedan can get a different fixed constant miles per gallon, and there is an EPA standard miles per gallon for all sedans that gets updates every year. The sedan also has a mileage. Right out of the factory, the sedan has a full tank of gas and zero mileage. CLASS Sedan: Create the following variables in the class, and determine the type, if static, if final number of wheels number of doors epa mpg – make this private tank capacity current fuel level – make this private mpg mileage – make this private Create a non default c’tor for sedan public Sedan(double ptankCapacity, double mpg) full tank zero mileage print warning to if it does not meet the current EPA requirements Create a default c’tor for sedan that calls the non default c’tor with the folloing tank = 10 mpg = EPA mpg Define a toString method that prints basic stats of the sedan in the example below public String toString() Define a drive method public double drive(double miles) Drive either the specified miles or what the fuel allows Deduct fuel according to miles driven Return actual miles driven Define a pump fuel method public double pumpFuel(double gallons) Pump with the specified gallons of what the fueld tank allows Return actual fuel pumped Overload a pump fuel method public double pumpFuel() Fill up tank Return actual fuel pumped setEPA public static boolean setEPA(double newEPAmpg) Sets the new EPA mpg Return true if new EPA mpg is > 0; else do not set and return false getEPA get the current EPA mpg getMileage get the current mileage note we cannot set the mileage directly because this is illegal! getFuel get the current fuel equals determine if two sedans are equal – justify your answer CLASS SedanTest: Create a single global variable static Scanner sc = new Scanner(System.in); Define an utility method to read a non-negative number from the Scanner sc static double readNNegDouble(String s) Print the prompt s Read a double from Scanner sc Return if the double is > 0 Print error if no good and loop Define a printMenu method Define a main method Set EPA mpg to 25 Create scanner Create default sedan s1 Print it Read in tank capacity and mpg for sedan 2 – using the utility method readNNegDouble Create and print sedan s2 Do loop that operates on s2 printMenu get input string create switch statement to handle drive print actual miles driven pump fuel print actual gallons pumped pump up print actual gallons pumped change epa sedan stats quit print program terminated Sample Output: Sedan 1 Sedan 1 created. Sedan with 4 wheels and 4 doors, with 10.0 gallon fuel tank and 10.0 gallons fuel, with 0.0 mileage, and with 25.0 mpg meeting the EPA mpg of 25.0. Sedan 2 Enter tank capacity: -1 ERROR - input a non-negative number Enter tank capacity: 10 Enter MPG: -5 ERROR - input a non-negative number Enter MPG: 25 Sedan with 4 wheels and 4 doors, with 10.0 gallon fuel tank and 10.0 gallons fuel, with 0.0 mileage, and with 25.0 mpg meeting the EPA mpg of 25.0. Sedan 2 created. ------------- Menu ------------- (D)rive (P)ump fuel Pump (U)p Change (E)PA Sedan (S)tats (Q)uit ------------- d Enter miles: 100 100.0 actual miles driven. ------------- Menu ------------- (D)rive (P)ump fuel Pump (U)p Change (E)PA Sedan (S)tats (Q)uit ------------- p Enter gallons: 50 4.0 actual gallons pumped. ------------- Menu ------------- (D)rive (P)ump fuel Pump (U)p Change (E)PA Sedan (S)tats (Q)uit ------------- d Enter miles: 1000 250.0 actual miles driven. ------------- Menu ------------- (D)rive (P)ump fuel Pump (U)p Change (E)PA Sedan (S)tats (Q)uit ------------- u 10.0 actual gallons pumped. ------------- Menu ------------- (D)rive (P)ump fuel Pump (U)p Change (E)PA Sedan (S)tats (Q)uit ------------- d Enter miles: 200 200.0 actual miles driven. ------------- Menu ------------- (D)rive (P)ump fuel Pump (U)p Change (E)PA Sedan (S)tats (Q)uit ------------- s Sedan with 4 wheels and 4 doors, with 10.0 gallon fuel tank and 2.0 gallons fuel, with 550.0 mileage, and with 25.0 mpg meeting the EPA mpg of 25.0. ------------- Menu ------------- (D)rive (P)ump fuel Pump (U)p Change (E)PA Sedan (S)tats (Q)uit ------------- e Enter EPA mpg: 30 EPA mpg updated. ------------- Menu ------------- (D)rive (P)ump fuel Pump (U)p Change (E)PA Sedan (S)tats (Q)uit ------------- s Sedan with 4 wheels and 4 doors, with 10.0 gallon fuel tank and 2.0 gallons fuel, with 550.0 mileage, and with 25.0 mpg not meeting the EPA mpg of 30.0. ------------- Menu ------------- (D)rive (P)ump fuel Pump (U)p Change (E)PA Sedan (S)tats (Q)uit ------------- q Program Terminated.

1 Solutions

See Answer

1 Solutions

See Answer
PMU facilitates a catalog of books for its faculty and students. Several books are available for the students and faculty members. • Catalog has a pool of books of different authors. • The faculty members and students can access books depending on the availability. • Each book has a unique code. You should provide functions to support the following operations: 1. The book administrator can add new books and its information. 2. The book administrator can remove and update the information the books. 3. The faculty and students can inquire about the specific books including the author information. 4. The faculty and students can request for a new book. 5. The book administrator can update the requests or new requirements from the faculty or the students. 6. The faculty and the students can raise a complain about the non-availability of the books or any other. 7. The book administrator can generate the reports of the book based on: a. Book title b. Book Author c. Book ISBN 8. The system should be able to handle other kinds of reports to be generated in the future. You should create three classes, one for Book, the second for Administrator and the third for Users. Use the linked list and the files for database. NO arraylist. Must use linkedlist and Java FileWriter Project Output Screen: When I run the project, it should look like the following: Please select the user: 1. Administrator 2. User After selecting administrator, the following menu should be displayed: • Add new books and its information. • Delete the information of the books. • Update the requests or new requirements from the faculty or the students. • Generate the reports of the book based on: a. Book title b. Book Author c. Book ISBN After selecting user, the following menu should be displayed: • Inquire about the specific books including the author information. • Request for a new book • Complain if any Now, after I see the above menu, I will make a selection. Based on my selection, your program should call some function to carry out the operation needed for that selected task. After that operation is performed, you should show me the above mentioned selection menu again. This should continue in an infinite loop until I want to exit the program.

1 Solutions

See Answer
****IN C PLEASE NOT C++**** ======================== 17.12 LAB*: Program: Playlist Instructor note: Function Prototypes void CreatePlaylistNode(PlaylistNode* thisNode, char[], char[], char[], int, PlaylistNode* nextNode); void InsertPlaylistNodeAfter(PlaylistNode* thisNode, PlaylistNode* newNode); void SetNextPlaylistNode(PlaylistNode* thisNode, PlaylistNode* newNode); PlaylistNode* GetNextPlaylistNode(PlaylistNode* thisNode); void PrintPlaylistNode(PlaylistNode* thisNode); You will be building a linked list. Make sure to keep track of both the head and tail nodes. (1) Create three files to submit. PlaylistNode.h - Struct definition and related function declarations PlaylistNode.c - Related function definitions main.c - main() function Build the PlaylistNode class per the following specifications. Note: Some functions can initially be function stubs (empty functions), to be completed in later steps. Private data members char uniqueID[50] char songName[50] char artistName[50] int songLength PlaylistNode* nextNodePtr Related functions CreatePlaylistNode() (1 pt) InsertPlaylistNodeAfter() (1 pt) Insert a new node after node SetNextPlaylistNode() (1 pt) Set a new node to come after node GetNextPlaylistNode() Return location pointed by nextNodePtr PrintPlaylistNode() Ex. of PrintPlaylistNode output: Unique ID: S123 Song Name: Peg Artist Name: Steely Dan Song Length (in seconds): 237 (2) In main(), prompt the user for the title of the playlist. (1 pt) Ex: Enter playlist's title: JAMZ (3) Implement the PrintMenu() function. PrintMenu() takes the playlist title as a parameter and outputs a menu of options to manipulate the playlist. (1 pt) Ex: JAMZ PLAYLIST MENU a - Add song r - Remove song c - Change position of song s - Output songs by specific artist t - Output total time of playlist (in seconds) o - Output full playlist q - Quit (4) Implement the ExecuteMenu() function that takes 3 parameters: a character representing the user's choice, a playlist title, and the pointer to the head node of a playlist. ExecuteMenu() performs the menu options (described below) according to the user's choice, and returns the pointer to the head node of the playlist.(1 pt) (5) In main(), call PrintMenu() and prompt for the user's choice of menu options. Each option is represented by a single character. If an invalid character is entered, continue to prompt for a valid choice. When a valid option is entered, execute the option by calling ExecuteMenu() and overwrite the pointer to the head node of the playlist with the returned pointer. Then, print the menu, and prompt for a new option. Continue until the user enters 'q'. Hint: Implement Quit before implementing other options. (1 pt) Ex: JAMZ PLAYLIST MENU a - Add song r - Remove song c - Change position of song s - Output songs by specific artist t - Output total time of playlist (in seconds) o - Output full playlist q - Quit Choose an option: (6) Implement "Output full playlist" menu option in ExecuteMenu(). If the list is empty, output: Playlist is empty (3 pts) Ex: JAMZ - OUTPUT FULL PLAYLIST 1. Unique ID: SD123 Song Name: Peg Artist Name: Steely Dan Song Length (in seconds): 237 2. Unique ID: JJ234 Song Name: All For You Artist Name: Janet Jackson Song Length (in seconds): 391 3. Unique ID: J345 Song Name: Canned Heat Artist Name: Jamiroquai Song Length (in seconds): 330 4. Unique ID: JJ456 Song Name: Black Eagle Artist Name: Janet Jackson Song Length (in seconds): 197 5. Unique ID: SD567 Song Name: I Got The News Artist Name: Steely Dan Song Length (in seconds): 306 (7) Implement the "Add song" menu option in ExecuteMenu(). New additions are added to the end of the list. (2 pts) Ex: ADD SONG Enter song's unique ID: SD123 Enter song's name: Peg Enter artist's name: Steely Dan Enter song's length (in seconds): 237 (8) Implement the "Remove song" menu option in ExecuteMenu(). Prompt the user for the unique ID of the song to be removed.(4 pts) Ex: REMOVE SONG Enter song's unique ID: JJ234 "All For You" removed. (9) Implement the "Change position of song" menu option in ExecuteMenu(). Prompt the user for the current position of the song and the desired new position. Valid new positions are 1 - n (the number of nodes). If the user enters a new position that is less than 1, move the node to the position 1 (the head). If the user enters a new position greater than n, move the node to position n (the tail). 6 cases will be tested: Moving the head node (1 pt) Moving the tail node (1 pt) Moving a node to the head (1 pt) Moving a node to the tail (1 pt) Moving a node up the list (1 pt) Moving a node down the list (1 pt) Ex: CHANGE POSITION OF SONG Enter song's current position: 3 Enter new position for song: 2 "Canned Heat" moved to position 2 (10) Implement the "Output songs by specific artist" menu option in ExecuteMenu(). Prompt the user for the artist's name, and output the node's information, starting with the node's current position. (2 pt) Ex: OUTPUT SONGS BY SPECIFIC ARTIST Enter artist's name: Janet Jackson 2. Unique ID: JJ234 Song Name: All For You Artist Name: Janet Jackson Song Length (in seconds): 391 4. Unique ID: JJ456 Song Name: Black Eagle Artist Name: Janet Jackson Song Length (in seconds): 197 (11) Implement the "Output total time of playlist" menu option in ExecuteMenu(). Output the sum of the time of the playlist's songs (in seconds). (2 pts) Ex: OUTPUT TOTAL TIME OF PLAYLIST (IN SECONDS) Total time: 1461 seconds

1 Solutions

See Answer