Create a class, Triangle. Its init_() method should take self, angle1, angle2, and angle3 as arguments. Make sure to set these appropriately in the body of the_init_()method. Create a variable named number_of_sides and set it equal to 3. Create a method named check_angles. The sum of a triangle's three angles is It should return True if the sum of self.angle1, self.angle2, and self.angle3 is equal 180, and False otherwise. Create a variable named my_triangle and set it equal to a new instance of your Triangle class. Pass it three angles that sum to 180 (e.g. 90, 30, 60). Print out my_triangle.number_of_sides and print out my_triangle.check_angles().
Q: Write a method named raiseSalary that accepts two integers as an argument and return its sum…
A: Program In java import java.util.Scanner; public class Id12345678 { public static void…
Q: structions. subtractBigInteger() – When an integer has more than a certain number of digits, it is…
A: the code is an given below :
Q: his is the question I am stuck on - The developers of a free online game named Sugar Smash have…
A: Actually, java is a object oriented programming language. It is a platform independent.
Q: Create an application via NetBeans with named Pizza that storesinformation about a single pizza. It…
A: PROGRAM: package com.example; //Defining the Class Pizza class Pizza { //Defining the…
Q: PS: Please upload the output and say the logic behind it. Thank you! 2. Create a class with a…
A: A year is considered a leap year if:i. It has an extra day i.e. 366 instead of 365.ii. It occurs…
Q: Create a class called Hangman with the field n (number of incorrect guesses (int)). • include an…
A: The program is written in Python. check the program screenshot for the correct indentation. Please…
Q: Add additional information to the student class below such as name, address, major, and contact…
A: Program description: The Student class will contain the additional data member fields to store name,…
Q: when submitting the below program I am getting an error that states: Test Failed: 'Taxicab'…
A: Python is a language that strictly follows indentation to identify code blocks or suites. Since…
Q: Following the example of the Rectangle class of Chapter 9 Exercise 1, design a class named Cuboid to…
A: PROGRAM INTRODUCTION: Define the class with the name cuboid. Declare the required constructor that…
Q: You will create a class called Square. Length will represent the length of one side which is an…
A: The mechanism of developing and implementing an executable computer program to achieve a particular…
Q: Copy and paste the following definition of the class Car in the submission box and then add a method…
A: Program implementation-def is used to declare a method. Here, def is used to declare brake method in…
Q: To encourage good grades, Hermosa High School has decided to award each student a bookstore credit…
A: writing code in java import java.util.*; class CreditBookstore { public static void fun(String…
Q: He also includes the method thisDay.getDay() in the code. What is the result for the given method?…
A: weekday[0] = "Sunday"; weekday[1] = "Monday"; weekday[2] = "Tuesday"; weekday[3] = "Wednesday";…
Q: Please help me with this , I am stuck ! thanks 1) bagUnion: The union of two bags is a new bag…
A: bagUnion: The union of two bags is a new bag containing the combined contents of the original two…
Q: Which of the following Student class methods must be implemented in the Student class to make this…
A: printArrayConsole method is a user-defined method that accepts title and data as parameters. Thus,…
Q: "Create a class Die with one attribute called sides, which has a default value of 6. Write a method…
A: Here is the python code: #Classclass Die: def __init__(self,sides = 6): self.sides = sides…
Q: i need help with my last method studentSearch() the main idea of the method is to make sure not…
A:
Q: res plays the three variables' values in sentences. tor method with three parameters for the three…
A: I give the code along with output and code screenshot
Q: Write an application that uses methods in the LocalDate class to calculate how many days are left…
A: import java.time.*; import java.util.Scanner; public class DaysTilNextMonth{ public static void…
Q: Create a class named MyOctagon that contains the following method: /** Prints the area of the…
A: Here, Code instruction is given.
Q: For this program, you will create a class modeled on a real-world combination lock. A combination…
A: It is defined as a programming language and a platform. Java is a high level, robust,…
Q: Write a method named computeAvgScore that is passed 3 double parameters named exam1, exam2, exam3.…
A: import java.util.*; public class Main { public static double computeAverageScore(double a,double…
Q: Create a class Rectangle with attributes length and width with are variables, each of which…
A: PROGRAM: Rectangle.java: //Header file import java.text.DecimalFormat; //Defining the class…
Q: Following the example of the Rectangle class of Chapter 9 Exercise 1, design a class named Cuboid to…
A:
Q: The Westfield Carpet Company has asked you to write an application that calculates the price of…
A: public class RoomDimension { private double length; private double width; /** * @param…
Q: (The Rectangle class) Following the example of the Circle class in Section 8.2,design a class named…
A: Note: The given program is compiled and executed in "NetbeansIDE"
Q: 1. Create a class named Student that has fields for an ID number (idNumber), number of credit hours…
A: NOTE: SINCE THE LANGUAGE OF THE CODE IS NOT MENTIONED, I HAVE USED JAVA FOR THE SOLUTION. Import…
Q: Which of the below is a valid and correct accessor method for 'length' (double of 'Rectangle' class?…
A: Answer: b
Q: Given the following code, please write me a method called "getPerimeter()" which will sum up the…
A: In this, we have given a Java code. Inside the Triangle class, we have to create a method…
Q: Write a method that calculates and prints both the maximum humidity and maximum temperature values…
A: the answer is given below:-
Q: Create a program named FindSquareRoot that finds the square root of a user’s input value. The Math…
A: Program: using System.IO; using System; class Program { static void Main() { double n; double result…
Q: In this programming question, you are required to implement five methods according to the following…
A: The solution to the given problem is below.
Q: Create a class called Invoice that a hardware store might use to represent an invoice for an item…
A: Required: Create a class called Invoice that a hardware store might use to represent an invoice for…
Q: Need help writing the following method: getCourseSize() – returns the number of students registered…
A: From the given program, we can see that we have a students table. To implement the requirements, we…
Q: Write a method that calculates and prints both the maximum humidity and maximum temperature values…
A: ANSWER:-
Q: Write a method that calculates and prints both the maximum humidity and maimum temperatute values…
A: ANSWER
Q: Create a program named PaintingEstimate whose Main() method prompts a user for length and width of a…
A: using System;using static System.Console;using System.Globalization;class PaintingEstimate{…
Q: To encourage good grades, Hermosa High School has decided to award each student a bookstore credit…
A: Actually, java is a object oriented programming language. It is a platform independent.
Q: Car's state is set to hold the speed of travel and distance to travel at that speed Precondition:…
A: Code : Car.java package Vehicle; import java.text.DecimalFormat;import java.util.Random; public…
Q: Create a class named Circle with fields named radius, diameter, and area. Include a constructor that…
A: The name of the class is the Circle. This class has three fields. The name of the fields is radius,…
Q: Create a public class discount with the following details. A method setName that has one…
A: I solve this question in Java .
Q: The developers of a free online game named Sugar Smash have asked you to develop a class named…
A: There are three different codes of different classes. Save all the three java files in the same…
Q: he developers of a free online game named Sugar Smash have asked you to develop a class named…
A: Code is in Step 2. As its said to write code for the class SugarSmashPlayer , after completing the…
Q: Write a method that calculates and prints both the maximum humidity and maximum temperature values…
A: ANSWER:-
Q: create a private method that named getValue() which will return the value of a^2 - b^2
A: Here since programming language not mentioned, using C++ To create a private method, we need to use…
Q: You are given a method with the signature: /** * Returns the minimum of the two numbers * *@param n1…
A: Please find the answer below
Q: Task2: Suppose is the last digit of you ID • Draw a Square whose side length is with two methods.…
A: The program is written in Java import java.util.*;public class Main {//Method to draw first and…
Q: Following the example of the Rectangle class of Chapter 9 Exercise 1, design a class named Cuboid to…
A: public class Cuboid { private int length,width,height; Cuboid(int length,int…
Q: o exercise 9.1 in the book (page 362, or page 384 of the Comprehensive Version of the book) Also…
A: #include <bits/stdc++.h>using namespace std;class Rectangle{private: double…
Q: To encourage good grades, Hermosa High School has decided to award each student a bookstore credit…
A: Note: Programming language is missing in the question. So we will answer this program in Java…
Python: Use class abd pointers
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- You will create a class called Square. Length will represent the length of one side which is an integer.You should create the constructor, an instance variable, a getter method for the length of a side, a getArea method and a toString method. The area of a square = length * length.Your toString method should be written such that it would return a String of the form "Square with side length: 8” (if the side length was 8) public class Square { //create one instance variable called length //create the constructor with one parameter //create your getter method to get the length of one side with return type integer //create the getArea method with return type integer //create the toString method }PS: Please upload the output and say the logic behind it. Thank you! 2. Create a class with a method. The method has to decide whether a given year is a leap year ornot.a. Note: A year is considered a leap year if:i. It has an extra day i.e. 366 instead of 365.ii. It occurs every 4 years e.g. 2008, 2012 are leap years.iii. For every 100 years, a special rule applies - 1900 is not a leap year but 2000 is aleap year. In those cases, we need to check whether it is divisible by 400 or not.a. Carly's Catering provides meals for parties and special events. In Chapters 3 and 4, you created an Event class for the company. Now, make the following changes to the class: Currently, the class contains a field that holds the price for an Event. Now add another field that holds the price per guest, and add a public method to return its value. Currently, the class contains a constant for the price per guest. Replace that field with two fields—a lower price per guest that is $32, and a higher price per guest that is $35. Add a new method named isLargeEvent() that returns true if the number of guests is 50 or greater and otherwise returns false. Modify the method that sets the number of guests so that a large Event (more than 50 guests) uses the lower price per guest to set the new pricePerGuest field and calculate the total Event price. A small Event uses the higher price. Save the file as Event.java. b. In Chapter 4, you modified the EventDemo class to demonstrate two Event…
- Create a class named Percentages whose main() method holds two double variables, and prompt the user for values. Pass both variables to a method named computePercent() that displays the two values and the value of the first number as a percentage of the second one. For example, if the numbers are 2.0 and 5.0, the method should display a statement similar to: 2.0 is 40 percent of 5.0. Then call the method a second time, passing the values in reverse order. An example of the program is shown below: Enter a double >> 3.7 Enter another double >> 12.3 3.7 is 30.081300813008127 percent of 12.3 12.3 is 332.43243243243245 percent of 3.7 Task 01: Create the Percentages class. Task 02: The computePercent() method displays the percent of the first argument of the second argument. Task 03: The Percentages program accepts 2 double values from the console and displays the percent of first value of the second value and vice versa.create a private method that named getValue() which will return the value of a^2 - b^2Please answer the JAVA question below. Based on the below prices double array, create a method call and method that passed in the prices array and determines which value is the lowest. double[ ] prices = {75, 25, 35, 150, 69.99};
- Create an application for a library and name it FineForOverdueBooks. TheMain() method asks the user to input the number of books checked out and the number of days they are overdue. Pass those values to a method named DisplayFine that displays the library fine, which is 10 cents per book per day for the first seven days a book is overdue, then 20 cents per book per day for each additional day.Create a class named Student that has fields for an ID number, numberof credit hours earned, and number of points earned. (For example,many schools compute grade point averages based on a scale of 4, so athree-credit-hour class in which a student earns an A is worth 12 points.)Include methods to assign values to all fields. A Student also has a field forgrade point average. Include a method to compute the grade point averagefield by dividing points by credit hours earned. Write methods to display thevalues in each Student field. Save this class as Student.java.b. Write a class named ShowStudent that instantiates a Student object from theclass you created and assign values to its fields. Compute the Student gradepoint average, and then display all the values associated with the Student.Save the application as ShowStudent.java.c. Create a constructor for the Student class you created. The constructor shouldinitialize each Student’s ID number to 9999, his or her points earned to 12,…Create a program named FindSquareRoot that finds the square root of a user’s input value. The Math class contains a static method named Sqrt() that accepts a double and returns the parameter’s square root. If the user’s entry cannot be converted to a double, display an appropriate message, and set the square root value to 0. Otherwise, test the input number’s value. If it is negative, throw a new ApplicationException to which you pass the message “Number can’t be negative.” and again set sqrt to 0. If the input value is a double and not negative, pass it to the Math.Sqrt() method, and display the returned value
- Create a class named Checkup with fields that hold a patient number, two blood pressure figures (systolic and diastolic), and two cholesterol figures (LDL and HDL). Include methods to get and set each of the fields. Include a method named computeRatio() that divides LDL cholesterol by HDL cholesterol and displays the result. Include an additional method named explainRatio() that explains that HDL is known as “good cholesterol” and that a ratio of 3.5 or lower is considered optimum. Save the class as CheckupType.cpp. Create a tester program named TestCheckup whose main() method declares four Checkup objects. Call a getData() method four times. Within the method, prompt a user for values for each field for a Checkup, and return a Checkup object to the main() method where it is assigned to one of main()’s Checkup objects. Then, in main(), pass each Checkup object in turn to a showValues()method that displays the data. Blood pressure values are usually displayed with a slash between the…You are given a method with the signature:/*** Returns the minimum of the two numbers**@param n1 the first number*@param n2 the second number*@return the smaller of the two numbers*/public float minimum(float n1, float n2)It is part of the class MyMath. Which of the following is a correct use of the method? Group of answer choices: float f = MyMath.minimum(0.2f,1.5f); 2. int i = MyMath.minimum(2,5); 3. float f = MyMath.minumum(5,99); 4. int i = MyMath.minimum(2f,5f);Need help writing the following method: getCourseSize() – returns the number of students registered in the course (not in the waitlist). Your code should maintain the public size variable that keeps track of the number of students registered. Note that a successful put() and remove() will only change the size field if the number of students that are registered changes. public class Course { public String code; public int capacity; public SLinkedList<Student>[] studentTable; public int size; public SLinkedList<Student> waitlist; public Course(String code) { this.code = code; this.studentTable = new SLinkedList[10]; this.size = 0; this.waitlist = new SLinkedList<Student>(); this.capacity = 10; } public Course(String code, int capacity) { this.code = code; this.studentTable = new SLinkedList[capacity]; this.size = 0; this.waitlist = new SLinkedList<>();…