You are on page 1of 4
Question Text: Title: Course Management You are a course manager of an organization. Create a console application to do certain operations based on the constraints as given below. Create a class Course with the below attributes: course_id —int (automatically generated, starting from 101 and unique) course_name - string course_available_date - Date course_duration — int (in minutes) course_rewards — int Where course_id is the Id of course, course_name is the name of the course, course_available_date is the date the course is available from, course_duration is the total duration in minutes and course_rewards is the rewards associated with the course. Create class CourseManagement with attributes & methods given below: 1. Allist of type course named courses 2. Amethod named FindCoursesBasedOnCourseName, which takes a string argument as course name and returns the list of Course whose course_name contains course name provided as argument. This method will return the list of course in ascending order of course id. For Example course_name of an course is “Beginners guide to C#” and provided argument can be "C#” then you need to add course into course list. 3. Amethod named FindAvgRewardsFromGivenDate, which takes a date argument and return the average of rewards from the course list where date is greater than the provided date as argument. 4, Amethod named AddCourse. which takes necessary parameters to call course constructor and creates a new course. It should return the course_Id of the created course. Make all the attributes private. Generate necessary public properties. Create a constructor for Course class which takes parameters course_name, course_available_date, course_duration and course_rewards then assigns the values for all of the attributes. Given a CourseManagement object and a list of Course objects, write code to perform the following tasks: 1. Call FindCoursesBasedOnCourseName method. If no course found with given course name, print “No course found with given course name” Otherwise print “ : , , “of returned Courses where course duration should be in hour and minute format. For Example "101 : Beginners guide to Cl, 11/1/2020, 1 hour 20 minutes”. 2. Call FindAvgRewardsFromGivenDate method. If no course is found greater than the date given as argument i.e. average is 0, print “No course found after given date” Otherwise print the returned average as itis. 3, Take input from user and call AddCourse method. The course duration and rewards should be greater than 0 . print “Duration invalid” if it not greater than zero. Print "Rewards invalid” ifit not greater than zero. If all values are correct then print “The course has been added”. Note : + All the comparison are case insensitive. You can use/refer the below given sample input and output to verify your solution using ' Test against Custom Input ' option in Hackerrank. Sample Input (below) description: The 1st input taken in the main section is the number of Course objects to be added to the list of CourseManagement. The next set of inputs are course_name, course_available_date, course_duration and course_rewards for each Course object taken one after other and is repeated for number of Course objects given in the first line of input. The last line of input is the choice in the sample input represents the choice , supplied as an argument to call different code. Consider below sample input and output to test your code: Sample Input 1 4 Beginners guide to C# 11/1/2020 90 5 Intermediate guide to CH : class concept 12/7/2020 60 10 Advanced Ling Concepts 6/25/2020 120 5 Increase your coding speed : Visual Studio 41/2020 30 5 1 ci Output 101 : Beginners guide to C#, 11/1/2020, 1 hour 30 minutes 102 : Intermediate guide to Cit: class concept, 12/7/2020, 1 hour Sample Input 2 4 Beginners guide to C# 11/1/2020 90 5 Intermediate guide to CH: class concept 12/7/2020 60 10 Advanced Ling Concepts 5/25/2020 120 15 Increase your coding speed : Visual Studio 1/1/2020 30 5 2 1/2/2020 Output 10

You might also like