Hi dear i want to solve it In c++ language program
Task 1 Implement the Rational class where its properties and function are illustrated in the UML class diagram. Note: Implement add, subtract, multiply, divide and equal as operator overloading to +, -, *,/, == Rational -numerator: int -denominator: int The numerator of this rational number. The denominator of this rational number. Creates a rational number with numerator 0 and denominator 1. Creates a rational number with specified numerator and denominator Returns the numerator of this rational number. Returns the denominator of this rational number. Returns the addition of this rational with another. +Rational +Rational (numerator: int, denominator: int) +get Numerator(): int const +getDenominator(): int const +add(secondRational: Rational): Rational const +subtract(secondRational: Rational): Rational const +multiply(secondRational: Rational): Rational const +divide (secondRational: Rational): Rational const +compareTo(secondRational: Rational): int const Returns the subtraction of this rational with another. Returns the multiplication of this rational with another. Returns the division of this rational with another. Returns an int value -1,0, or 1 to indicate whether this rational number is less than, equal to, or greater than the specified number Returns true if this rational number is equal to the specified number. +equals(secondRational: Rational): bool const +intValue(): int const +doubleValue(): double const +toString(): string const Returns the numerator / denominator. Returns the 1.0 * numerator / denominator Returns a string in the form "numerator / denominator." Returns numerator if denominator is 1. Returns the greatest common divisor between n and d. -gcd(n: int, d: int): int Task 2 Implement a Student class that has the following properties Grades: Rational* Credit Hours: int* arr Size //stores the size of both the Grades and Credit Hours Arrays Name: string ID: string calculateGPA(): Rational // it calculates the GPA from the student's grades Overloading << Il prints the information and grades of the user Overloading >> || asks the user for the student name, ID, grades
Task 3 - Construct a main with n students: Take their information (name, ID, array of courses grades, array of courses credit hours, size) from the user Calculate their GPA by: For numerator = Sum of (grade of each course * course credit hours) For Denominator = Sum of credit hours of all courses GPA = Numerator / denominator Display the data of the n students including: Name ID Grade of each course as numerator/denominator and as a double Credit hours of of each course GPA of student
Task 1 Implement the Rational class where its properties and function are illustrated in the UML class diagram. Note: Im
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Task 1 Implement the Rational class where its properties and function are illustrated in the UML class diagram. Note: Im
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!