Page 1 of 1

Practice Questions Q1. Write a public static method that takes 3 float numbers and return a string that has the three nu

Posted: Sat Nov 27, 2021 2:31 pm
by answerhappygod
Practice Questions Q1 Write A Public Static Method That Takes 3 Float Numbers And Return A String That Has The Three Nu 1
Practice Questions Q1 Write A Public Static Method That Takes 3 Float Numbers And Return A String That Has The Three Nu 1 (125.02 KiB) Viewed 75 times
Practice Questions Q1. Write a public static method that takes 3 float numbers and return a string that has the three numbers separated by a space and sorted in ascending order. Q2. Write a class that represents a Student in Computer Science and Engineering department. The class is named "CSEStudent" and has the student name (string) and major (int: 0 for CS and 1 for CE). The class keeps track of the number of CS and CE courses that the student is taking. The class has one constructor that takes a student name and major. • It also has a method to add a course. The course can be for CS students only, or for CE students only, or for both. It just takes an integer i that indicates if the course is CS (zero) or CE (1) or both (2). The method successfully adds the course only if by adding it, the number of courses in the student major will be equal to or more than the number of the courses in the other major. If that's the case, it returns true; otherwise it doesn't add the course and it returns false. It has a method to get the total number of courses added so far. • It has a method to get the total number of CS courses added so far. • It has a method to get the total number of CE courses added so far. Implement that class and also implement a driver class (to test it) that creates 2 CSEStudent objects (for two different students with different majors) and then call a static function (in the driver class) that takes the two objects, adds 5 courses to each object and then prints the total courses in each major for each of them.