Written in python. This file is about rectangles. It requires a main function and three custom functions, all of which take the rectangle dimensions as arguments. a function that returns the area of a rectangle. a void function that prints the perimeter of a rectangle. a function that returns the length of a rectangle's diagonal. This function must use a method of the math module. The main function should prompt the user for the rectangle dimensions (as floats) and execute the custom functions. All calculations should be printed accurate to three decimal places using f-strings.
Q: Write a program that reads students’ names followed by their test scores. The program should output…
A:
Q: Create an drawing panel of at least 600 x 600. Draw filled-in shapes of at least two…
A: Program Instruction The function draw has been modified to draw a smiling face. In the function…
Q: Turtle Graphics is a Python feature like a drawing board, which lets us command a turtle to draw all…
A: import turtle import math t = turtle.Turtle() # DECLARE THE TURTLE PEN AS T angle =…
Q: In geometry, an octagon is an eight-sided polygon. Each internal angle is 135 degrees. Based on…
A: The internal angle is 135 Therefor 180-135=45 So, we have used angle 45 to turn right every time and…
Q: Create a class calculate that uses two separate functions:-a function to multiply two float numbers…
A: INLINE FUNCTION : inline function is a function which gets expanded in line whenever it is called,…
Q: Write a Java program that simulates a calculator. It first displays a menu like the one given below:…
A: To give calculator program
Q: Consider the following code snippet [Pseudocode]: Method func) { PRINT "This is not an main…
A: Answer 1. The code will show compile time error. Answer 2. The code will show compile time error.
Q: Write a program to print the area of a rectangle by creating a class named 'Area' having two…
A: Sample Response: //C++ program to compute area of rectangle by using class and…
Q: Write a program that allows a player to play Rock, Paper, Scissors. In this version, if there is a…
A: Find the required code in python as language not mentioned given as below and output :
Q: What is the value of arysize after executing the following code: Answer: int testAry[] = {…
A: output : 1 this is because sizeof(arysize) represent the size of first element and it is divided by…
Q: Turtle Graphics is a Python feature like a drawing board, which lets us command a turtle to draw all…
A: CALCULATING INTERNAL ANGLE: The internal angle is 135 Therefor 180-135=45 So, we have used angle 45…
Q: Write a Java program that simulates a calculator. It first displays a menu like the one given below:…
A: if (opt == '+') { int[] choice = userinput();…
Q: a program that uses different operators; and Use the methods of the Math class. structions: 1.…
A: using System;class ComputeAverageApp{ static void Main() { Console.WriteLine("Enter 5…
Q: Task 4 Implement the design of the Travel class so that the following output is produced: [You are…
A: 1.Creating a class name Travel 2.count is static variable of class because with each time calling…
Q: suppose there is a class Alarm. Alarm has two class variables, code which contains a String value…
A: class Alarm: def __init__(self, code, armed): self.code = code self.armed =…
Q: Use a class named 'Character' with string variables 'fullname', 'weapon', 'vision', and integer…
A: A class will be created named "Character" with the given string variables - fullname, weapon,…
Q: Modify songVerse to play "The Name Game" (OxfordDictionaries.com), by replacing "(Name)" with…
A: Here is the solution with an output:-
Q: Write a program to print the area of a rectangle by creating a class named 'Area' having two…
A: JAVA was developed by Sun Microsystems Inc in the year 1991, later acquired by Oracle Corporation.…
Q: I have written a C++ class called 'Birthday' and I want to write a method that can compare with…
A: Programming instructions:First, create the constructor to initialize the variables with the initial…
Q: Write a Java program that simulates a calculator. It first displays a menu like the one given below:…
A: while(true){ menu(); char c = sc.next().charAt(0); if(c == '+') { double[] values…
Q: Here is the question: The files provided in the code editor to the right contain syntax and/or…
A: public class Main{ public static void main(String[] args) { String quote = "Honesty is the…
Q: This assignment creates a GradeBook class that manages a list of quiz grades, computes the average…
A: According to the information given:- we have to follow the instruction in order to get desired…
Q: Write a class calculator to perform addition and subtraction. Create 3 calculator objects with…
A: **This code is written in JAVA since no other programming language was mentioned.** class…
Q: In a Python file called icecream.py, write a class called IceCream that matches the following…
A: Use a constructor to create instance where we set the price_per cup and then in get_cost method we…
Q: it is saying that they can not find symbol in quartsNeeded=input.NextInt(); final int…
A: Introduction of Program The above program is written in Java Programming language and Java is Case…
Q: calcProduct is a value-returning method that calculates the product of two integer values sent to…
A: program to show all procedure definition to calling #include <stdio.h>#include…
Q: Write a Java program that simulates a calculator. It first displays a menu like the one given below
A: Approach: Here, the switch statement is used to compute the result. The switch takes one of…
Q: The local Driver's License Office has asked you to writea program that grades the written portion of…
A: The below given java program will obey the following rubrics:Importing essential header…
Q: Program is not running or is coming bback as blank, no errors are brought up. Am I missing…
A: Python code: Rectangle.py # Rectangle.py class Rectangle(object): # Declare public methods…
Q: In this question, you will implement the famous Guess the Number game in C as we've done ir the…
A: Use binary search technique for faster guessing The mid element of the range will be the computer…
Q: Sample Input 0 Sample Output 0 Enter the number of students: Average weight of all students is…
A: Solution for above program is given below -
Q: Your program must process the following four commands. Create account amount Deposit account amount…
A: /** * This class performs bank operations*/public class Account { private int accNumber;…
Q: In Python, Create a CourseGrades application that simulates a grade book for a class with 12…
A: The answer is given below:-
Q: with python Develop a program, in which you'll design a class that holds the following personal…
A: Below is the code and sample output:
Q: he twins Kartik and Kunaal want to play word search puzzles with their class. They want to be faster…
A: • check all cells. If a cell has the first letter, we will then try all 8 directions one by one from…
Q: Write a Java program that simulates a calculator. It first displays a menu like the one given below:
A: Use if-else ladder or switch for applying operation on operands and we solved it here using if-else…
Q: How Can we Put this in the Following Program? In the main function, after creating the Society…
A: According to the information given:- We have to implement given instruction about the housing…
Q: This is a python Programming Fix this issue: -2 no attribute of type date (year was integer)…
A: from datetime import date class Person: def…
Q: Help write the code for the follwing problem starting from scratch Write a complete C++ program in…
A: Code comprises of 3 files Circle.h, Circle.cpp and CircleMain.cpp Circle.h file declares radius as a…
Q: ant note: your code must compile correctly and run without errors. Otherwise, your code will get the…
A: It is defined as one of the most popular programming languages that is being widely used in the IT…
Q: By using class interface write a program to read three numbers and using a friend function to find…
A: Algorithm: Start Define a class with one virtual method and one friend method. Implement the 2…
Q: (already solved on bartleby) You are required to build a mini FunTime application for the kids to…
A: Given: To build a mini FunTime application for the kids to play with their electronic toys in a…
Q: MY QUESTION IS IF ITS POSSIBLE TO GET SOME HELP SETTING UP MY PYTHON CODE THAT IS DONE AND FUNCTIONS…
A: According to the information given:- We have to convert the python code to pseudocode .
Q: You have imported a library with the birthMonth() function. Based on the API, how many strings are…
A: Here we calculate birth month based on the day of the month, day of the week, and the birth…
Q: The local Driver’s License Office has asked you to write a program that grades the written portion…
A: Actually, program is a executable software that runs on a program,
Q: Write a program to print the area of a rectangle by creating a class named 'A having two functions.…
A: GIVEN: Write a program to find the area of the rectangle using two functions. The first function…
Q: A programmer notices the following two procedures in a library. The procedures do similar, but not…
A: Procedure MaxFour (w,x,y,z) which returns the greatest of its four integer parameters is the…
Q: I already have the code for the assignment below, but the code has an error in the driver class.…
A: Here I have created a class named U10E03R. Inside this class, I have created the method named…
Q: Use a class named 'Character' with string variables 'fullname', 'weapon', 'vision', and integer…
A: Hey. I have written the complete and correct code in step 2 and the output for corresponding code is…
Q: my assignment wants me to Convert the MileConversions program to an interactive application. Instead…
A: Hey, thank you for your question. You have almost the required task of your assignment. We shall…
Written in python. This file is about rectangles. It requires a main function and three custom functions, all of which take the rectangle dimensions as arguments.
- a function that returns the area of a rectangle.
- a void function that prints the perimeter of a rectangle.
- a function that returns the length of a rectangle's diagonal. This function must use a method of the math module.
The main function should prompt the user for the rectangle dimensions (as floats) and execute the custom functions. All calculations should be printed accurate to three decimal places using f-strings.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
- The twins Kartik and Kunaal want to play word search puzzles with their class. They want to befaster than everyone else in their class, so they decided to write a C code to help them find wordswith a click of a button. Little did they know, everyone in class decided to do this question. You are required to implement search2D function. void search2D(char word[], int wordSize, const int Size, char grid[Size][Size]); search2D receives the word to look for char word[], the size of the word int wordSize, sizeof the grid const int Size and the puzzle grid char grid[Size][Size]. The word size can bebetween 2 and 23. You are NOT required to check for the validity of the word size.search2D should look for the first letter in the word row by row. If it finds the first letter of the wordin the puzzle, it should look for the remaining of the word in the 8 directions from the south and goesclockwise, i.e. south, south-west, west, north-west, north, north-east, east and lastly…Implement the design of the Travel class in python so that the following output is produced: You are not allowed to change the code below # Write your code hereprint(“No. of Traveller =”, Travel.count)print("=======================")t1 = Travel("Dhaka","India")print(t1.display_travel_info())print("=======================")t2 = Travel("Kuala Lampur","Dhaka")t2.set_time(23)print(t2.display_travel_info())print("=======================")t3 = Travel("Dhaka","New_Zealand")t3.set_time(15)t3.set_destination("Germany")print(t3.display_travel_info())print("=======================")t4 = Travel("Dhaka","India")t4.set_time(9)t4.set_source("Malaysia")t4.set_destination("Canada")print(t4.display_travel_info())print("=======================")print(“No. of Traveller =”, Travel.count) output: No. of Traveller = 0=======================Source: DhakaDestination:IndiaFlight Time:1:00=======================Source: Kuala LampurDestination:DhakaFlight Time:23:00=======================Source:…this assignment wants me to: Convert the QuartsToGallons program to an interactive application. Instead of assigning a value to the number of quarts, accept the value from the user as input. my code is . it is saying that they can not find symbol in quartsNeeded=input.NextInt(); final int QUARTS_IN_GALLON = 4; int quartsNeeded = 18; int gallonsNeeded; int extraQuartsNeeded; Scanner input = new Scanner(System.in); System.out.print("Enter quarts >>"); quartsNeeded = input.NextInt(); gallonsNeeded = quartsNeeded / QUARTS_IN_GALLON; extraQuartsNeeded = quartsNeeded % QUARTS_IN_GALLON; System.out.println("A job that needs " + quartsNeeded + " quarts requires " + gallonsNeeded + " gallons plus " + extraQuartsNeeded + " quarts.");
- Write a Java program that simulates a calculator. It first displays a menu like the one givenbelow:Press + for additionPress - for subtractionPress * for multiplicationPress / for divisionPress % for remainderPress S or s for square rootPress P or p for power The program takes the choice and stores it in a char type variable. Based on the choice,prompt the user to enter two operands (two operands are required for all functions except squareroot) and then display the result of calculations. The operands must be of type double.Rules:Write a Java program that simulates a calculator. It first displays a menu like the one givenbelow:Press + for additionPress - for subtractionPress * for multiplicationPress / for divisionPress % for remainderPress S or s for square rootPress P or p for power The program takes the choice and stores it in a char type variable. Based on the choice,prompt the user to enter two operands (two operands are required for all functions except squareroot) and then display the result of calculations. The operands must be of type double.Rules:1. If the user enters a choice other than the available ones, your program should displayanerror message and stop.2. For division, if the second operand is 0, display an error message “Division by Zero notallowed”3. For square root, the program should take only one input i.e. first operand. Note : using Java LanguageIn this exercise you will write a program to compute the distance between any two geo locations. In this program you will ask the user for four numbers. starting latitude starting longitude ending latitude ending longitude Then, using the GeoLocation class and our earlier example as a reference, compute the distance in miles between the two locations. A sample program run should match exactly as below: Enter the latitude of the starting location: 48.8567 Enter the longitude of the starting location: 2.3508 Enter the latitude of the ending location: 51.5072 Enter the longitude of the ending location: 0.1275 The distance is 208.08639358288565 miles. setInputs(String[]) should be included /* * This class stores information about a location on Earth. Locations are * specified using latitude and longitude. The class includes a method for * computing the distance between two locations. * * This implementation is based off of the example from Stuart Reges at * the University of…
- Write a program that can be used to assign seats for a commercial airplane. The airplane has 13 rows, with six seats in each row. Rows 1 and 2 are first class, rows 3 through 7 are business class, and rows 8 through 13 are economy class. Your program must prompt the user to enter the following information: a. Ticket type (first class, business class, or economy class) b. Desired seatThis is a debugging question - The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly. Code I was given - // A byte can't hold a value higher than 127 // This program throws an ArithmeticException // if adding two bytes yields a value that is too high public class DebugTwelve2 { public static void main(String[] args) { byte num1 = 120, num2 = 120, result; final byte HIGHBYTE = 127; try { allowed = (byte)(HIGHBYTE - num1); if(num2 > allowed) throw(new Arithmeticexception()); result = (byte)(num1 + num2); System.out.println("Result is + result); } catch(ArithmeticcException error) { System.out.println("Byte can't hold value higher than " + HIGHBYT); } } }I have a running code of a dining philosophers problem but it has a logic problem where it loops right after it asks how many of the philosophers are hungry thus unable to calculate how exactly the philosophers are going to eat below is the code: #include <stdio.h>#include <stdlib.h>#include <conio.h>#include <math.h>#include <string.h> void one(void);void two(void);void exit();int tph, philname[20], howhung, hu[20], cho;//{}[] int main(void){ int i, status[10],philname[10],howhung; printf("\n\nDINING PHILOSOPHER PROBLEM"); printf("\nEnter the total no. of philosophers: "); scanf("%d",&i); for(i=0;i<tph;i++) { philname[i] = (i+1); status[i]=1; } printf("How many are hungry : "); scanf("%d", &howhung); if(howhung==tph) { printf("\nAll are hungry..\nDead lock stage will occur"); printf("\nExiting.."); } else {…
- Implement the below pseudo-code in a Java program using a while loop and aswitch-case statement. The program should be well structured, and the taskperformed under each option (at least options 'b' to 'e') should be implementedas a separate method.NOTE: The Scanner class does not have a method to input a character. Inorder to read a character from the keyboard, use one of the following methods(after declaring the Scanner object):static Scanner kb = new Scanner(System.in);1. char ch = kb.nextLine().charAt(0); OR2. char ch = kb.nextLine().toLowerCase().charAt(0);where kb is a Scanner class object.The second method above also converts the input to lowercase, which is oftenuseful. Though these methods allow the user to input more than one characteron the input line, the rest of the line (after capturing the first character withcharAt(0)) is discarded.If you also want to ignore the leading spaces before the first character thenuse:1. char ch = kb.nextLine().trim().charAt(0); OR2. char ch =…Using function calls, write a program to spell out the word MISSISSIPPI using block letters like the following. M M MM MM M M M M M M M M M M M M M IIIIIII I I I I I IIIIIIII SSSSSS S S S SSSSSS S S S SSSSSS and so on.. Java coding Make sure to use static methods so that you main program is easy to read.***python only*** Write a function that takes a DrawingPanel as a parameter and draws the horizontal pyramid shape as shown in the following figure. There are ten rectangles of increasing sizesfilled with increasing shade of green color (increment of G by 20 while keeping R and B at 0). These rectangles should have the same width, and completely symetric with respect tothe center horizontal line of the window. Each rectangle should have a blue outline. A sample run of the following main() function should result in the following graphics. WIDTH = 300 HEIGHT = 300 ### # Your code here ### def main() : panel =Drawing Panel(WIDTH, HEIGHT) draw_objects(panel) panel.window.mainloop if_name_ == '_main_' :main()