Question: Creating simple classes and instantiating objects. Including attributes and methods to classes. In the blank trinket given, define an empty class named Circle and instantiate

Creating simple classes and instantiating objects. Including attributes and methods to classes.

In the blank trinket given, define an empty class named Circle and instantiate an object of this class.

Include a method named setRadius() to set the attribute radius of Circle. Call this method for the object created in (i).

Include methods to calculate area and perimeter of circle. Call these methods for objects created in (i).

Inheritance. In this activity, we will create a parent class MediaFile and two subclasses, MusicFile and VideoFile, that are related to MediaFile by single inheritance.

In the blank trinket file, create a class MediaFile that has two attributes: title and duration. It has three methods: setTitle, setDuration and play(). Methods setTitle() and setDuration() are used to set the attributes title and duration respectively. The play() method prints a statement in the form: playing file with duration <duration> mins.</p> <p> </p> <p>In the same trinket file, create class MusicFile using its parent class, MediaFile. Class MusicFile also consists of attribute artist that stores the name of the artist. Include a method setArtist() to set attribute artist. play() method of this class prints: playing song <title> by <artist> with duration <duration> mins.</p> <p> </p> <p>In the same trinket file, create class VideoFile using its parent class, MediaFile. Class VideoFile also consists of attribute quality that stores the name of the picture quality (SD, HD, etc). Include a method setQuality() to set attribute quality. play() method of this class prints: playing video <title> in <quality> with duration <duration> mins.</p> <p> </p> <p>Instantiate a MusicFile object. Set appropriate values using its methods and call the play() method.</p> <p> </p> <p>Instantiate a VideoFile object. Set appropriate values using its methods and call the play() method.</p> <p> </p> <p> </p> <p>Using super() method.</p> <p>The given code defines classes rectangle and square. Square inherits a few properties of rectangles. Instantiate a Square object and use the calArea() and calPerimter() methods to display the area and perimeter of the object.</p> <p> </p> <p>class Rectangle: </p> <p> def set(self, length, breadth): </p> <p> self.length=length </p> <p> self.breadth=breadth</p> <p> def calArea(self): </p> <p> return self.length*self.breadth</p> <p> def calPerimeter(self):</p> <p> return 2*(self.length+self.breadth)</p> <p> </p> <p>class Square(Rectangle):</p> <p> def set(self, side):</p> <p> super().set(side, side)</p> <p> </p> <p>The surface area of the cube is equal to 6 times its face area. Face area is the area of the square. Create class Cube by inheriting Square class. Within the class, create a method to calculate the surface area of a cube. Implement super() method in your method.</p> <p> </p> <p>The volume of a cube can be stated as the face area times the side of a cube. Within the class definition of Cube, include a method to calculate volume of a cube. Implement super() function in your method.</p> <p> </p> <p>Instantiate a Cube object and write statements to print its surface area and volume.</p> </div> <div class="question-answer-divider"></div> <section class="answerHolder" itemscope itemtype="http://schema.org/Answer"> <div class="answerHolderHeader"> <h2>Step by Step Solution</h2> <div class="answerReviews"> <div class="starIcon"> </div> </div> </div> <div class="questionProperties"> <p>There are 3 Steps involved in it</p> <div class="cart-flex"> <div class="cart cart1"> 1 Expert Approved Answer </div> </div> </div> <div class="step org_answer"> <span class="view_solution_btn view-solution-btn-cursor"> <strong class="step-heading step-1">Step: 1 <span>Unlock <i class="fa-solid fa-lock"></i></span></strong> </span> <img src="https://www.solutioninn.com/includes/images/document_product_info/blur-text-image.webp" class="blured-ans-image" width="759" height="271" alt="blur-text-image" decoding="async" fetchpriority="high"> <div class="step1Popup"> <span class="heading">Question Has Been Solved by an Expert!</span> <p>Get step-by-step solutions from verified subject matter experts</p> <button class="view_solution_btn step1PopupButton">View Solution</button> </div> </div> <div class="step"> <span class="view_solution_btn view-solution-btn-cursor"> <strong class="accordion step-heading">Step: 2 <span>Unlock <i class="fa-solid fa-lock"></i></span></strong> </span> </div> <div class="step"> <span class="view_solution_btn view-solution-btn-cursor"> <strong class="accordion step-heading">Step: 3 <span>Unlock <i class="fa-solid fa-lock"></i></span></strong> </span> </div> </section> <section class="relatedQuestion"> <h3>Students Have Also Explored These Related Databases Questions!</h3> <div class="relatedQuestionSliderHolder"> <div class="relatedQuestionCart "> <p class="heading">Q: </p> <a class="relatedQuestionText" href="/study-help/questions/csci-160-projo1-spring-2022-project-assignment-1-instructions-due-1614909" > CSCI 160 projo1 Spring 2022 Project Assignment 1 Instructions Due Date: Tuesday, March 1, 2021 @ 11:59 PM Lab Objectives: - Practice creating simple Classes - Declare and instantiate several objects.... </a> </div> <div class="relatedQuestionCart "> <p class="heading">Q: </p> <a class="relatedQuestionText" href="/study-help/questions/1-6-points-which-of-the-following-is-a-legal-7001667" > 1. (6 points) Which of the following is a legal way to declare and create an array of 10 String objects? a. String s = new String(10); b. String[10] s = new String; c. String[ ] s = new String[10];... </a> </div> <div class="relatedQuestionCart "> <p class="heading">Q: </p> <a class="relatedQuestionText" href="/study-help/questions/this-is-week-3s-discussion-requirement-in-this-discussion-you-13566823" > This is week 3's discussion requirement: In this Discussion, you will practice creating a test plan for a Java class. Assume you are working for ABC Bank Corporation and have been assigned a project... </a> </div> <div class="relatedQuestionCart "> <p class="heading">Q: </p> <a class="relatedQuestionText" href="/study-help/questions/myshop-is-an-online-shop-which-allows-users-to-download-17795514" > MyShop is an online shop which allows users to download mobile applications (APPs) and publications like e-books and digital magazines. Applications and publication items in the MyShop are either... </a> </div> <div class="relatedQuestionCart "> <p class="heading">Q: </p> <a class="relatedQuestionText" href="/study-help/questions/can-someone-please-help-me-make-this-run-i-dont-12334685" > Can someone please help me make this run? I don't understand why it is not //AssignReadString public class AssignReadString { } import java.awt.image.BufferedImageFilter; import... </a> </div> <div class="relatedQuestionCart "> <p class="heading">Q: </p> <a class="relatedQuestionText" href="/study-help/questions/can-someone-help-make-this-java-file-run-the-code-12368577" > Can someone help make this java file run? The code is probable the main issue I am having //AssignReadString public class AssignReadString { } import java.awt.image.BufferedImageFilter; import... </a> </div> <div class="relatedQuestionCart "> <p class="heading">Q: </p> <a class="relatedQuestionText" href="/study-help/questions/please-help-with-this-text-below-bcs-101-programming-12434823" > Please help with this. Text below BCS 101 - Programming Concepts and Problem Solving This course will provide an introduction to programming logic and problem solving techniques using different... </a> </div> <div class="relatedQuestionCart "> <p class="heading">Q: </p> <a class="relatedQuestionText" href="/study-help/questions/objective-create-a-java-program-to-develop-skills-implementing-java-8384030" > Objective: Create a Java program to develop skills implementing Java syntax, including: -Compile and run a simple program, -Design class definitions Declare class variables -Create class instances... </a> </div> <div class="relatedQuestionCart "> <p class="heading">Q: </p> <a class="relatedQuestionText" href="/study-help/questions/for-this-lab-you-are-to-create-a-class-that-13783060" > For this lab, you are to create a class that implements a dictionary (associative array, hash table), that associates Strings with doubles. It should deal with collisions by chaining (using linked... </a> </div> <div class="relatedQuestionCart "> <p class="heading">Q: </p> <a class="relatedQuestionText" href="/study-help/questions/you-may-use-any-java-api-class-you-may-use-12394594" > You may use any Java API class. You may use Scanner, InputStreamReader, or any other class that you wish for keyboard input. The goal of this assignment is to write a program that manages an email... </a> </div> <div class="relatedQuestionCart "> <p class="heading">Q: </p> <a class="relatedQuestionText" href="/the-exhaust-temperature-of-heat-engine-is-230oc.-what" > The exhaust temperature of a heat engine is 230oC. What must be the high temperature if the Carnot efficiency is to be 28%? </a> </div> <div class="relatedQuestionCart "> <p class="heading">Q: </p> <a class="relatedQuestionText" href="/lan-an-accounting-major-and-pat-a-marketing-major-are" > Lan, an accounting major, and Pat, a marketing major, are watching a Matlock rerun on late-night TV. Of course, there is a murder and the suspect wants to hire Matlock as the defense attorney.... </a> </div> <div class="relatedQuestionCart "> <p class="heading">Q: </p> <a class="relatedQuestionText" href="/study-help/questions/a-medical-practice-invests-moncy-in-a-five-year-27880274" > A medical practice invests moncy in a five - year treasury note with a 3 % interest rate. Three years later, the penctice needs money and sells the note. Which of the following will most likely... </a> </div> <div class="relatedQuestionCart "> <p class="heading">Q: </p> <a class="relatedQuestionText" href="/study-help/questions/question-1-9-which-of-the-following-is-an-area-19077935" > Question 1 9 Which of the following is an area that state departments of insurance review before allowing a health plan to sell insurance in the state? ( There may b than one answer. ) Medical loss... </a> </div> <div class="relatedQuestionCart "> <p class="heading">Q: </p> <a class="relatedQuestionText" href="/study-help/intercultural-communication/2-identify-the-ways-language-works-to-help-people-communicate-2117369" > 2. Identify the ways language works to help people communicate the five functional communication competencies </a> </div> <div class="relatedQuestionCart "> <p class="heading">Q: </p> <a class="relatedQuestionText" href="/study-help/intercultural-communication/1-launchpad-for-real-communication-offers-key-term-videos-and-2117363" > 1. LaunchPad for Real Communication offers key term videos and encourages selfassessment through adaptive quizzing. Go to bedfordstmartins.com/realcomm to get access to: LearningCurve Adaptive... </a> </div> <div class="relatedQuestionCart "> <p class="heading">Q: </p> <a class="relatedQuestionText" href="/study-help/intercultural-communication/2-explain-how-we-use-and-misuse-schemas-when-communicating-2117358" > 2. Explain how we use and misuse schemas when communicating with others </a> </div> </div> <nav class="navigationButtons"> <a class="previousQuestionButton" href="/study-help/questions/a-n-q-entity-can-be-either-9291416">Previous Question</a> <a class="nextQuestionButton" href="/study-help/questions/complete-question-5-when-calculating-the-debt-ratio-assume-debt-9291418">Next Question</a> </nav> </section> </main> <aside class="expertRight"> <section class="relatedBook" style="margin-bottom:40px; width: 100%;" > <div class="bookHolder" > <div class="relatedBookHeading" > <h2 class="heading">Recommended Textbook</h2> </div> <div class="bookMainInfo" > <div class="bookImage" style="width: 100px !important; min-width: 100px; flex-shrink: 0; margin-right: 20px;"> <a href="/textbooks/readings-in-database-systems-2nd-edition-9780934613651"> <img src="https://dsd5zvtm8ll6.cloudfront.net/si.question.images/book_images/6507cf2112e20_54978.jpg" width="100" height="131" alt="Readings In Database Systems" loading="lazy" style="width: 100px !important;"> </a> <a href="/textbooks/computer-science-zetalisp-2557" style="margin-top: 8px; display: block; text-align: left;">More Books</a> </div> <div class="bookInfo" style="text-align: left;"> <span class="bookTitle" style="text-align: left;"> <a href="/textbooks/readings-in-database-systems-2nd-edition-9780934613651" style="text-align: left;"> Readings In Database Systems </a> </span> <div class="bookMetaInfo" style="text-align: left;"> <p class="bookAuthor" style="text-align: left;"> <b>Authors:</b> <span>Michael Stonebraker</span> </p> <p class="bookEdition" style="text-align: left;"> 2nd Edition </p> <p class="bookEdition" style="text-align: left;"> 0934613656, 9780934613651 </p> </div></div></div> </div> </section> <div class="post-question-section"> <div class="description-question-section"> <span class="post-question-section-title">Ask a Question and Get Instant Help!</span> </div> <div class="text-area-post-question"> <form action="/study-help/post-question?ref=search" method="post" enctype="multipart/form-data"> <textarea rows="4" class="form-control form-posting-margin" name="textarea-question-content" id="textarea-question-content" placeholder="Type Your Question ...."></textarea> <button type="submit" class="btn btn-sm btn-submit-post-question text-center">Get Answer</button> </form> </div> </div> </aside> </div> </div> <div class="promo items-center justify-center hidden"> <div class="app_promo"> <span class="app_promo_dismiss"> <i class="fa-solid fa-x"></i> </span> <div class="app-button"> <div class="image-wrapper"> <img width="30" height="30" src="https://www.solutioninn.com/includes/images/rewamp/common/mobile-app-logo.png" decoding="async" fetchpriority="high" alt="SolutionInn App Logo"> <strong>Study Help</strong> </div> <button class="app_promo_action redirection" data-question-open-url='q_id=9291417&q_type=2'> Open in App </button> </div> </div> </div> </div> </div> <div class="blank-portion"></div> <footer> <div class="container footerHolder"> <div class="footerLinksFlex"> <div class="footerLinksCol col-md-3 col-lg-3 col-sm-6 col-6"> <p>Services</p> <ul> <li><a href="/site-map">Sitemap</a></li> <li><a href="/fun/">Fun</a></li> <li><a href="/study-help/definitions">Definitions</a></li> <li><a href="/tutors/become-a-tutor">Become Tutor</a></li> <li><a href="/books/used-textbooks">Used Textbooks</a></li> <li><a href="/study-help/categories">Study Help Categories</a></li> <li><a href="/study-help/latest-questions">Recent Questions</a></li> <li><a href="/study-help/questions-and-answers">Expert Questions</a></li> <li><a href="/clothing">Campus Wear</a></li> <li><a href="/sell-books">Sell Your Books</a></li> </ul> </div> <div class="footerLinksCol col-md-3 col-lg-3 col-sm-6 col-6"> <p>Company Info</p> <ul> <li><a href="/security">Security</a></li> <li><a href="/copyrights">Copyrights</a></li> <li><a href="/privacy">Privacy Policy</a></li> <li><a href="/conditions">Terms & Conditions</a></li> <li><a href="/solutioninn-fee">SolutionInn Fee</a></li> <li><a href="/scholarships">Scholarship</a></li> <li><a href="/online-quiz">Online Quiz</a></li> <li><a href="/study-feedback">Give Feedback, Get Rewards</a></li> </ul> </div> <div class="footerLinksCol col-md-3 col-lg-3 col-sm-6 col-6"> <p>Get In Touch</p> <ul> <li><a href="/about-us">About Us</a></li> <li><a href="/support">Contact Us</a></li> <li><a href="/career">Career</a></li> <li><a href="/jobs">Jobs</a></li> <li><a href="/support">FAQ</a></li> <li><a href="https://www.studentbeans.com/en-us/us/beansid-connect/hosted/solutioninn" target="_blank" rel="noopener nofollow">Student Discount</a></li> <li><a href="/campus-ambassador-program">Campus Ambassador</a></li> </ul> </div> <div class="footerLinksCol col-md-3 col-lg-3 col-sm-6 col-12"> <p>Secure Payment</p> <div class="footerAppDownloadRow"> <div class="downloadLinkHolder"> <img src="https://dsd5zvtm8ll6.cloudfront.net/includes/images/rewamp/common/footer/secure_payment_method.png" class="img-fluid mb-3" width="243" height="28" alt="payment-verified-icon" loading="lazy"> </div> </div> <p>Download Our App</p> <div class="footerAppDownloadRow"> <div class="downloadLinkHolder mobileAppDownload col-md-6 col-lg-6 col-sm-6 col-6 redirection" data-id="1"> <img style="cursor:pointer;" src="https://dsd5zvtm8ll6.cloudfront.net/includes/images/rewamp/home_page/google-play-svg.svg" alt="SolutionInn - Study Help App for Android" width="116" height="40" class="img-fluid mb-3 " loading="lazy"> </div> <div class="downloadLinkHolder mobileAppDownload col-md-6 col-lg-6 col-sm-6 col-6 redirection" data-id="2"> <img style="cursor:pointer;" src="https://dsd5zvtm8ll6.cloudfront.net/includes/images/rewamp/home_page/apple-store-download-icon.svg" alt="SolutionInn - Study Help App for iOS" width="116" height="40" class="img-fluid mb-3" loading="lazy"> </div> </div> </div> </div> </div> <div class="footer-bottom"> <p>© 2026 SolutionInn. All Rights Reserved</p> </div></footer> <script> window.addEventListener("load",function(){jQuery(document).ready(function(t){ // Clarity tracking (function(c,l,a,r,i,t,y){ c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)}; t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i; y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y); })(window, document, "clarity", "script", "sjv6tuxsok"); // Helper to read a cookie by name function getCookie(name) { return document.cookie .split('; ') .map(v => v.split('=')) .reduce((acc, [k, val]) => (k === name ? decodeURIComponent(val || '') : acc), ''); } // Read cookies var si = getCookie('si_u_id'); var uid = getCookie('u_id'); var zen = getCookie('zenid'); // Send to Clarity if (si) clarity('set', 'si_u_id', si); if (uid) clarity('set', 'u_id', uid); if (zen) clarity('set', 'zenid', zen); clarity('set', 'ip_address', '216.73.216.134'); t.ajax({type:"POST",url:"/",data:{trackUserActivity:!0,reqUri:document.URL,referer:document.referrer},success:function(t){}})})},!1),window.addEventListener("load",function(){jQuery(document).ready(function(t){t.ajax({type:"POST",url:"/",data:{insertCrawler:!0,reqUri:document.URL,parseTime:"0.056",queryTime:"0.01654768548584",queryCount:"30"},success:function(t){}})})},!1),window.addEventListener("load",function(){jQuery(document).ready(function(){function t(t="",n=!1){var i="itms-apps://itunes.apple.com/app/id6462455425",e="openApp://action?"+t;isAndroid()?(setTimeout(function(){return window.location="market://details?id=com.solutioninn.studyhelp",!1},25),window.location=e):isIOS()?(setTimeout(function(){return window.location=i,!1},25),window.location=e):(i="https://apps.apple.com/in/app/id6462455425",n&&(i="https://play.google.com/store/apps/details?id=com.solutioninn.studyhelp"),window.open("about:blank","_blank").location.href=i)}jQuery("#appModal").modal("show"),jQuery(".download-app-btn").click(function(){t(jQuery(this).attr("data-question-open-url"))}),jQuery(".redirection").click(function(){var n=jQuery(this).attr("data-question-open-url"),i=jQuery(this).attr("data-id");void 0!=n?1==i?t(n,!0):t(n,!1):1==i?t("",!0):t("",!1)}),jQuery(".app-notification-close").click(function(){jQuery(".app-notification-section").css("visibility","hidden");var t=new FormData;t.append("hide_notification",!0),jQuery.ajax({type:"POST",url:"/",data:t,cache:!1,contentType:!1,processData:!1,beforeSend:function(){},success:function(t){location.reload()}})})})},!1); </script> </body> </html>