
please help with the marked ones the programming language is python
For 23.16
Here i used luminance formula as
luminance = (r * 0.3) + (g * 0.59) + (b * 0.11) where r = red ; g = green; b = blue;
Code:
| class RGB: def __init__(self,red,green,blue): self.red = red self.green = green self.blue = blue def __str__(self): return ("red = " + str(self.red)+ ", green = " + str(self.green)+ ", blue = " +str(self.blue)) def luminance(self): lumi = (self.red * 0.3) + (self.green * 0.59) + (self.blue * 0.11) return(lumi) def main(): red = 100 green = 200 blue = 150 RGBColour = RGB(red,green,blue) print(RGBColour) print(RGBColour.luminance()) main() |
For 23.17
Code:
|
class CD: #if year of yearOfRelease was not previously set main() |
please help with the marked ones the programming language is python code. 23.16 Write an RGB...
1. Extending the answer from Python HW #7 for question #1, write
the following python code to expand on the Car class. Include the
python code you developed when answering HW #7.
Add class “getter” methods to return the values for model,
color, and MPG
Add class “setter” methods to change the existing values for
model, color, and MPG. The value to be used in the methods will be
passed as an input argument.
Add class method that will calculate...
IN JAVA Write a class Store which includes the attributes: store name, city. Write another class encapsulating an Art Gallery, which inherits from Store. An Art Gallery has the following additional attributes: how many paintings are sold every year and the number of artists submitting artwork. Code the constructor, accessors, mutators, toString and equals method of the super class Store. Code the constructor, accessors and mutators for the subclass Art Gallery. In the Art Gallery class, also code a method...
Write a class Store which includes the attributes: store name, city. Write another class encapsulating an Art Gallery, which inherits from Store. An Art Gallery has the following additional attributes: how many paintings are sold every year and the number of artists submitting artwork. Code the constructor, accessors, mutators, toString and equals method of the super class Store. Code the constructor, accessors and mutators for the subclass Art Gallery. In the Art Gallery class, also code a method returning the...
Question on struct Write a struct called Song. Song will have the data members string title, string artist, int yearRecorded, string genre, int lengthMin, and int lengthSec. This struct will have object-values song1, song2, song3, song4, song5, song6, song7 and song8. Add your code for the struct Song to the following code. Then test that it runs, what exactly is printed when it is run? void printSong(Song); int main() { song1.title = "YYZ"; song1.artist = "Rush"; song1.yearRecorded = 1981; song1.genre...
In python Programming Exercise 1 Write a function that will have a list as an input, the task of the function is to check if all the elements in the list are unique,( i.e. no repetition of any value has occurred in the list), then the function returns true otherwise it returns false. Your program should include a main method that call the method to test it. Algorithm Analysis For the function you implemented in part 1, please calculate T(n),...
Please write a code in python! Define and test a function named posterize. This function expects an image and a tuple of RGB values as arguments. The function modifies the image like the blackAndWhite function, but it uses the given RGB values instead of black. images.py import tkinter import os, os.path tk = tkinter _root = None class ImageView(tk.Canvas): def __init__(self, image, title = "New Image", autoflush=False): master = tk.Toplevel(_root) master.protocol("WM_DELETE_WINDOW", self.close) tk.Canvas.__init__(self, master, width = image.getWidth(), height = image.getHeight())...
Java Code Help! Code this: Calculate statistics. Write a class called Statistics that can calculate a number of properties about an array of doubles. There should be separate static methods to calculate the min, the max, the mean, the median, the standard deviation (make sure to make use of your mean method to implement this), and the mode. For the mode, you can assume that the data set is not multimodal. This class should not have a main method. Write...
11p
Python Language
Read the following code for oofraction. import oofraction class OOFraction: def main(): fl = oofraction.o0Fraction( 2, 5) f2 = oofraction.o0Fraction ( 1, 3) f3 = f1 + f2 print (str(3)) main() def __init__(self, Num, Den): self.mNum = Num self.mDen = Den return def_add_(self,other): num = self.mNumother.mDen + other.mNum*self.mDen den = self.mDen*other.mDen f = OOFraction(num,den) return f 1. Write the output below. def_str_(self): s = str( self.mNum )+"/" + str( self.mDen) returns 2. Write a class called wholeNum...
Hi I've a problem with this code. When I add more than 1 song to the list, it doesn't show the first one, only shows the latest one, when I called the function displaysong, let's say when you add 2 songs ID 1 then ID 2, it shows only ID 1. Can you fix it. Everything else is fine.. #include <iostream> #include<string> using namespace std; //class Song class Song{ private: int songID; string title; string artist; string album; int year; public:...
Look at this partial class definition, and then answer questions a - b below: Class Book Private String title Private String author Private String publisher Private Integer copiesSold End Class Write a constructor for this class. The constructor should accept an argument for each of the fields. Write accessor and mutator methods for each field. Look at the following pseudocode class definitions: Class Plant Public Module message() Display "I'm a plant." End Module...