
Make a python class called CellPhone. The init() method for CellPhone needs to store two attributes: brand, and model. Make two attribute called call_time (representing total calls duration) and txt_count (representing total text message count)which both start at 0 for each new CellPhone instance.
Define a method named call() that gets a call duration and updates the call_time attribute, then prints out the total calls duration so far.
Define another method named txt() that each time we call it just updates the txt_count attribute by adding 1 message to that, then prints the total message count so far.
In the end, create a new instance of CellPhone and run each method once (use any number for call duration argument).

Trending nowThis is a popular solution!
Step by stepSolved in 2 steps

- Write a Python class, Vehicle, that has three instance variables of type str, int, and float. These respectively represent the name of the vehicle, its year, and its price. Your class must include • a constructor method that initializes each variable to an appropriate value • methods for setting the value of each type, and retrieving the value of each type. method for printing the entire instance of a vehicle. Now define an instance of your class and test all the 4 types of methods including the constructor. .arrow_forwardin Javaarrow_forwardWrite a simple Python class named Cat. The class has 3 attributes, name, breed, age, that should be defined and initialized in the constructor. Also, you are required to write a method named print that prints the attributes, one per row.arrow_forward
- Define a class named Document that contains an instance variable of type String namedtext that stores any textual content for the document. Create a method named toString thatreturns the text field and include a method to set this value.Next, define a class for Email that is derived from Document and includes instancevariables for the sender, recipient, and title of an email message. Implement appropriateset and get methods. The body of the email message should be stored in the inheritedvariable text. Redefine the toString method to concatenate all text fields.Similarly, define a class for File that is derived from Document and includes an instancevariable for the pathname. The textual contents of the file should be stored in theinherited variable text. Redefine the toString method to concatenate all text fields.Finally, define a class DocumentTest that creates each two sample objects of type Emailand File in the main() method. Test your objects by passing them to the followingfunction…arrow_forwardFor this exercise, you will be completing the Account class, which simulates a regular bank account, then using overrides and calls to the superclass to create a StudentAccount. Student accounts differ from regular accounts in that they get a bonus $1 for every deposit, but a $2 fee for every withdrawal. You will override the methods in the StudentAccount by calling the superclass methods with the additonal amount or fee incorporated since the balance is not directly stored in the StudentAccount object. You will also update the toString, as outlined in the comments. When completed, create one student account and one regular account for testing. Deposit and withdraw money and print the results. import java.text.*;public class BankTester{public static void main(String[] args){Account a = new Account("Imran", 1100);a.deposit(200.00);System.out.println(acc1.toString());a.withdraw(100.00); }} public class StudentAccount extends Account{// Complete this class with Override methods.…arrow_forwardExtend the functionality of the Carinventory class by introducing a new method called 'add_car. This method should facilitate the addition of custom cars to the inventory. The method should take two parameters: a car model and its price. Implement this method to ensure that the inventory is updated accordingly. Instantiate a new object of the car inventory, naming it 'Auto Emporium,' utilizing the extended class with the newly added 'add_car' method. Your next step is to add three distinct custom cars to 'AutoEmporium'-for example, "Sleek Sedan,' 'Sporty Convertible,' and 'Luxury SUV: Assign varying prices to each of these cars. To conclude, utilize the 'display_inventory method to showcase the updated information about 'AutoEmporium." Verify that the output includes details about the newly added custom cars, ensuring that the prices are accurately reflected. This question tests the candidate's ability to implement a specific method, instantiate objects, add custom items, and…arrow_forward
- Pythonarrow_forwardIn Python 3, write a program with classes to keep track of phones. Here are the requirements: Create a new class called Phone. The Phone class should have a class attribute for the owner's name. Since all phones have a manufacturer and a model number, your class should take the manufacturer and model number from the constructor and assign them to instance attributes. Your Phone constructor should be able to take the parameters. Override the print method for Phone to output a human-friendly version of the information. Your code should prompt the user for an owner name and then start prompting for the manufacturers and models for all phones for that user until the user enters a 'q' or 'Q'. After the entry print out a list of all the phones.arrow_forwardConvert the following UML diagram into the Java code. Write constructor, mutator and accessor methods for the given class. Create an instance of Account class in a main method using a Demo class. Note: The structure of the class can be compiled and tested without having bodies for the methods. Just be sure to put in dummy return values for methods that have a return type other than void. Student Student Number Average Mark Is Eligible To Enroll Get Seminars Takenarrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





