Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Write a C++ program to implement the Multilevel Inheritance on the following. Create the class Student with Student number (snum), Student (sname) and
1. Write a C++ program to implement the Multilevel Inheritance on the following. Create the class Student with Student number (snum), Student (sname) and degree (deg) as data members and the member functions as: getstud(): gets snum, sname and deg. showstud(): prints snum, sname and deg Create the class Marks with marks in three subjects m1, m2, m3 as data members and the member functions as: getmark(): gets m1, m2 and m3 showmark(): prints m1, m2 and m3 Derive the class Marks from the class Student in public mode > Create the class Result with total marks (total), average (avg) and grade (gr) as data members and the member functions as: Calresult(): Calculate the total marks and displays the average CalGrade(): Calculates Grade and displays the Grade. If Average (60-100) If Average (40-59): If Average (0-39): grade A grade B grade C Showresult():displays avg, tot and gr Derive the class Result from the class Mark in public mode. 2. Write a C++ program to read two time objects t1, t2 in the form of years and weeks by encapsulating them in a class time. Add these two time objects t1 and t2 by sending the object t2 as an argument to addtime( ) and then return the result to another time object t3 (Note: 1 year =52 weeks)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started