class Circle: def -_init__(self, r= 3): self.radius = r 4 def get_radius(self): return self.radius 7 8. 6. For the class above reply to the following questions: 1) Create an object with radius=5 2) Now, change the radius of the same object to 10 3) What you will change to hide the data-field radius? Mention line# and change you will make to do so. 4) When the radius is hidden/private, how its radius should be updated? Write a function below that should be added as a method to the class to do so. 5) What will be the output of the following instructions: H23
Q: Homework Assignment Chapter 4b Create a Java Project folder named Chap4b Create a class named…
A: Actually, Java is a high level programming language. And also object oriented . It. Is a platform…
Q: 1. Write an app that computes student average 2. Create a class called Student 3. Use the init ()…
A: Create a class with 4 private data members and 3 public functions in which one method used for…
Q: Create a class ‘Box’ that has height, width and depth. The class should have a method volume() which…
A: So first part refer below solution: I have marked some part as it contains personal information.…
Q: I've posted this question several times. T-T) huhu... i just need the source code in java language.…
A: 1. The code for the first question is as follows: class Details { String name, address;…
Q: ote:This is a Java program question. Q#6: Create a class for invoice item having attributes invoice…
A: Import the Utility packages Create a class Invoice Declare the variables Invoice_ID as integers,…
Q: (Geometry: the Circle2D class) Define the Circle2D class that contains: 1 Two double data fields…
A: public class Main { public static void main (String[] args) { Circle2D c1=new…
Q: This is the question - Create a class named Rock that acts as a superclass for rock samples…
A: Rock.java public class Rock { private int sampleNumber; protected String description;…
Q: Q No#1 (Date Class) Create a class called Date that includes three instance variables-a month (type…
A: Program code: Filename: "Date.java" //define class Datepublic class Date { //declare class members…
Q: Classes and Objects Create a class called Car. The Car class has the following fields: ● color ●…
A: Required: Classes and ObjectsCreate a class called Car. TheCar class has the following fields:●…
Q: 1) Create a new Java Project named Final 2) Create a superclass VehicleRental a. Instance private…
A: Code: import java.text.DecimalFormat;class VehicleRental{ private int year; private String…
Q: Static & Not Final Field: Accessed by every object, Changing Non-Static & Final Field: Accessed by…
A: There are two keywords in a programming language “static” and “final”. The functions of these…
Q: 1: Create a enum PizzaType, which has the following entries: PIZZA_TYPE_PLAIN,…
A: As per the Bartelby guideline we are suppose to answer only one question at a time.So please repost…
Q: This class describes a tweet. A tweet has a message in it, a unique ID, * a count of the number of…
A: public class Main{ public static void main(String[] args) { Tweet t1=new Tweet(); //creates…
Q: java language
A: A Java programs for the given criteria is as follows,File name: “Circle.java”//Create a classpublic…
Q: Create a simple bank-account class, Account. An account object has an attribute name of type string.…
A: I have provided the answer based on C++ Programming. Detailed comments are included for a better…
Q: 10. Write a class for 'LabRoom'; it will have member fields for no of chairs, no of tables, no of…
A: I give the code in java along with output and code screenshot
Q: ava. Check ‘n Shop is a grocery supermarket in South Africa that provides a loyalty program to…
A: The given problem is to be solved in Java where 2 classes are needed as below: 1. Shopper.java 2.…
Q: Create a class called Account. Having private fields custname and protected field balance Define a…
A: Step 1: Create class with member variable name and balance Step 2: Accept name and balance Step 3:…
Q: Which statement is the most accurate for the code below? class A: def _init__(self, i = 0): self.i =…
A: When a class inherited other class, then it acquire all the data fields and methods present in the…
Q: Implements Cloneable interface. Contain two member variables RollNo & Name. Initialize member…
A: 1- In this assignment require, implement a cloneable interface, two string types variable(roll no,…
Q: Code a copy method for an Inventory class. The fields are itemNo and itemName. //Method header. {…
A: Inventory copy(int itemNo,String itemName){ Inventory copyObject = new Inventory(itemNo,itemName);…
Q: Define the Circle2D class that contains: Two double data fields named x and y that specify the…
A: public class Circle2D { //Declare the necessary variables. private double X, Y; private…
Q: 1. Write an app that computes student average 2. Create a class called Student 3. Use the init ()…
A: Create a class in which it contains member data and member methods. Data members are private and…
Q: Q1) (The Cylinder class) Design a class named Cylinder The class contains: 1 Two private attributes…
A:
Q: Create a class named Poem that contains the following fields: title - the name of the poem (of type…
A: Approach: Create four classes which are Couplet,Haiku,Limerick which are the derived classes they…
Q: ey want to create; either cheque or saving. To create an account, the user needs a full name and pin…
A: Question 1Create a program that allows users to create a bank account. Users are to choose…
Q: Create a class named Rock that acts as a superclass for rock samples collected and catalogued by a…
A: In your code you had `1. -------------- these lines which have to be deleted or commented. 2.…
Q: Creates a class Student with 3 attributes: name, id and level. a. Add a constructor able to create a…
A: #include <iostream> using namespace std; class student{ // Declaring three attributes of…
Q: Define the Circle2D class that contains:
A: The UML class diagram for the class Circle2D: The diagram comprises three sections: The first…
Q: (The Triangle class) Design a class named Triangle that extends GeometricObject. The class contains:…
A: UML stands for unified modeling language standard way to visualize the way a system has been…
Q: Create a class called Pyramid. A Pyramid is described by three pieces of private information as…
A: Here I have first of all created the class Pyramid with the data members as defined in the question.…
Q: Create a class named Poem that contains the following fields: title - the name of the poem (of type…
A: Below attached is the complete program of subclasses and super class : import java.util.*;…
Q: rite another Java class named Patient that contains: ■ A private integer data field called id. ■…
A: GIVEN: Write another Java class named Patient that contains: ■ A private integer data field called…
Q: Create a class called Person that will hold information about a single individual. This class should…
A: Person.h #include<iostream>#include<string.h>using namespace std; //declare class…
Q: Implement the following class. Refer to the below notes for more details. Car code: String //default…
A: allCarsCount is a static variable to keep track of number of instances and in every constructor we…
Q: Create a class named “Rectangle” having length and width as attribute. There should be…
A: A class is the fundamental unit of object oriented modelling. A class has both data and operations…
Q: Create a subclass named Square from the superclass GeometricObject. Create an instance variable…
A: GeometricObject.java public abstract class GeometricObject {private String color = "white";private…
Q: rite a class named Student. The class contains: ■ Private String data field “name” that refers to…
A: Note: Answering in python as no language is mentioned and the first question as per the BARTLEBY…
Q: Create a class “Main” having main method to perform following tasks. Create two objects of Subject…
A: Given: Create a class “Main” having main method to perform following tasks. Create two objects of…
Q: Create a subclass named Square from the superclass GeometricObject. Create an instance variable…
A: Sub Class is a class which inherits the other class. It is also called a derived class or child…
Q: Exercise 7.13 JHTP (Date Class): Create a class called Date that includes 3 instance variables—a…
A: Introduction Exercise 7.13 JHTP (Date Class): Create a class called Date that includes 3 instance…
Q: Create "People.java" Class for a "Person" with following functionality. People object should have…
A: Accessor methods are used to access the private variables outside the class Mutator methods are used…
Q: Exercise 1-Account class • Design a class named Account that contains : • A private int data field…
A: Designing a account class with the following. • A private int data field named id for the account •…
Q: 1- Design a class named Rectangle to represent a Rectangle. The class contains: • three variables…
A: package testrectangle; class Rectangle{ // define three fields double length, width, height;…
Q: Reflection allows you to inspect code that you didn't write yourself. Included with this assignment…
A: For showing sample output, here we have implemented a basic Cat class and the fields, methods and…
Q: (Car Class) Create a class called Car that includes three instance variables-a model (type String),…
A: /*-----CarApplication.java------*/ import java.util.Scanner;class Car{ String year, model;…
Q: Q1: -Write a program to create a class for a Bank company. The attribute account name, the amount of…
A: Introduction: In this question, we are asked to write a program in JAVA to create a class Bank and…
Q: (The MyInteger class) Design a class named My Integer. The class contains: 1 An int data field named…
A: **** Java Program **** MyInteger.java :
Q: Implements Cloneable interface. Contain two member variables RollNo & Name. Initialize member…
A: Java code: import java.util.*; // class Student implements Cloneable interface.class Student…
Q: private LocalDate date: private private boolean status; private String appointmentNumber: public…
A: The constructor, getter, setter and toString() method has been added in the class definition.
in Python
Trending now
This is a popular solution!
Step by step
Solved in 4 steps
- In Chapter 9, you created a Contestant class for the Greenville Idol competition. The class includes a contestants name, talent code, and talent description. The competition has become so popular that separate contests with differing entry fees have been established for children, teenagers, and adults. Modify the Contestant class to contain a field that holds the entry fee for each category, and add get and set accessors. Extend the Contestant class to create three subclasses: ChildContestant, TeenContestant, and AdultContestant. Child contestants are 12 years old and younger, and their entry fee is $15. Teen contestants are between 13 and 17 years old, inclusive, and their entry fee is S20. Adult contestants are 18 years old and older, and their entry fee is $30. In each subclass, set the entry fee field to the correct value, and override the Tostring() method to return a string that includes all the contestant data, including the age category and the entry fee. Modify the GreenvilleRevenue program so that it performs the following tasks: The program prompts the user for the number of contestants in this years competition, which must be between 0 and 30. The program continues to prompt the user until a valid value is entered. The program prompts the user for names, ages, and talent codes for the contestants entered. Along with the prompt for a talent code, display a list of valid categories. Based on the age entered for each contestant, create an object of the correct type (adult, teen, or child), and store it in an array of Contestant objects. After data entry is complete, display the total expected revenue, which is the sum of the entry fees for the contestants. After data entry is complete, display the valid talent categories and then continuously prompt the user for talent codes, and display all the data for all the contestants in each category. Display an appropriate message if the entered code is not a character or a valid code.Use the code provided copied to a new file named compulsory_task_1.py: 1. Add another method in the Course class that prints the head office location: Woodstock, Cape Town2. Create a subclass of the Course class named OOPCourse3. Create a constructor that initialises the following attributes and assigns these values: --- "description" with a value "OOP Fundamentals" --- "trainer" with a value "Mr Anon A. Mouse"4. Create a method in the subclass named "trainer_details" that prints what the course is about and the name of the trainer by using the description and trainer attributes.5. Create a method in the subclass named "show_course_id" that prints the ID number of the course: #123456. Create an object of the subclass called course_1 and call the following methods contact_details trainer_details show_course_id These methods should all print out the correct information to the terminal On a side note, this task covers single inheritance. multiple inheritance is also…Java Question Create a class named "Identity" class with attributes: name, age, city and gender. Choose your own data type (int, string etc.). Create 4 different methods; eat, study, sleep and play. Make each of them Print something like “I am sleeping”.In main driver class create object of a class with default constructor. Create two objects as shown in the image. Then call all methods of a class (eat, study, sleep and play).Add toString method displaying all attributes (name, age, city and gender). Add setters and getters for each attribute. Print each attributes from main program with getters.
- Create a TeeShirt class for Lebo’s Tee Shirt Company. Attributes include an order number, size, color, and price. Create set methods for the order number, size, and color and get methods for all four attributes. The price is determined by the size: R122.99 for XXL or XXXL, and R109.99 for all other sizes. Create a subclass named CustomTee that descends from TeeShirt and includes an attribute to hold the slogan requested for the shirt, and include get and set methods this field. The display() method should me an abstract method. Write a test class named DemoTees.java that creates two objects of each class, and demonstrate that all the methods work correctly by communicating to the user to input the tee shirt size, color, and slogan, then display the tee shirt order number, size, color, slogan and price. Format your output to 2 decimal places. The user should be asked to repeat the process or not, (y) indicates yes they want to repeat the process an the process repeats and (n)…Create a TeeShirt class for Toby’s Tee Shirt Company. Fields include: orderNumber - of type int size - of type String color - of type String price - of type double Create set methods for the order number, size, and color and get methods for all four fields. The price is determined by the size: $22.99 for XXL or XXXL, and $19.99 for all other sizes. Create a subclass named CustomTee that descends from TeeShirt and includes a field named slogan (of type String) to hold the slogan requested for the shirt, and include get and set methods for this field.Create a class named “Rectangle” having length and width as attribute. There should be behaviorstoset the values of length and width (individually and collectively), and get their values individually. There should also bebehavior to display the perimeters and area of the rectangle. Create another class named as Main which hastwo objects of Rectangle (r1, r2) having length (3.2, 20) and width (4.5, 36) respectively. Also displaythe length, width, perimeter and area of both rectangles.
- Books can come in various formats, like paper books, audio books, ebooks, etc. Create a generic classBook that has as common attributes the title, the year of publication, and the author. The constructor of thisclass should instantiate all three attributes. Override the toString method of class Book that returns a stringthat contains the values of its attributes. Create a subclass PrintBook that extends Book with attributesPublisher and ISBN. Create another subclass AudioBook which has the book’s size (in MB), its playlength and the playback artist’s name as attributes. Both PrintBook and AudioBook classes override thetoString method inherited from Book. Write a Java application to demonstrate the usage of this hierarchy.Test your newly created subclasses inside the same TestComputer program you previouslycreated: create two new Laptops and two new Desktops with the data of your choice. UsetoString() method to show all data fields (including the data fields in the super class and sub class)Hint: Make sure to avoid redundancy in your code – no fields implemented in the Parent Classshould be repeated/reimplemented/redefined in children. package project2;class Desktop extends Computer { private int width; private int height; public Desktop() { super(); width = height = 0; } public Desktop(String manufacturer, String diskSize, String manufacturingDate, int numberOfCores, int width, int height) { super(manufacturer, diskSize, manufacturingDate, numberOfCores); this.width = width; this.height = height; } public int getWidth() { return width; } public int getHeight() { return height; } public void setWidth(int width) {…Create a class Car with parameters companyName, color, maxSpeed (Not more than 150) andcategory. Use appropriate data types and access specifiers. Use default constructor to create objectsof cars. Write methods to set and get the values of parameters of car. Write methods to find categoryof car and to display the complete details of car along with category. Create another class TestCarwhich creates array of n number of cars, uses appropriate set methods to set the values of parametersof every car. Display the details of each car. (If max speed is between 120 and 150 then category is“High speed” otherwise “Normal”) (JAVA)
- User: Make a class called User. Create two attributes called first_name and last_name,and then create several other attributes that are typically stored in a user profile. Makea method called desctibe_user() that prints a summary of the user's information. Makeanother method called greet_user() that prints a personalized greeting to the user.Then - Create several instances representing different users, and call both methods for each user. Admin: Write a class called Admin that inherits from the User class. Add an attribute,privileges, that stores a list of strings like "can add post”, "can delete post”, "can banuser”, and so on. Write a method called show_privileges() that lists the administrator'sset of privileges. Then - Create an instance of Admin, and call your method.1. Create a class called Student, with the following attributes/variables:a. studentName (String)b. studentNumber (int)sc. regYear(long)d. faculty(String)e. department(String)2. Add the following methods in Student:a. accessors and mutators for all variablesb. toString methodi. Formulate your toString so that it only shows studentName,studentNumber and faculty3. Create a class called MyFriends, with the following attributes variables:a. studentArray(Student[])4. Add the following methods in MyFriends:a. fillArrayi. Using scanner ask how many students does the user want to inputii. Capture user input for all of his friends(Of course we are assuming all your friends would be similarUWC students, go ask around and meet new friends, alsopreferably not in the same Computer Science department … ifpossible … only if possible)b. maini. Call the fillArray methodii. Count how many Computer Science studentsiii. If half or more students are Computer Science students, thendisplay “You … need more…Create a class named Poem that contains the following fields: title - the name of the poem (of type String) lines - the number of lines in the poem (of type int) Include a constructor that requires values for both fields. Also include get methods to retrieve field values. Create three subclasses: Couplet, Limerick, and Haiku. The constructor for each subclass requires only a title; the lines field is set using a constant value. A couplet has two lines, a limerick has five lines, and a haiku has three lines. ***Can I also get an explaination for each step thank you so much for all of your help ^_^**** import java.util.*; public class DemoPoems { public static void main(String[] args) { Poem poem1 = new Poem("The Raven", 84); Couplet poem2 = new Couplet("True Wit"); Limerick poem3 = new Limerick("There was an Old Man with a Beard"); Haiku poem4 = new Haiku("The Wren"); display(poem1); display(poem2); display(poem3);…