Programming Fundamentals Final Exam Programming Fundamentals Final Exam XXXXXXXXXX Problem 1. World Tour You are a world traveller and your next goal is to make a world tour. In order to do that, you...

I need those resolved by 12:00


Programming Fundamentals Final Exam Programming Fundamentals Final Exam 09.08.2020 Problem 1. World Tour You are a world traveller and your next goal is to make a world tour. In order to do that, you have to plan out everything first. To start with, you would like to plan out all of your stops where you will have a break. On the first line you will be given a string containing all of your stops. Until you receive the command "Travel", you will be given some commands to manipulate that initial string. The commands can be: · Add Stop:{index}:{string} – insert the given string at that index only if the index is valid · Remove Stop:{start_index}:{end_index} – remove the elements of the string from the starting index to the end index (inclusive) if both indices are valid · Switch:{old_string}:{new_string} – if the old string is in the initial string, replace it with the new one. (all occurrences) Note: After each command print the current state of the string After the "Travel" command, print the following: "Ready for world tour! Planned stops: {string}" Input / Constraints · JavaScript: you will receive a list of strings Output · Print the proper output messages in the proper cases as described in the problem description Examples Input Output Hawai::Cyprys-Greece Add Stop:7:Rome Remove Stop:11:16 Switch:Hawai:Bulgaria Travel Hawai::RomeCyprys-Greece Hawai::Rome-Greece Bulgaria::Rome-Greece Ready for world tour! Planned stops: Bulgaria::Rome-Greece Follow us: © SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted. Page 1 of 2 Programming Fundamentals Final Exam Programming Fundamentals Final Exam 09.08.2020 Problem 2. Destination Mapper Now that you have planned out your tour, you are ready to go! Your next task is to mark all the points on the map that you are going to visit. You will be given a string representing some places on the map. You have to filter only the valid ones. A valid location is: · Surrounded by "=" or "/" on both sides (the first and the last symbols must match) · After the first "=" or "/" there should be only letters (the first must be upper-case) · The letters must be at least 3 Example: In the string "=Hawai=/Cyprus/=Invalid/invalid==i5valid=/I5valid/=i=" only the first two locations are valid. After you have matched all the valid locations, you have to calculate travel points. They are calculated by summing the lengths of all the valid destinations that you have found on the map. At the end, on the first line print the following: "Destinations: {destinations joined by ', '}". On the second line print "Travel Points: {travel_points}". Input / Constraints · You will recive a string representing the locations on the map · JavaScript: you will receive a single parameter: string Output · Print the messages described above Examples Input Output =Hawai=/Cyprus/=Invalid/invalid==i5valid=/I5valid/=i= Destinations: Hawai, Cyprus Travel Points: 11 ThisIs some InvalidInput Destinations: Travel Points: 0 Follow us: © SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted. Page 1 of 2 Programming Fundamentals Final Exam Programming Fundamentals Final Exam 09.08.2020 Problem 3. Plant Discovery You have now returned from your world tour. On your way you have discovered some new plants and you want to gather some information about them and create an exhibition to see which plant is highest rated. On the first line you will receive a number n. On the next n lines, you will be given some information about the plants that you have discovered in the format: "{plant}<->{rarity}". Store that information, because you will need it later. If you receive a plant more than once, update its rarity. After that until you receive the command "Exhibition" you will be given some of these commands: · Rate: {plant} - {rating} – add the given rating to the plant (store all ratings) · Update: {plant} - {new_rarity} – update the rarity of the plant with the new one · Reset: {plant} – remove all the ratings of the given plant Note: If any of the command is invalid, print "error" After the command "Exhibition" print the information that you have about the plants in the following format: Plants for the exhibition: - {plant_name}; Rarity: {rarity}; Rating: {average_rating formatted to the 2nd digit} … The plants should be sorted by rarity descending, then by average rating descending Input / Constraints · You will recive the input as described above · JavaScript: you will receive a list of strings Output · Print the information about all plants as described above Examples Input Output 3 Arnoldii<->4 Woodii<->7 Welwitschia<->2 Rate: Woodii - 10 Rate: Welwitschia - 7 Rate: Arnoldii - 3 Rate: Woodii - 5 Update: Woodii - 5 Reset: Arnoldii Exhibition Plants for the exhibition: - Woodii; Rarity: 5; Rating: 7.50 - Arnoldii; Rarity: 4; Rating: 0.00 - Welwitschia; Rarity: 2; Rating: 7.00 2 Candelabra<->10 Oahu<->10 Rate: Oahu - 7 Rate: Candelabra - 6 Exhibition Plants for the exhibition: - Oahu; Rarity: 10; Rating: 7.00 - Candelabra; Rarity: 10; Rating: 6.00 Follow us: © SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted. Page 1 of 2
Aug 09, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here