Write a program to print the area of a rectangle by creating a class named 'Area' having two functions. First function named as 'setDim' takes the length and breadth of the rectangle as parameters and the second function named as getArea returns the area of the rectangle. Length and breadth of the rectangle are entered through keyboard.
Q: Write a program that reads students’ names followed by their test scores. The program should output…
A:
Q: Write a program that draws a fixed rectangle centered at (100, 60) with width 100 and height 40.…
A: GIVEN: Write a program that draws a fixed rectangle centered at (100, 60) with width 100 and…
Q: Write a class that prompts the user for the day’s high and low temperatures. If the high is greater…
A: Step 1:- Note:-I am writing the program in the java language Program Approach:- Import the…
Q: Write a class called Calculation to finish the following tasks of computation. 1. Given an integer…
A: In first program accept input from user so we use scanner class and create one user defined function…
Q: Write a program that use two classes. Calculate the factorial of a given number by using one class…
A: Constructors are the functions which have same name as class name and whenever an instance is…
Q: Create a new class called Simplecalc. In this class, implement a program that asks the user to enter…
A: // Java program for simple calculator import java.io.*;import java.lang.*;import…
Q: Write an OOP program that include class named "Shape". Which has different variables like; int…
A: Here it is very simple program Create class Name Shape Attribute Length and width as private Set…
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: Create a class that models a store. You store has some number of products, for example cookies,…
A: 1. Because we only get 2:30 hours to solve, I am unable to explain the code but I have added the…
Q: a2) write a class that represents a cube, which has the following 1- Three variables: side, volume,…
A: The solution contains use of classes, constructors, destructors, function calling. NOTE: The program…
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: using Java Write a grading program for a class with the following grading policies: 1. There are…
A: #include<iostream>using namespace std;struct record{double quiz1;double quiz2;double midyear,…
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: Write a program called TwoRectangles that uses two integer class constants called WIDTH and HEIGHT…
A: Program Approach: Import java package. Define class A and Initialize constant variable height =4…
Q: Write a program that create a class ‘simpleobject‘ , and using constructor print the…
A: Constructors in java: Every time an object is created using the new() keyword at least one…
Q: Write a program to create a class named 'vehicle', containing variable 'brand', 'horsepower'. Create…
A: For setting values we can make use of parameterized constructor and to initialize other object with…
Q: Write a program by creating an 'Employee' class having the following functions and print the final…
A: Required: To Write a program by creating an 'Employee' class having the following functions and…
Q: Implement function WriteRectangle to display a (filled) rectangle on the screen, with the width and…
A: According to the information given:- We have to follow the instruction in order to get desired…
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: Write a program that converts a number entered in Roman numerals to decimal. Your program should…
A: import java.util.*;public class Main{static Scanner in=new Scanner(System.in);public static void…
Q: Write a program that allows a user to enter the number of days to rent something Calculate the cost…
A: C++ code and its sample output is in step2.
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: Write a program to print the area of a rectangle by creating a class named 'Area' having two…
A: Start Input length Input breadth Create instance Set Dimensions Print Area Stop
Q: Write a program to print the area of a rectangle by creating a class named 'Area' having two…
A: The area of a rectangle is, A = length * breadth length and breadth are int type variable and these…
Q: s the given two complex numbers and updates the first complex number with the result and the second…
A: Write a program to print the sum of two complex numbers by creating a class named as‘ComplexNumbers’…
Q: Write a C++ program to read two distance objects d1, d2 in the form of yards and feet by…
A: Program: #include <iostream> using namespace std; class distance { public: double…
Q: consider an application to support buying and selling vintage musical instruments. Create a CRC card…
A: DESCRIPTION: Relational Database Design: Customer(SSN, Title,First_Name,Middle_Name, Last_Name,…
Q: Write a program to assign data to data number of of class such as day, month, year and display the…
A: Introdiction In this question we will write a program to assign a data to data number of class .
Q: In java Write a program to print the sum of two complex numbers by creating a class named as…
A: Import all the required headers. Declare the main function. Declare the variables of appropriate…
Q: Create a program which will read a phrase from the user and create a framed version of it for…
A: 1.#Begin 2.Phrase = input("Please Enter a Phrase:\t") 3.Position = input("Please Enter the…
Q: write a program to point the area of a rectangle by creating a class named 'Area' having two…
A: Declare class Area Declare length and breadth variables. Declare function setDin() with length and…
Q: Write a program that converts a number entered in Roman numerals to decimal. your program should…
A: import java.util.*;public class Main{static Scanner in=new Scanner(System.in);public static void…
Q: Write a Rectangle class that has the following fields: Length (L): a double Width (W): a double The…
A: * Writting program in c++ as no programming language in mentioned in the question. #include…
Q: (A) Write a Java program that reads student scores, displays the best score, and distribution of…
A: import java.util.Scanner; public class Grade { public static void main(string args[]) { Scanner…
Q: Write a program that reads students’ names followed by their test scores. The program should output…
A: Required: Write a program that reads students’ names followed by their test scores. The program…
Q: How do I solve this problem that deals with counting and subtracting calories in Java without using…
A: Create a new class with name FitnessPlanner1.java, then take the inputs from user.Calculate the VO2,…
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: Write a program that converts a number entered in Roman numerals to decimal. Your program should…
A: import java.util.*;import java.lang.*;import java.io.*; class Roman { String roman=""; int…
Q: write a program to print the area of a rectangle by creating a class named 'Area' having two…
A: Approach: Include necessary packages Declare variables length and breadth of type integer invoking…
Q: Create a "tank" class and use it in a program that accepts height and radius from the user and…
A: The class tank will be created using the keyword class. The __init__ function will initialize the…
Q: Write a class, NumberToMonth, which does the following: a. Ask the user to enter the month of the…
A: Here goes the program in python as no specific language was mention: month=int(input("Enter a month…
Q: Write a program that reads students’ names followed by their test scores. The program should output…
A: The program will take input number to take that amount of student’s information. Then we have…
Q: Write a program that converts a number entered in Roman numerals to decimal. Your program should…
A: Answer: #include<iostream>#include<bits/stdc++.h>#include<stdlib.h>using namespace…
Q: Write a java program to print the area of two rectangles having sides (4,5) and (5,8) respectively…
A: Input : In input, the object of the Rectangle class is created. In object creation, the…
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: Write a program to print the sum of two complex numbers by creating a class named as…
A: Program code: import java.util.*;import java.util.Scanner; public class ComplexNumbers { int…
Q: 5.write a program that initializes a String variable with "Welcome to Jac444!". Then, u methods of…
A: Java code to perform given question is given below.
Q: Define classes for square, rectangle, and circle with appropriate attributes, class variables, and…
A: Program Code: def cal_area(shape): if shape==1: s = int(input("Enter square's side length:…
Q: Create a java program using user defined function. Create a function/method void: -showinfo with…
A: public class Main{ public static void showinfo(int A1, String FN, String LN, String MI, int A2)…
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
- Write a program to print the area of a rectangle by creating a class named 'Area'having two functions.First function named as 'setDim' takes the length and breadth of the rectangle as parameters and the second functionnamed as 'getArea' returns the area of the rectangle. Length and breadth of therectangle are entered through keyboawrite a program to print the area and perimeter of a triangle having sides of 3 4 and 5 units by creating a class named triangle with a function to print the area and perimeter. use parameterize constructorYour task is to create a function that simulates a vending machine. Given an amount of money (in cents ¢ to make it simpler) and a product Number, the vending machine should output the correct product name and give back the correct amount of change. The coins used for the change are the following: [500, 200, 100, 50, 20, 10] The return value is an object with 2 properties: • product: the product name that the user selected. change: an array of coins (can be empty, must be sorted in descending order). Examples vendingMachine (products, 200, 7) vending Machine (products, 500, 0) → "Enter a valid product number" vendingMachine (products, 90, 1) "Not enough money for this product" → {product: "Crackers", change: [50, 20, 10
- Create a time class having data members hour, minute and second. Make a constructor to set the members zero, make a display function that outputs the time in given format: 00:00:00. Make a function called ticktick() that increments the time in such a way that hour do not change till the minutes and seconds ends at 60. (01:01:01…. 01:59:59 -> 02:00:00). Design the main function, create an object and call the functions accordingly.Create a program that will count the number of numeric characters in an input string. The program should be able to ask the user for the input string and should be able to display the number of numeric characters on the screen. For this exercise, you should create your class to handle the different operations. Remember that any input/output operations should be done in the main method while all calculations should be done inside the class. Remember that you need to apply encapsulation in your class. Sample Output: Enter a string: Hello 123 Number of numeric characters: 3Write the program in python. Write a class called BuildersGame that represents the board for a two-player game that is played on a 5x5 grid. During the game, each players' builders will move around the board and add levels to towers. The winner is the first one to move a builder on top of a 3-story tower. First, x places her two builders on the board, then o places her two builders on the board. Throughout the game, no two builders can ever occupy the same square. After the initial placements are complete, x must move either one of her builders to an adjacent square (one square orthogonally or diagonally). Builders always move to the top of the tower on their destination square. Builders can move any number of levels down, but can move at most 1 level up (they can also stay at the same level). You can visualize it as the builders hopping from the top of one tower to the top of another, but they can never move to a tower that is more than one level higher than the tower they're on.…
- Create a Python program that will determine the image properties of an object. Create a function called mirror_equation() that has two parameters. The first being a focal point of the mirror, the second being the distance of the object. Your function should calculate distance of the image and return the distance. Then create a function called magnification_equation() that has three parameters. The first being distance of the object, the second being the height of the object and the third being the distance of the image. Your function should calculate the height of the image and return this value. Use effective mainline logic to get user input, call the mirror _equation() and magnification_equation() functions, and display the final results. Your program should use the following two equations: Mirror equation: 1/f = 1/do + 1/di Magnification equation: hi/ho = di/do f = focal point of the mirror (in cm), do = distance of the object (in cm), di = distance of the image (in…Write a program containing class named 'square' in which side1, side2, side3 and side4 are passed through function as object, and it is checked whether the square is valid or not. The condition to check if length of all the four sides of square are equal, it is valid, otherwise invalid. Example 1:Enter length of 40Enter length of side 2: 40Enter length of side 3: 40Enter length of side 4; 40Square is Valid! Example 2:Enter length of side 1: 120Enter length of side 2 40Enter length of side 3: 30Enter length ofside 4: 40Square is InvalidProgram 1: Write a program that asks the user to input a sentence and then outputs the sentence back with the case of every character reversed. So for example: “CaTs RuLe!” would be given back as “cAtS rUlE!” . Spaces and punctuation should be left in place. You can use the Character class static functions to test the case of each letter. You do not need to place any code in static methods (besides the main method), you do not need to worry about try/catch blocks, and you do not need to make the program run more than once. in java
- Praveen who is working as Reservation Manager, asks for help from the development team to build a code that calculates the total cost to be charged on the customer by considering the date of Booking, date of vacating the hall, and cost per day. Imagine you are working in the development team and this task is assigned to you. Write a program to calculate the total amount charged by the Hall Manager.Create a class Hall in ‘Hall.py’ with the following variables. DataType Variablestart_date Dateend_date Datecost_per_day int Use _init_() constructor to initialize the variables with respect to class. Use a 3 Argument constructor (start_date, end_date, cost_per_day).Use the following methods in Hall class to perform the corresponding operation.Method Descriptionno_days(self) This method is used to calculate the number of days Item (say Hall) booked or used.cost(self,d) Calculate the Total amount for Item (say Hall). Where ‘d’ is a number of days that is been calculated. (Call this method…Write a full program that display the area of a rectangle. The program calls the following two functions: • getLengthWidth – This function uses a reference parameter variables to accept an int arguments length and width. This function should ask the user to enter the rectangle’s length and width. Input validation: length and width should be positive integers. • calArea – This function should accept the rectangle’s length and width as arguments and return the rectangle’s area. The area is calculated by multiplying the (length * width).Write a program by creating an 'Employee' class having the following functions and print the final salary.1 - 'getInfo()' which takes the salary, number of hours of work per day of employee as parameters2 - 'AddSal()' which adds $10 to the salary of the employee if it is less than $500.3 - 'AddWork()' which adds $5 to the salary of the employee if the number of hours of work per day is more than 6 hours.